Oxygen Basic
Information => Open Forum => Topic started by: Peter on September 20, 2011, 12:18:18 PM
-
Deleted
-
Hi Peter,
it is just called atan(y,x)
atn(y/x) is the usual Basic function
Charles
PS pi() asin() and acos() deg() and rad() are also available
-
Charles,
what about: ArcTan
ArcSin
ArcCos ?
-
Peter,
Allow me to introduce deff
This lets you create your own float macros. It allows you to extend the core maths functions.
For instance:
deff arctan fpatan
deff arctn fld1 : fpatan
You can see such macros encoded in the Oxygen source code src/o2keyw.bas
data "asin 17 fld st0 : fmul st0 : fld1 : fsubp st1,st0 : fchs : fsqrt : fpatan"
Charles
-
Hi Peter,
deff was introduced about 1 year ago in Alpha 10. I have kept quiet about it :)
Back soon. Then I will look at your code.
Charles
-
Peter,
I try to hide them in the manual, but then I discover them a few months later. :)
Nice demo! the ball could almost pass for being intelligent.
There is a distance function available for 2D hypoteneuse.
dist = Sqr(dx*dx+dy*dy)
dist=hypot(dx,dy)
to make a customised 3D one using deff
deff hypot3
fmul st0
fxch st1
fmul st0
fxch st2
fmul st0
faddp st1
faddp st1
fsqrt
end deff
dist=hypot3(dx,dy,dz)
Charles
-
Thanks Peter
deff will take any assembler instructions and dot labels but not macros or variable names. All parameters are automatically pushed onto the fpu stack.
for more general purpose macros, there is the traditional C #define and of course def which works a bit like a DOS batch file macro with its %1..%9 argument substitutions.
There is also a cleaner alternative to using multi-line #define(...)
macro(a,b,c)
...
end macro
Charles