[fixed] VAL inconsistent behaviour. (Page 1) ● SmileBASIC Source Forums

Register

# [fixed] VAL inconsistent behaviour.

• #1 ✎ 477 SquareFingers VAL("12 dogs") evaluates to zero. VAL("12 giraffes") evaluates to twelve. Honestly, it's as if they must have put some effort into creating bugs. Posted Edited by SquareFingers
• #2 ✎ 56 brilliance360 First Week Joined in the very first week of SmileBASIC Source Website Spring 2017 Contest Participant I participated in the SmileBASIC Source Spring 2017 Contest! Programming Contest Deep Sleep Hidden Website This looked too bizarre to not mess with. Unfortunately, the glitch doesn't seem to be associated with the word giraffes specifically, but string length instead where, after a certain length, SB stops seeing it as a string (or something?) and just registers the numbers at the beginning. So VAL("37 giraffes") is 37. Or VAL("1627GOOFS1") returns zero, but VAL("1627GOOFS12") returns 1627. Also, the string in VAL( ) has to start with a number, otherwise it looks like it always returns 0. I was honestly looking forward to some bizarre bug where the word giraffes registers as a number... Posted
• #3 ✎ 270 NeatNit First Week Joined in the very first week of SmileBASIC Source Website Expert Programmer Programming no longer gives me any trouble. Come to me for help, if you like! Programming Strength Night Person I like the quiet night and sleep late. Express Yourself If you ask me, VAL("12 dogs") should also evaluate to 12. Square, please send this bug report to SmileBOOM so they could fix it for the next update! Edit: also, can you check what happens in the following cases? ```VAR A\$ = "12 dogs" VAR B\$ = "12 giraffes" PRINT VAR(A\$) PRINT VAR("12 dogs") PRINT VAR(B\$) PRINT VAR("12 giraffes") VAR C\$ = "12 " VAR D\$ = "12 " 'just lost of spaces PRINT VAR(C\$) PRINT VAR("12 ") PRINT VAR(D\$) PRINT VAR("12 ") 'Even later edit: VAR THISBETTERWORK\$ = "12" PRINT VAL(THISBETTERWORK\$) PRINT VAL("12")``` Posted Edited by NeatNit
• #4 ✎ 56 brilliance360 First Week Joined in the very first week of SmileBASIC Source Website Spring 2017 Contest Participant I participated in the SmileBASIC Source Spring 2017 Contest! Programming Contest Deep Sleep Hidden Website
If you ask me, VAL("12 dogs") should also evaluate to 12. Square, please send this bug report to SmileBOOM so they could fix it for the next update! Edit: also, can you check what happens in the following cases? ```VAR A\$ = "12 dogs" VAR B\$ = "12 giraffes" PRINT VAR(A\$) PRINT VAR("12 dogs") PRINT VAR(B\$) PRINT VAR("12 giraffes") VAR C\$ = "12 " VAR D\$ = "12 " 'just lost of spaces PRINT VAR(C\$) PRINT VAR("12 ") PRINT VAR(D\$) PRINT VAR("12 ") 'Even later edit: VAR THISBETTERWORK\$ = "12" PRINT VAL(THISBETTERWORK\$) PRINT VAL("12")```
0 0 12 12 0 0 12 12 12 12 I assumed that all PRINT VAR( )'s were meant to be PRINT VAL( )
Posted
• #5 ✎ 270 NeatNit First Week Joined in the very first week of SmileBASIC Source Website Expert Programmer Programming no longer gives me any trouble. Come to me for help, if you like! Programming Strength Night Person I like the quiet night and sleep late. Express Yourself Yep, my mistake. Thanks! Posted
• #6 ✎ 477 SquareFingers
If you ask me, VAL("12 dogs") should also evaluate to 12.
That is the way I would choose to resolve the inconsistency. But, no matter whether they resolve it one way or the other, either consistent behaviour is definitely better.
Square, please send this bug report to SmileBOOM so they could fix it for the next update!