for long long time, Mikroe says, they are working at a StrToFloat conversion...but nothing happens
If i work with this..I have Problems...
It converts 1 in 1 and 1.0 in 1.0 but
it goes to 1.65 in 1.65...
but 1.66 doesn't work till 2 then it works again till 2.65 at 2.66 it's wrong again...till 3...to 3.65....and so on
Code: Select all
function StrtoFloat(var data_str4 : string[17]) : real;
var txt10 : string[10];
lungime, lungime1 : byte;
pt1, pt2 : ^byte;
begin
result := 0.;
lungime := StrLen(data_str4);
if (lungime = 0) or (lungime > 17) then exit;
lungime1 := StrChr(data_str4,'.');
if lungime1 = 0 then exit;
txt10 := '00000';
pt1 := @data_str4[lungime1];
pt1^ := 0;
pt1 := pt1 + 1;
pt2 := @txt10;
inc(lungime1);
while lungime1 < lungime do
begin
pt2^ := pt1^;
pt2 := pt2 + 1;
pt1 := pt1 + 1;
inc(lungime1);
end;
if data_str4[0] = '-' then result := real(StrtoInt(data_str4)) - real(Strtoword(txt10))/100000.0
else result := real(StrtoInt(data_str4)) + real(Strtoword(txt10))/100000.0;
end;