|
Post by andrian on Jul 23, 2008 12:38:59 GMT -5
hey, Tom, would you please make all calculations floating point and then round them to integers when finished. for example, this piece of code: dim a = 1 dim b = 10 dim c = 10 * a / b c = 0, not 1. That is not cool.
|
|
|
Post by Nicky Peter Hollyoake on Jul 23, 2008 16:17:01 GMT -5
Function Float#(A): Return (A*1.0): EndFunction
dim a = 1 dim b = 10 dim c = 10 * (Float#(a) / Float#(b))
Printr a Printr b Printr c
Times an integer by 1.0 makes it a real.
- Nicky
P. S. I dault Tom would change this now because it will effect codes already out there.
- Nicky
|
|
|
Post by James :) (aka Madcow) on Jul 23, 2008 16:42:52 GMT -5
it is rounding them correctly.
|
|
|
Post by andrian on Jul 24, 2008 13:10:49 GMT -5
True, but other programming languages, such as Java and C++ use floating point rather than integer-rounding for their calculations. Nicky does have a point, though.
|
|
|
Post by Darkjester on Jul 24, 2008 13:12:40 GMT -5
it could make some things eisier!
|
|
|
Post by matthew on Jul 24, 2008 13:38:41 GMT -5
The answer which nicky gave is pretty much the same as what Tom said in this thread back in 2004.
|
|
|
Post by Nicky Peter Hollyoake on Jul 24, 2008 14:01:50 GMT -5
Maybe Tom can make a function called 'Float' like mine and put it in the langauge, might make things easier. - Nicky
|
|
|
Post by James :) (aka Madcow) on Jul 24, 2008 15:41:53 GMT -5
or you call a function that changes the behaviour of all variables in the program to float point rounding.
|
|