But if the variables defined as 0.7Such as ss: double; Ss:=0.7; Trunc (ss/0.1)=6?????? How can you ask properly 7?
CodePudding user response:
Is 0.6
0.7 the scientific notation when values are generally showed 0.6 xxxxcccxxcxE
CodePudding user response:
The ideal way is, as far as possible, using integer as your topic:
(ss * trunc (10)/(0.1 * 10))
So close to the real results you want
CodePudding user response:
Not surprisingly, this is trunc, not round, round in the IEEE754 standard also defines five rounding algorithm, trunc a number, if the number of binary floating-point decimal value cannot accurately said, j may produce larger error, Delphi, if required high precision floating point arithmetic, 1 TBcd type, can be used to represent up to 64 decimal number (integer + decimal), starting from the D6 have TBcd algorithm library, if requiring the performance is not recommended, you can use third party operation of large Numbers of libraries, such as MPArith BigFloat, such as
CodePudding user response:
This is a Double precision: Ss: double; Ss:=0.7; In fact of the SS value is 0.6999999999999 So, trunc (ss/0.1) is 0.699999999999999/0.1, nature is 6.9999999...
CodePudding user response:
Thank you, it is as you say, but how to express it, but for the ss to write the rounding also not line, molecular denominator are multiplied 100 times also not line, Can't ss: double; Ss:=0.7; Trunc (ss + 0.00000001)/(0.1)=this is can, turnc molecules to add a 0.00000001???????