Thursday, March 03, 2011

Perils of floating point arithmetic

A recent discussion on stackoverflow brought up the issue of results of floating point arithmetic being non-reproducible

A reader asked what one could do to guarantee that result of floating point computation is always the same, and Daniel Lichtblau, a veteran developer at the kernel group of WRI replied that "it is impossible with current hardware and software"

One problem is that IEEE 754 standard is ambiguous, and different implementations of it give slightly different results. See page 250 of What Every Computer Scientist Should Know About Floating Point Arithmetic for specific examples. This means that compiling code on a different system can produce slightly different results.

Another issue is that even when you run the same computation on the same system, results can be slightly different on reruns. This has to do with how low-level optimization is scheduled.

This means that if you want your results to be reproducible, you should avoid things like testing floating point numbers for equality. John D Cook gives some more advice in Five Tips for Floating Point Programming

20 comments:

svr online Training said...

Good One...Salesforce Training Online

veronica wijaya said...

Partai99 Agen Bola, Taruhan Bola, Poker Domino, Togel, Casino Terpercaya
http://www.partai88.org

👉 Minimal Pasang Taruhan Rp.10.000,-
👉 Minimal Depo Rp.50.000,-
👉 Minimal Withdraw Rp.50.000,-

1 USER ID UNTUK SEMUA GAMES DALAM 1 WEBSITE
* Bonus Cashback Sportbook Up To 10%
* Bonus Rollingan Casino 0.8%
* Promo Bonus Referal 2.5%
* Promo Bonus Rollingan Poker 0.3%

Contact:
- BBM : 335A62F1
- WA : +85587419560
- Line : Partai99

Link Alternatif Partai99 :
- http://www.partai88.org
- http://www.partai88.info

Gabung dan Mainkan Gamesnya!!
Partai99
Agen bola
Agen bola terpercaya
Agen Casino Online
Agen bandarq
Agen poker online
Prediksi Bola
Prediksi Togel

QuickBooks Customer Service Phone Number said...

People working with accounts, transaction, banking transaction need our service. Some of you are employing excel sheets for a few calculations. QuickBooks Tech Support Number all the above has a certain use.

htop said...

thanks for sharing this informations
best angularjs training in chennai
angular js training in sholinganallur
angularjs training in chennai
azure training in chennai
best java training in chennai
selenium training in chennai

bestonlinetraining said...

nice article thanks for sharing the post...!

sumathikits said...

nice article thanks for sharing the post...!
Sql and Plsql Training

Tableau Training

Teradata Training

Testing Tools Training

Unknown said...

THANKS FOR THE INFORMATION...
<a href="http://www.chloros.in/digital-marketing-internship.htmlhttp://www.chloros.in/digital-marketing-internship.html>Digital Marketing Internship Program in Bangalore</a>

draj said...


Excellent machine learning blog,thanks for sharing...
Seo Internship in Bangalore
Smo Internship in Bangalore
Digital Marketing Internship Program in Bangalore

https://tagifind.com/ips-officer-kaise-bane/ said...

https://tagifind.com/ips-officer-kaise-bane/

https://tagifind.com/assistant-professor-kaise-bane/ said...

https://tagifind.com/assistant-professor-kaise-bane/

https://tagifind.com/scientist-kaise-bane/ said...

https://tagifind.com/scientist-kaise-bane/

https://tagifind.com/ias-officer-kaise-bane/ said...

https://tagifind.com/ias-officer-kaise-bane/

https://tagifind.com/what-is-computer-cmos/ said...

https://tagifind.com/what-is-computer-cmos/

https://tagifind.com/what-is-dongle-how-to-use-dongle/ said...

https://tagifind.com/what-is-dongle-how-to-use-dongle/

https://tagifind.com/the-bitter-truth-associated-with-indian-society/ said...

https://tagifind.com/the-bitter-truth-associated-with-indian-society/

https://tagifind.com/what-is-windows/ said...

https://tagifind.com/what-is-windows/

https://tagifind.com/what-is-microsoft-word/ said...

https://tagifind.com/what-is-microsoft-word/

https://tagifind.com/ said...

https://tagifind.com/

https://tagifind.com/computer-hardware-kya-hai/ said...

https://tagifind.com/computer-hardware-kya-hai/

winner77bet said...

agen bola terpercaya
judi bola terpercaya
daftar joker123