Jump to content

What's wrong with MTA's Lua ?


guix

Recommended Posts

I try to understand why my function doesn't return the correct result in MTA's Lua

In codepad, the correct result:

http://codepad.org/9iEiJsW8

In MTA, the exact same function and function calls (only with outputConsole) outputs different results :/ :

1846309504

-931460096

335609632

Any idea why?

Can it be because I compiled MTA myself, on a 64bits pc ? I really don't understand and I've searched a solution for 2 days now and I'm tired of searching...

PS: I know about tocolor()

Edit: I've asked on the Lua IRC and I've been told it's because (MTA's) Lua was compiled to use floats for numbers, and that above 2^24 there is a precision loss, which explain my incorrect results.

Can be verified with: if 2^24 == 2^24+1 then outputConsole( "fail" ) end

Can this be fixed?

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...