Bug #79
closedVal function only converts integer portion of string.
0%
Description
Example: (all return integers)
X$="1234.56"
Y$="-234.56"
Print Val(X$), Val(Y$) ' Should print: 1234.56 -234.56
Vx=Val(X$):Vx#=Val(X$)
Print Vx,Vx# ' Should print 1234 1234.56
Vy=Val(Y$):Vy#=Val(Y$)
Print Vy,Vy# ' Should print -234 -234.56
Files
Updated by Brian Flanagan almost 5 years ago
Oops! Forgot to login again: Brian Flanagan
Updated by Baptiste Pillot almost 5 years ago
- Description updated (diff)
- Assignee set to Francois Lionet
- source : https://www.amos2.fr/ide/Amos2/Ide/Program/449
- run : https://www.amos2.fr/run/tickleman/79/
- output :
1234 -234
1234 1234
-234 -234
- expected :
1234.56 -234
1234 1234.56
-234 -234.56
Updated by Francois Lionet almost 5 years ago
- File Annotation 2020-02-03 191342.png Annotation 2020-02-03 191342.png added
- Status changed from New to Resolved
- Target version set to 0.9.4
Corrected!
Updated by Brian Flanagan almost 5 years ago
- Status changed from Resolved to Feedback
Tested in 0.9.5.1 Partially working.
The third example works wrong with integers.
It is rounding instead of taking the integer portion.
It should return -234 vs. -235
Updated by Brian Flanagan over 4 years ago
- Affected version changed from 0.9.3.1 to 0.9.8.1
re-tested in 0.9.8.1 Example 3 still fails.
First value should be an integer, but was rounded up.
Example 3:
X$="1234.56"
Y$="-234.56"
Vy=Val(Y$):Vy#=Val(Y$)
Print Vy,Vy# ' Should print -234 -234.56
Result should be:
-234 -234.56
Instead, I get:
-235 -234.56
Updated by Brian Flanagan over 4 years ago
- Status changed from Feedback to In Progress
- Assignee changed from Francois Lionet to Brian Flanagan
I know what needs to change for the one remaining function that is failing.
Vy=Val(Y$) is being converted to an integer using floor(). That's Ok for positive numbers only.
Negative numbers should use ceil() instead.
Updated by Brian Flanagan over 4 years ago
- Status changed from In Progress to Resolved
Fixed the last part of this that wasn't working.
Corrected this same issue in several places in the code.
Updated by Brian Flanagan about 4 years ago
- Status changed from Resolved to Closed
Working in Beta RC3!