Home > Back-end >  Consult how to keep two decimal, float value addition subtraction, and so on, is sure to get the rig
Consult how to keep two decimal, float value addition subtraction, and so on, is sure to get the rig

Time:01-21

Consult how to keep two decimal, float value addition subtraction, and so on, is sure to get the right result? thank you

CodePudding user response:

You have to define the "correct", such as to how many decimal places

CodePudding user response:

reference 1/f, play big shoot early nuclear response:
you have to define the "correct", such as to how many decimal places

Such as the two? How to do?

CodePudding user response:

Accuracy of floating point Numbers are, let alone to ensure that the results of operation after the "right", you are a single definition of a float variable and its value is not necessarily "right",
Int main (void)
{
Float a=123456789.0 f;
STD: : cout & lt; }
This code runs a try,