Home > Back-end >  This super simple code, the output is correct
This super simple code, the output is correct

Time:11-20

Recently dizzy by the float type + _ +
And calculator output is not the same as the result of the

CodePudding user response:

How to handle flote type?

CodePudding user response:

Results no affects a sort order has changed

CodePudding user response:

Float is not as accurate as the integer data type, this is because the float in memory of the logo and the accuracy is determined by ~

CodePudding user response:

reference 3 building self-confidence boy reply:
float is not as accurate as the integer data type, this is because the float identification precision and its decision in the memory ~

Sometimes this error will cause the result of uncertain

CodePudding user response:

Please refer to the "c + + floating-point variable storage"
Wish I could help you!

CodePudding user response:

The building Lord check code! I think is right according to the results of the code, a larger negative minus a small negative number, the result is negative, of course

CodePudding user response:

Use double instead of float
Float only said up to 23 binary, decimal,
Double can represent 53 binary decimal

CodePudding user response:

Try to double?

CodePudding user response:

This simple program with double by the way, my own research program or not

CodePudding user response:

You use float certainly can not meet the requirements, you work it out to know 30354. XXXX wide integer part accounted for 15, use float, the decimal part can only be said about eight, are almost accurate said to decimal point and 2-3, so can't

CodePudding user response:

To use the type double
  • Related