Jump to content

IsNumber Bug?


Recommended Posts

from the help (beta 3.1.1.107)

Variants can be of two base types: Strings and Numbers. Additionally, a number can be whole (integer) or fractional/floating-point.

if i read it correctly both should return 1 but they don't

MsgBox(0,"IsNumber", IsNumber(0))

MsgBox(0,"IsNumber", IsNumber("0"))

Edited by gafrost

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

Maybe it's some sort of mistype because I found this in the help file. Not the same thing but similar enough:

IsInt(-12345)   ;returns 1
IsInt(3.0000)   ;returns 1
IsInt("5432")   ;returns 0 since is a string
IsInt(7.5 - 4.5) ;returns 1 since evaluates to integer 3

IsFloat(3.14159) ;returns 1
IsFloat(3.000)   ;returns 0 since value is integer 3
IsFloat(1/2 - 5) ;returns 1
IsFloat(1.5e3)   ;returns 0 since 1.5e3 = 1500
IsFloat("12.345") ;returns 0 since is a string
Link to comment
Share on other sites

from the help (beta 3.1.1.107)

Variants can be of two base types: Strings and Numbers. Additionally, a number can be whole (integer) or fractional/floating-point.

if i read it correctly both should return 1 but they don't

MsgBox(0,"IsNumber", IsNumber(0))

MsgBox(0,"IsNumber", IsNumber("0"))

I am going to stick my neck out and say it is an incorrect assumption. As soon as you place the quotes inside the brackets you have included a string into it which I would always expect failure.


Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Link to comment
Share on other sites

I am going to stick my neck out and say it is an incorrect assumption. As soon as you place the quotes inside the brackets you have included a string into it which I would always expect failure.

I think your right, had to dig through some code and remembered a problem with the sort routine for the GuiListView

found i ended up using StringIsInt and StringIsFloat

Gary

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...