This is the mail archive of the
mailing list for the GCC project.
Re: Decimal question and sqrt in math.h
> #include <stdio.h>
> #include <math.h>
> int main()
> printf("\n %1.55f \n", sqrt(3.9999999999999999));
> return 0;
> Result: 2
> Why does this return 2 ??
If you meant to use long double, you should have so specified. Decimal
digits beyond 17 aren't significant in conversion to IEEE 64-bit double.
Some of the properties of the floating point data types are shown in
Just as a matter of curiosity, how did you get this message marked as spam?