Original article : http://jmiiv.blogspot.tw/2008/08/ieee-754.html
為了防止忘記,又為重點考題,所以......
浮點數表示分為三個部份
S:符號,表示正負值,0為正,1為負
E:指數,基準值加上指數,單精度基準值為 [2^(8-1)]-1 = 127,倍精度基準值為 [2^(11-1)]-1 =1023
M:小數,又為精確值,小數值得正規劃,並且隱藏 MSB 的 1 (正規劃後面用例子解釋)
而又分為單精度與倍精度:單精度為32bits,倍精度為64bits
單精度 S:1bit E:8bits M:23bits
倍精度 S:1bit E:11bits M:52bits
ex. -12.625 使用 IEEE-754 單精度 表示浮點數
第一步驟:不管正負號直接將數值轉為二進制
12.625 => 1100.101 = 1.100101 × 2^3
第二步驟:計算指數
127+3=130 => 10000010
第三步驟:填入數值置於浮點數規格中
S E M
1 10000010 100101 0000 0000 0000 0000 0
*注意:1)小數部份要隱藏 MSB 的 1 ,只填入小數點之後的數值
2)剩餘沒用到的地方補0,補足至 23bits (倍精度就補足到 52bits)
如此一來可以將轉出來的浮點數再表示成 16 進制
=> 1100 0001 0100 1010 0000 0000 0000 0000
=> C14A0000
補充:
1. 指數E保留0與255做為特殊用途,因此指數真正的範圍在1~254之間。
2. 指數E與小數M的特殊用途組合如下
E=0 M=0:表示0
E=0 M≠0:未正規形式
E=255 M=0:表示無限大 (配合正負號,可以表示正無限、負無限)
E=255 M≠0:NaN (Not a Number)
3. 浮點數精確度的問題
由於浮點數當小數位數不足的時候會發生兩種 error
a.進位誤差:超出表示範圍的數值,使用四捨五入產生的誤差
b.捨去誤差:不足放入小數表示位數所剩餘的小數值,皆捨去產生的誤差
所以為了解決這樣的誤差,只有提高小數點可存放的位數,但是相對的所佔用的容量就很大
4. 轉換浮點數值的網頁工具
http://babbage.cs.qc.cuny.edu/IEEE-754/
http://www.h-schmidt.net/FloatConverter/IEEE754.html(single precision only)
2013年8月30日 星期五
2013年4月6日 星期六
How to Listen to GrooveShark over a Slow Internet Connection( Closed in Apr. 2015....)
●The content is copied from:
http://www.myfixlog.com/fix.php?fid=78
http://www.myfixlog.com/fix.php?fid=78
The Problem
My internet connection is very slow, how can I listen to GrooveShark without having it buffer constantly? Tags: slow, internet, GrooveSharkThe Fix
Summary: This tutorial if part of a series on Getting the Most out of a Slow Internet Connection, click here to see more tips.
GrooveShark users with slow connections will experience interrupted
songs as they wait for them to buffer. However, there is a setting that
will allows users with slow connections to listen to GrooveShark using
less bandwidth. The downside is that this setting also lowers the
quality from being comparible CD quality, to quality more similar to FM
radio. If this does not bother you, follow the steps below to speed up
GrooveShark.
Step 1 - Login or Create a GrooveShark Account
Step 2 - Change the Setting

Image 3

Image 2

Image 1
Next, select the Preferences tab. (Image 2)
Check the box next to Stream smaller, lower quality songs (good for slow connections). (Image 3)
Finally, click the Save Changes button.
Thats it!
You
must first have a GrooveShark account to be able to set specific
settings. Tip: Instead of creating a new account, you can login into
GrooveShark with your FaceBook or Google account.
First you need to get to Settings. To do so click on your name in the top right corner and then select Settings. (Image 1)
Next, select the Preferences tab. (Image 2)
Check the box next to Stream smaller, lower quality songs (good for slow connections). (Image 3)
Finally, click the Save Changes button.
Thats it!
訂閱:
文章 (Atom)