Math.abs error

BlitzMax Forums/BlitzMax Beginners Area/Math.abs error

dXter(Posted 2007) [#1]
Hi, I ported APE (Actionscript Physics Engine) over to Bmax and i'm going through all the compiler errors now, and I got to this one and I can't figure out what's wrong. There's an error at this line:

Local radius# = extents[0] * (Math.abs(axis.dot(axes[0]))) + extents[1] * (Math.abs(axis.dot(axes[1])))

that says in the error message:

"Compile Error. Expecting expression but encountered Abs"

here's some info so you can understand the code a little better:
extents[] is an array of Floats
axis[] is an array of Vectors
dot(v:Vector) returns a Float (dot-product)

I'm kind of confused right now, any help would be appreciated.


Beaker(Posted 2007) [#2]
Change Math.abs() to Abs().


Jesse(Posted 2007) [#3]
the whole line is wrong. math is not a function of bmax
axis.dot(axes[0]) if dot is an array then you need to change () to [].


rdodson41(Posted 2007) [#4]
Math functions such as Abs, Sin, Cos, Sqr aren't in a sepparate Math class like in Java. They are global functions. So you would just do Abs( ... ) to use Abs.