Hi guys,
I was experimenting with this neat thing here, called Margarita (ahem
not drinking it)
http://playingwithmathematica.com/2011/06/17/friday-fun-6/#more-413
And I think I found bug in math.fmod, or maybe not a bug, but different
results than say Mathematica or Matlab. There is something in the lua
doc saying that the versions takes care of negative numbers.
Anyway this code makes it behave as Mathematica wants it too:
function fmod(v, m)
if v < 0 then
return m - math.fmod(-v,m)
end
return math.fmod(v, m)
end
Not sure whether this is the right code, as it was tested only for
positive 'm' (I have to fresh myself on the fmod function to tell better).
Here is the code:
https://github.com/malkia/ufo/blob/master/samples/margarita.lua
Thanks,
Dimiter "malkia" Stanev.