Project

General

Profile

Bug #79

Val function only converts integer portion of string.

Added by Anonymous about 4 years ago. Updated over 3 years ago.

Status:
Closed
Priority:
Normal
Target version:
Start date:
01/25/2020
Due date:
% Done:

0%

Estimated time:
Affected version:

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

Annotation 2020-02-03 191342.png (8.38 KB) Annotation 2020-02-03 191342.png Francois Lionet, 02/03/2020 06:14 PM
#1

Updated by Brian Flanagan about 4 years ago

Oops! Forgot to login again: Brian Flanagan

#2

Updated by Baptiste Pillot about 4 years ago

  • Description updated (diff)
  • Assignee set to Francois Lionet
 1234     -234
 1234      1234
-234      -234
  • expected :
 1234.56  -234
 1234      1234.56
-234      -234.56
#3

Updated by Francois Lionet about 4 years ago

Corrected!

#4

Updated by Brian Flanagan about 4 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

#5

Updated by Brian Flanagan almost 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
#6

Updated by Brian Flanagan over 3 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.

#7

Updated by Brian Flanagan over 3 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.

#8

Updated by Brian Flanagan over 3 years ago

  • Status changed from Resolved to Closed

Working in Beta RC3!

Also available in: Atom PDF