top | item 25963300

(no title)

parekhnish | 5 years ago

So, what should be used?

discuss

order

qayxc|5 years ago

The correct - but useless - answer is: any language that's IEC 60559:xxxx conformant.

Examples are: Fortran, R, C#, Java, D and many others.

You'd need to refer to a language's specification to find out, though some aren't very well defined. zig comes to mind; it supports the data types and offers strict mode, but doesn't explicitly state its IEE 754:2008 compliance.

CodesInChaos|5 years ago

Last I checked C# allowed the compiler to perform the computation with higher precision than what the code requires an then narrow down the the expected precision whenever it wants (you can trigger a narrowing by explicitly casting from a floating point type to itself). Which makes writing correct floating point code practically impossible.

cratermoon|5 years ago

COBOL

Seriously? Anything but floating point if you care about precision and accuracy.