Oberon Community Platform Forum
December 12, 2019, 08:42:12 AM
Welcome,
Guest
. Please
login
or
register
.
Did you miss your
activation email?
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
News
:
Home
Help
Search
Login
Register
Oberon Community Platform Forum
>
Development
>
Bug Report
>
Utilities.StrToFloat
Pages: [
1
]
« previous
next »
Print
Author
Topic: Utilities.StrToFloat (Read 3722 times)
fnecati
Jr. Member
Posts: 60
Utilities.StrToFloat
«
on:
December 17, 2008, 12:01:21 PM »
Using str:="1.0E+3", StrToFloat procedure cannot detect optional "+" character, so conversion to float is wrong.
In Utilities.StrToFloat procedure;
IF (s[p] = "d") OR (s[p] = "D") OR (s[p] = "e") OR (s[p] = "E") THEN
INC(p); e := 0;
IF s[p] = "-" THEN negE := TRUE; INC(p) ELSE negE := FALSE END;
WHILE (s[p] = "0") DO INC(p) END;
WHILE ("0" <= s[p]) & (s[p] <= "9") DO
e := e * 10 + (ORD(s[p]) - 30H);
INC(p);
END;
IF negE THEN y := y / Reals.Ten(e)
ELSE y := y * Reals.Ten(e) END;
END;
==> should be corrected as ( I think )
IF (s[p] = "d") OR (s[p] = "D") OR (s[p] = "e") OR (s[p] = "E") THEN
INC(p); e := 0;
IF s[p] = "-" THEN negE := TRUE; INC(p)
ELSIF s[p] = "+" THEN negE := FALSE; INC(p) (* <<<< *)
ELSE
negE := FALSE
END;
WHILE (s[p] = "0") DO INC(p) END;
WHILE ("0" <= s[p]) & (s[p] <= "9") DO
e := e * 10 + (ORD(s[p]) - 30H);
INC(p);
END;
IF negE THEN y := y / Reals.Ten(e)
ELSE y := y * Reals.Ten(e) END;
END;
Logged
staubesv
Administrator
Sr. Member
Posts: 387
Re: Utilities.StrToFloat
«
Reply #1 on:
December 17, 2008, 12:16:29 PM »
Included in revision 1820.
Thanks!
Logged
Pages: [
1
]
Print
« previous
next »
Jump to:
Please select a destination:
-----------------------------
General
-----------------------------
=> General Discussion
=> OCP
-----------------------------
Development
-----------------------------
=> General
=> Oberon & Active Oberon
=> AOS
=> WinAOS
=> UnixAOS
=> ETH Oberon
=> ETH Zonnon
=> Merge Requests
=> Bug Report
-----------------------------
Projects
-----------------------------
=> ObeDAV
=> Matrix
-----------------------------
Support
-----------------------------
=> Installation
Loading...