-->
Page 1 of 2

Int() and Hex() function not working in Ver 2.0

PostPosted: Wed Aug 03, 2016 5:26 am
by kingedem
serialprint "55555: " & int("1") & "-" & int("2") & "-" & int("10") & chr(13) & chr(10)
Out put : 55555: 2147483648-2147483648-2147483648

serialprint "Hex: " & hex("1") & "-" & hex("2") & "-" & hex("10") & chr(13) & chr(10)
Out put : Hex: 7fffffff-7fffffff-7fffffff

Re: Int() and Hex() function not working in Ver 2.0

PostPosted: Sat Aug 06, 2016 2:50 pm
by Mmiscool
The int() function is to return an integer from a value. This means a whole number removing all of the decimals.
It can not be used on a string. To use it on a string you must convert the sstring to a number first using the val() function.
example:
Code: Select allprint int(1.23456)     ' will print 1


example:
Code: Select allprint int(val("2.34567"))     ' will print 2


It looks like you might just be looking for the val function.

Re: Int() and Hex() function not working in Ver 2.0

PostPosted: Sat Aug 06, 2016 9:36 pm
by kingedem
I think, I tried "Val" function and it didn't work. So managed with "floor" function

Also, using "return" based on multiple conditions in a subroutine does not work. I think, it's needed feature to optimize the speed of code.

Re: Int() and Hex() function not working in Ver 2.0

PostPosted: Sat Aug 06, 2016 10:06 pm
by Mmiscool
Post example of code for the return failure.