Search found 1074 matches

by pgimeno
Sun May 27, 2018 7:57 pm
Forum: Support and Development
Topic: Cross-platformly deterministic to-the-power-of function
Replies: 19
Views: 461

Re: Cross-platformly deterministic to-the-power-of function

I fail to understand how this: To clarify, FFI really does seem like a good idea now: follows from this: An IEEE-754 compliant FPU will be deterministic for basic arithmetic. Different maths libraries will use basic arithmetic differently to make functions. So as long as the FPU is IEEE-754-complian...
by pgimeno
Sun May 27, 2018 1:53 pm
Forum: Support and Development
Topic: Cross-platformly deterministic to-the-power-of function
Replies: 19
Views: 461

Re: Cross-platformly deterministic to-the-power-of function

Right... so LuaJIT uses IEEE-754 floats. Addition, subtraction and such should work fine for any length of playback from what I have gathered. I'm just really confused about other things and kinda torn between lots of options? I won't be using any implementations of math.sin or ^ (which references ...
by pgimeno
Sat May 26, 2018 8:25 pm
Forum: Support and Development
Topic: Cross-platformly deterministic to-the-power-of function
Replies: 19
Views: 461

Re: Cross-platformly deterministic to-the-power-of function

zorg: And if you didn't tonumber it, just printed the ffi type with format %d ? You can't use string.format. If you use it, you're using the Lua library. If you're using the Lua library, you're using Lua types. But in this case, not even that: luajit: main.lua:11: bad argument #2 to 'format' (number...
by pgimeno
Sat May 26, 2018 3:19 pm
Forum: Support and Development
Topic: Cross-platformly deterministic to-the-power-of function
Replies: 19
Views: 461

Re: Cross-platformly deterministic to-the-power-of function

Yeah, but that doesn't really matter. It's tonumber that converts it to float. I used that because without string.format, I was getting -8.404105121027e+16. Using %d still outputs -84041051210270160.
by pgimeno
Sat May 26, 2018 3:03 pm
Forum: Support and Development
Topic: Cross-platformly deterministic to-the-power-of function
Replies: 19
Views: 461

Re: Cross-platformly deterministic to-the-power-of function

Are you positive that using signed/unsigned integers and doing division on them doesn't actually do integer division due to them being C datatypes? No, I stand corrected. I didn't even know you could do operations with ctypes. You're right, that's one way. It doesn't seem to respect types, though. ...
by pgimeno
Sat May 26, 2018 1:49 pm
Forum: Support and Development
Topic: Cross-platformly deterministic to-the-power-of function
Replies: 19
Views: 461

Re: Cross-platformly deterministic to-the-power-of function

Applying floor, ceil et cetera to floating points doesn't work according to this thing that someone said to me: "The problem with any rounding method is that it there are points x where a value slightly below x rounds down and a value slightly above x rounds up, and therefore any calculation errors...
by pgimeno
Fri May 25, 2018 11:03 pm
Forum: Support and Development
Topic: Cross-platformly deterministic to-the-power-of function
Replies: 19
Views: 461

Re: Cross-platformly deterministic to-the-power-of function

I wouldn't be so wary about floats. Lua numbers are all IEEE-754 doubles in all platforms supported by LÖVE. Note you're using floats either way; in Lua 5.1 you don't have integers. Note that if division can go wrong with floats, it can with "integers" as well, unless you implement your own (slow) d...
by pgimeno
Fri May 25, 2018 12:56 am
Forum: Libraries and Tools
Topic: a working setColor compatibilty multiplier
Replies: 11
Views: 437

Re: a working setColor compatibilty multiplier

It just seems to get rounding right all the time, by pure chance. It doesn't happen with all divisors, but it happens with 255.

Code: Select all

> print(string.format("%.17g", 1/255*255))
1
> print(string.format("%.17g", 1/253*253))
0.99999999999999989
by pgimeno
Fri May 25, 2018 12:29 am
Forum: Support and Development
Topic: Bitmap collisions somehow?
Replies: 2
Views: 86

Re: Bitmap collisions somehow?

I do that in Thrust II reloaded. See https://github.com/pgimeno/Thrust-II-re ... e.lua#L456

Note I use small sprites and a separate collision shape image.
by pgimeno
Wed May 23, 2018 8:17 pm
Forum: General
Topic: Today's downtime
Replies: 7
Views: 394

Re: Today's downtime

Thanks a lot for fixing things up and bringing back love to our lives!