floating point - A more accurate data type than float or double? C++ -


does c++ have more accurate data type float or double, or have settle fact calculations off?

edit: mr. lister has pointed out, question regarding precision. it's bit frustrating when add 2 floats/doubles , number off half time comparing calculation done hand.

in compilers, , on architectures, "long double" give give more precision double. if on x86 platform x87 fpu has "extended" 80-bit floating point format. gcc , borland compilers give 80 bit float value when use "long double" type. note visual studio not support this (the maximum supported msvc double precision, 64 bit).

there called "double double" software technique implementing quad-precision 128-bit floating point. can find libraries implement it.

you investigate libraries arbitrary precision arithmetic.

for calculations 64 bit integer better choice 64 bit floating point value.

but if question built-in types in current c++ compilers on common platforms answer you're limited double (64 bit floating point), , on 64 bit platforms have 64 bit ints. if can stick x86 , use right compiler can have long double (80-bit extended precision).

you might interested in question:

long double (gcc specific) , __float128


Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

Function that returns a formatted array in VBA -