I'm translating a scientific C program into Go that is doing some 64bit 
floating point operations. 

In this process I check that the same input yields the same output. 
Unfortunately they don't yield the same result, though the computation is 
simple. It is as follow. I receive a 64bit integer value. 

This value is converted to float64/double, and divided by 2^64.
The resulting number is multiplied by 1e8. 

With C I get 41 6E 84 FD 00 09 90 D7, with Go I get 41 6E 84 FD 00 09 E6 
8E. The last 15bits are different. The computation is performed with the 
same computer.

Could it be that the C program is performing the computation with long 
double (80 bit) precision and that Go is doing it with 64bit precision ? 

Is there something I could do about it because that might be a red flag for 
replacing the C program with a Go program.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/f9b7a823-e010-4c51-9491-6da865754dc2n%40googlegroups.com.

Reply via email to