rozick1 wrote: |
---|
long double num1 = 10210.730; |
The type of the expression
10210.730
is
double
and its value is
10210.72999999999956344254314899444580078125
or, using the more compact hex notation,
0x9.f8aeb851eb85p+10
When you use it to initialize a long double variable, its value doesn't change (a valid double is also a valid long double)
rozick1 wrote: |
---|
long double num2 = 10210.730L; |
The type of the expression
10210.730L
is
long double
and its value, assuming GCC (it's different in e.g. MSVC), is
10210.730000000000000426325641456060111522674560546875
or
0x9.f8aeb851eb851ecp+10
in hex
after multiplication by powl(10,4) (aka 10000), you get
102107299.9999999956344254314899444580078125 aka 0xc.2c1147ffffffda8p+23
and
102107300.0000000000072759576141834259033203125 aka 0xc.2c1148000000001p+23
and there you should see how fmodl by 10 gives you 9 and 0 respectively.