Advertisment

Cross-platform issues with floating-point arithmetics in C++

author-image
CIOL Bureau
Updated On
New Update

BANGALORE, INDIA: The C++ standard does not specify a binary representation for the floating-point types float, double and long double. Although not required by the standard, the implementation of floating point arithmetic used by most C++ compilers conforms to a standard, IEEE 754-1985, at least for types float and double.

This is directly related to the fact that the floating point units of modern CPUs also support this standard. The IEEE 754 standard specifies the binary format for floating point numbers, as well as the semantics for floating point operations. Nevertheless, the degree to which the various compilers implement all the features of IEEE 754 varies. This creates various pitfalls for anyone writing portable floating-point code in C++. These issues, and ways how to work around them, are the topic of this paper.

Click here to know more...!

 

tech-news