Oxygen Basic
Programming => Bugs & Feature Requests => Topic started by: Brian Alvarez on February 21, 2020, 01:13:49 AM
-
The following code:
DOUBLE d = -2.5654885563273315
print pow(d, 2)
In 32bit outputs 6.581731532646495
In 64bit outputs -6.5817313194274902
The following does not compile:
pow(-2.5654885563273315, 2)
ERROR: ERROR: unexpected comma in array index
WORD: -
-
Hi Brian
for me work this:
print -2.5654885563273315 ^ 2
but for pow() o2 say - unindentified instruction !
-
Hi
here is a quick solution :D
'simple power func
function power(double num,int exponent) as double
double res
res = num ^ exponent
return res
end function
'test
print power(-2.5654885563273315,2)
-
Nice! It works. WHat version are you using Aurel? SQR() is also giving me trouble.
-
made my own.
MACRO SQR extended(r, v)
r = (v) ^ 0.5
END MACRO
-
pow (and mod) can also be used as operators, without the prolems you report, Brian. Iwill need to investigate further...
What is the problem with sqr ?
-
the problem is that in 64bit gives a different result than in 32bit.
-
Deleting all the deff blocks in RTL63.inc should clear the pow sign problem
sqrt should be okay. it uses the fsqrt instruction and only depends on the precision of the parameter pssed to it.
-
WHat version are you using Aurel?
I use 0.2.8. 32bit
-
Where did you get it from? I have 0.2.6 and i cant find any newer....
-
hello Brian
from Charles Pegge's signature address get OxygenBasicProgress.zip
-
Hi Brian,
in Github at the moment there is OxygenBasicProgress.zip, OxygenProgress.zip, latest commit 5 months ago. Perhaps you applied OxygenBasic.zip or Oxygen.zip, latest commit 7 months ago? I assume Charles will provide a more recent version anyway in the near future after resolving some of the requests.
-
Yes there is on github..
I just look into Oxygen Basic page and found topic GAMES..
i don't know that even exist ..there are games of our old friend Peter Wirbelauer
( i miss that guy ,,,)
and download pac3D...well really nice game ...uffff
i must made one too...but first i must re-learn few things again ::)
-
I started having issues after i modified my MOD function. I tried:
%def ¤MOD mod
but was giving #qNaN with some parameters... i had to roll back to:
MACRO ¤MOD quad(r, v, e)
r = mod(v, e)
END MACRO
-
I fixed the65bit sign prolem by removing the deff blocks from RTL64.inc.
These should work:
$filename "o.exe"
'uses RTL64
double p = pow(-2.5,2)
print 0 + pow(-2.5,2)
print "" + pow(-2.5,2)
print (pow(-2.5,2))
print -2.5 pow 2
print -2.5 ^ 2
0.2.9 coming soon..
-
Charles, the macro functions like this:
MACRO ¤MOD quad(r, v, e)
r = mod(v, e)
END MACRO
Fail to compile when the invocation contains a parameter with empty brackets like this:
print ¤MOD(something(), 2)
ERROR: ERROR: Undefined Symbol: )
WORD: 0
Do you think it would be possible to take a look into it before the next update?
-
Seems like it only happens with #if
MACRO ¤EXAMPLE string(r, dd, d2)
#if typecodeof(dd) = 0x68
r = str(dd)
#endif
END MACRO
-
Brian,
I will extend typeof and typecodeof to support arrays and functions
-
Thanks Charles. :) I tried passing the function without the empty brackets, but then it complained about the comma right after the function, so the brackets were necessary.
-
That is quite simple to fix, Brian, but supposing you pass a polymorphic-function or object-method in dd... I need to think deeper.
-
That is perfect Charles. I need to select wich function to invoke manually because under some circumstances, the function overflow likes to invoke str() as if it was a floating value with integer values, and returns 0.9999999999999 instead of 1.