I found that when I compiled for the Mac, integers could be made very large. When I used Int64 and built for windows, it seemed that I was reduced to the integer size for windows, with consequent out of bounds errors.
I wrote this function to display a double as an integer in text, overcoming this problem
Function displayDoubleAsInteger(numberToDisplay as Double) As String
Var myString As String = Floor(numberToDisplay).ToText // number.000000
Var myIntegerAsInteger=myString.indexof(0,".") // where is the “.”
myString = myString.Left(myInteger) // everything before the “.”
return myString
End Function
[quote=477241:@Philip Cumpston]I found that when I compiled for the Mac, integers could be made very large. When I used Int64 and built for windows, it seemed that I was reduced to the integer size for windows, with consequent out of bounds errors.
I wrote this function to display a double as an integer in text, overcoming this problem
Function displayDoubleAsInteger(numberToDisplay as Double) As String
Var myString As String = Floor(numberToDisplay).ToText // number.000000
Var myIntegerAsInteger=myString.indexof(0,".") // where is the “.”
myString = myString.Left(myInteger) // everything before the “.”
return myString
End Function[/quote]
You will however get an out of bounds exception if numberToDisplay starts out with a whole number without a decimal. IndexOf would return -1 and Left(-1) triggers the exception.
Thanks for the input everyone. It was a weird error. I thought that integer out of bounds shouldn’t occur, but whenever I passed a double to an integer for display purposes, it would give a negative number like an out of bounds error whenever I exceeded 32000 or so.
I overlooked the Format function - thanks Emile. I am still tracking down the error, but I suspect that using Floor and then converting it to an integer does something weird in Windows but not in OSX
[quote=477300:@Philip Cumpston]Thanks for the input everyone. It was a weird error. I thought that integer out of bounds shouldn’t occur, but whenever I passed a double to an integer for display purposes, it would give a negative number like an out of bounds error whenever I exceeded 32000 or so.
I overlooked the Format function - thanks Emile. I am still tracking down the error, but I suspect that using Floor and then converting it to an integer does something weird in Windows but not in OSX[/quote]
You wouldnt happen to also be using this number for defining the width or height of a picture, would you?