Tag Archives: decimal

NASA 的 JPL 回答「你們用的圓周率是 3.14 嗎?」的問題

NASA 的 JPL 回答了他們所使用的圓周率:「How Many Decimals of Pi Do We Really Need?」。 答案是小數下十五位: For JPL's highest accuracy calculations, which are for interplanetary navigation, we use 3.141592653589793. 先拿目前離地球最遠的人造物 Voyager 1 來舉例,約 201 億公里 (125 億英里) 的距離,使用這個小數下 15 位的圓周率,與實際的圓周率算出來的誤差只有 3.81 公分 (1.5 … Continue reading

Posted in Computer, Murmuring, Programming, Science | Tagged , , , , , | Leave a comment

0.1 + 0.2 = 0.30000000000000004

看到「http://0.30000000000000004.com/」這個網站對經典的 0.1 + 0.2 問題整理了各語言的結果。這個網址名稱也很機車啊 XD 開頭的說明講述 IEEE 754 二進制表示法的問題: Your language isn't broken, it's doing floating point math. Computers can only natively store integers, so they need some way of representing decimal numbers. This representation comes with some degree … Continue reading

Posted in Computer, Murmuring, Programming | Tagged , , , , , , , | Leave a comment

DEC64 浮點數

在 Hacker News Daily 上看到「DEC64: Decimal Floating Point」: 公式是: value = coefficient * 10exponent 是以 10 為底。 0 與 NaN 是特別處理: There are 255 possible representations of zero. They are all considered to be equal. There is a special value … Continue reading

Posted in Computer, Murmuring, Programming | Tagged , , , | Leave a comment