You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Please never box scalar numbers with ffi.new("int"), ffi.new("float") or similar! This is only useful for passing arguments to vararg functions. Ditto for ffi.cast().
Explicitly boxing scalars does not improve performance or force int or float arithmetic. Or whatever the intention possibly was.
It just adds costly boxing, unboxing and conversions steps. And it may lead to surprise results, because cdata arithmetic on scalar numbers is always performed on 64 bit integers.
It seems that when comparing two ffi floats only the integer part is checked eg. 0.1 and 0.5 are equal.
Is this intentional or a quirk of how floats actually work?
The text was updated successfully, but these errors were encountered: