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


svr online Training said...

Good One...Salesforce Training Online

veronica wijaya said...

Partai99 Agen Bola, Taruhan Bola, Poker Domino, Togel, Casino Terpercaya

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

* Bonus Cashback Sportbook Up To 10%
* Bonus Rollingan Casino 0.8%
* Promo Bonus Referal 2.5%
* Promo Bonus Rollingan Poker 0.3%

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

Link Alternatif Partai99 :

Gabung dan Mainkan Gamesnya!!
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...

<a href=">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 said... said... said... said... said... said... said... said... said... said... said...

winner77bet said...

agen bola terpercaya
judi bola terpercaya
daftar joker123