Home > Back-end > How to turn the string into the extended in Delphi? Urgent please... Strtofloat in?
How to turn the string into the extended in Delphi? Urgent please... Strtofloat in?
Time:09-20
I now have to deal with the figures in this form: 9.062705115038622 e-4 or 0.0018839088514177576 because it USES double not, more than double can store is extended, right? Now I want to make more than digital string into extended type of existence in the array, but strtofloat interception accuracy is changed, for example: 0.0022783474240102275 use strtofloat is 0.002278347424 after only the first 12, how to do? I also tried with val, the result is still the same can only be intercepted before 12 string, what shall I do?????? Please give a great god help me!!!!!!!!!!!!!!!!!!!!!
CodePudding user response:
Still don't go directly to the string stored in the array is not the same?
CodePudding user response:
Delphi32 is no problem, extended in delphi64=double, so alone is less than 19/20 of a precision, but the double 15/16, not only 12, Test: Var S: a string; X: extended; The begin S:='0.0022783474240102275'; X:=StrToFloat (s); Writeln (x: 0:19); end;
CodePudding user response:
Out into the array, and then the number or you
var S: a string; Dd: Extended; Str: string; VD: array [1.. 5] of Extended; The begin S:='0.0022783474240102275'; Dd:=StrToFloat (s); VD [2] :=dd; Str:=FormatFloat (' 0.000000000000000000000000000000 ', vD [2]). end;