Lonint with bmx?

BlitzMax Forums/BlitzMax Programming/Lonint with bmx?

Hi!

Are Longints possible under bmx?
I have to calculate large numbers so int probably won't do... :/

Grisu

Yes. BlitzMax's numeric types:

Description		Syntax	Minimum Value	Maximum Value 
8 bit unsigned integer	Byte	0		255 
16 bit unsigned integer	Short	0		65535 
32 bit signed integer	Int	-2^31		+2^31-1 
64 bit signed integer	Long	-2^63		+2^63-1 
32 bit floating point	Float	(+/-)10^-38	(+/-)10^38 
64 bit floating point	Double	(+/-)10^-308	(+/-)10^308 
Many blessings be upon BMax for Longs and Doubles. :)

Yeah it's cool. Doubles have proved useful to me already. Anyway does anyone know the quick symbols for those?

Int = %
Float = #
Double = !

whatelse?

Thanks guys.

I tryed "longint" and it was not highlighted.
Never thought of "long"

Don't know for !%#.

I found long first :-)


whatelse?

Byte is @
Short is @@

Turns out [a http://www.blitzwiki.org/index.php/Differences_Between_Blitz3D_and_BlitzMAX_:_Language#Variables]BlitzWiki has all this[/a], as well as:

Long is %%

However, %% can't be put at the end of a number to make it Long when assigning it to a Long variable (the way that you put ! at the end of a Double when assigning it).

That is, if you assign a Double like this:

Dbl! = 1.23456789123
Print Dbl
you get a bad result: 1.2345678806304932 because the 1.23456789123 is interpreted as a mere Float. To get the correct result, you need to specify that the number is a Double by using:

Dbl! = 1.23456789123!
Print Dbl
'or
Dbl! = 1.23456789123:Double
Print Dbl
which gives: 1.2345678912300000

However, you can't use %% for a similar purpose with a Long since it gives a compile error:

Lng%% = 123456789123%%
Print Lng
Instead you must use:

Lng%% = 123456789123456789:Long
Print Lng
which gives the correct result (and don't try with nothing on the end like "Lng%% = 123456789123456789" or it'll be interpreted as an Int and give you "-1395630315").

Interest facts thanks WendellM :)

Blitzmax is whackey..