Hello,
I'm implementing a tool which trans-compiles (yet not complete) Python into
neko.
I implemented the abs() built-in function in Python, it's supposed to give
the absolute value of a number, for example abs(-30) must give back 30.
So I've done:
var abs = function(n)
{
if (n < 0)
{
return n * -1;
}
return n;
}
$print(abs(-30)+"\n");
But it gives me back -1.
I wonder if there is a bug in NekoVM because in Python an equivalent
function gives me a correct answer.
def absolute(n):
... if n < 0:
... return n * -1
... return n
...
>>> absolute(-30)
30
>>> quit()
Can someone tell me what really happens?
For the sake of curiosity the project is at:
https://github.com/narke/py2neko
Thanks in advance,
Konstantin Tcholokachvili
--
Neko : One VM to run them all
(http://nekovm.org)