iWIN 必須被解散!

Weil Jimmer's BlogWeil Jimmer's Blog


關於小數的進位法 10進位轉2進位、2進位轉10進位。
No Comments

發布:
更新:2017-05-24 17:03:16

這個問題真的很難處理很難處理!然而網路上也是Google 很久才有的資料。

好吧進入正題。

首先,大家應該都知道,進位算法就是取餘數,但是小數的算法卻是 乘 起來,取整。

Example:

*****0.625 轉 2進位制:

第1式:0.625 × 2 = 1.250 =======>1

第2式:0.250 × 2 = 0.500 =======>0

第3式:0.500 × 2 = 1.000 =======>1

答案是:101

*****0.125 轉 2進位制:

第1式:0.125 × 2 = 0.250 =======>0

第2式:0.250 × 2 = 0.500 =======>0

第3式:0.500 × 2 = 1.000 =======>1

答案是:001

*****0.3 轉 2進位制:

第1式:0.3 × 2 = 0.6 =======>0

第2式:0.6 × 2 = 1.2 =======>1

第3式:0.2 × 2 = 0.4 =======>0

第4式:0.4 × 2 = 0.8 =======>0

第5式:0.8 × 2 = 1.6 =======>1

第5式 偵測到重複字串,造成循環無限小數。

由第2式開始循環字串。

答案是:01001

這樣大概就夠了,這是 10 轉 2 的方式,其他就以此類推。

但是網路上很少有提到!轉回來。只有轉過去。

123.45 = 1 × 102 + 2 × 101 + 3 × 100 + 4 × 10-1 + 5 × 10-2

所以,小數點後,如果是2進位,則是2-1、2-2、2-3 ‧‧‧‧‧‧‧以此類推。

真是難處理,尤其是無限小數的轉換。

所以,我原本也想做一個很棒的程式,但看樣子,我也許得放棄了。

因為有夠麻煩!我目前的程式因為 算的精度太高了,所以無法處理無限小數的問題。

我大概 應該還會繼續完成的樣子,只是需要時間思考。


This entry was posted in Functions By Weil Jimmer.

About Weil Jimmer

avatar

Hi! Everyone! My name is Weil Jimmer. This is my personal blog. I'm a webmaster of this site. I hope the site will be popular. Now, Let's go! Enjoy gaining more knowledge.
More Details About Me : https://weils.net/profile.php

Leave a Reply

Name*:

Email*:

Website:

Privacy:   

Comment*:

Visitor Count

pop
nonenonenone

Note

支持網路中立性.
Support Net Neutrality.

飽暖思淫欲,饑寒起盜心。

支持臺灣實施無條件基本收入

今天是青年節。

Words Quiz


Search

Music

Blogging Journey

4228days

since our first blog post.

Republic Of China
The strong do what they can and the weak suffer what they must.

Privacy is your right and ability to be yourself and express yourself without the fear that someone is looking over your shoulder and that you might be punished for being yourself, whatever that may be.

It is quality rather than quantity that matters.

I WANT Internet Freedom.

Reality made most of people lost their childishness.

Justice,Freedom,Knowledge.

Without music life would be a mistake.

Support/Donate

This site also need a little money to maintain operations, not entirely without any cost in the Internet. Your donations will be the best support and power of the site.
MethodBitcoin Address
bitcoin1gtuwCjjVVrNUHPGvW6nsuWGxSwygUv4x
buymeacoffee
Register in linode via invitation link and stay active for three months.Linode

Support The Zeitgeist Movement

The Zeitgeist Movement

The Lie We Live

The Lie We Live

The Questions We Never Ask

The Questions We Never Ask

Man

Man

THE EMPLOYMENT

Man

In The Fall

In The Fall

Facebook is EATING the Internet

Facebook

Categories

Android (7)

Announcement (4)

Arduino (2)

Bash (2)

C (3)

C# (5)

C++ (1)

Experience (50)

Flash (2)

Free (13)

Functions (36)

Games (13)

General (57)

HTML (7)

Java (13)

JS (7)

Mood (24)

Note (30)

Office (1)

OpenWrt (5)

PHP (9)

Privacy (4)

Product (12)

Python (4)

Software (11)

The Internet (24)

Tools (16)

VB.NET (8)

WebHosting (7)

Wi-Fi (5)

XML (4)