converting a string to a number

I have a very long “number” as String

210501700012345678131468

I need to make it a number and test if mod 97 returns 1

All val, clong etc that I have tried converts the string into whatever number but not 210501700012345678131468

Which function to use and what type of number

What does it get converted to? The debugger might show scientific notation (XeY) but that does not make any difference when using mod.

Double = val(“210501700012345678131468”) = 210501700012345669976064,
Double = clong(“210501700012345678131468”) = 5903387245984641024,

integer = val(“210501700012345678131468”) = -2147483648
integer = clong(“210501700012345678131468”) = 947679500

I see, take a look here… http://documentation.xojo.com/index.php/Integer_datatypes

Use FP Plugin from Bob Delaney:

http://delaneyrm.com/fpPlugin.html

Yepp I did, but all of them seems to be unable to handle 210501700012345678131468 as a number

According to Bob it should work, although you need to have enough memory.
Maybe you should try to contact Bob Delaney.
You can find his email address at the bottom of his website Bob Delaney’s Science Software

Thanks, that plugin did the trick

p.s. my previous post should link to the documentation. So I meant, that I’ve checked the documentation and could not handle my large number with the build in types.

Bob’s Plugin is doing great !!!

[quote=48384:@Stefan Zilz]I have a very long “number” as String
210501700012345678131468
I need to make it a number and test if mod 97 returns 1
All val, clong etc that I have tried converts the string into whatever number but not 210501700012345678131468
Which function to use and what type of number[/quote]The only data type that would handle such a number is the Double. But, it has limitations in terms of precision. It can only handle at most 17 significant digits and your number is 24 digits. Try this code in the debugger:

Dim s as String = "210501700012345678131468" Dim d As Double = Val( s ) Break
After the 16th digit ( from the left ), s and d aren’t matching anymore. It’s all explained in this Wikipedia article: Double-precision floating-point format.