simple float query
BlitzMax Forums/BlitzMax Beginners Area/simple float query Global dave:Float = (600/155.0)
Print dave
Mfg Suco
Print dave
Mfg Suco
As above.
When you specify a `number` in BlitzMax, you are basically defining a CONST (constant). If you don't provide any decimal portion of any kind it assumes it is an integer. If you provide a decimal even if it's .0 it will make it into a float constant. The math obviously differs depending on the type. 600/155 in integer math ignores the fractional part of the result. So as Suco-X said, just add .something to the end of the number and you'll clue Blitz in to know to make it a floating point sum. You only have to add .0 to one of the numbers because that overrides the type of the other number.
When you specify a `number` in BlitzMax, you are basically defining a CONST (constant). If you don't provide any decimal portion of any kind it assumes it is an integer. If you provide a decimal even if it's .0 it will make it into a float constant. The math obviously differs depending on the type. 600/155 in integer math ignores the fractional part of the result. So as Suco-X said, just add .something to the end of the number and you'll clue Blitz in to know to make it a floating point sum. You only have to add .0 to one of the numbers because that overrides the type of the other number.
Thanks for that.
Dave.
Dave.