I have Luau Native code generation beta enabled.
local a = function()
return -1050
end
for i = 1, 30 do
wait()
print(2^a() == 0)
end
Running this results in true and false randomly:
Expected behavior
I expect this to always print false.
I have Luau Native code generation beta enabled.
local a = function()
return -1050
end
for i = 1, 30 do
wait()
print(2^a() == 0)
end
Running this results in true and false randomly:
Expected behavior
I expect this to always print false.
Sorry, but we cannot reproduce this issue.
If you have more information, like the system you are running this on (see How to post a Bug Report - #15 by Roblox) or if you have an example place file (if this is not on a Baseplate) - that might help.
I’m seeing this behaviour too but with a bit different results.
I thought the code is complied as native only when specifically marked as --!native
, but I’m including both, what happens in scripts and what happens in the command line on my end.
No matter if code generation is enabled or disabled (regardless of the --!native
comment):
I’ve heard the engine for performance reasons enables FTZ flag, so if I’m not mistaken, the tested number is subnormal and the result should always be true. The issue (if it is an issue) seems minuscule though.
Studio version 0.608.1.6080485 (64bit)
Processor Intel(R) Core™ i7-6820HQ CPU @ 2.70GHz 2.71 GHz
Installed RAM 32.0 GB
System type 64-bit operating system, x64-based processor
Thank you for the info. We do see an issue on x64 and will be looking into it.
Thank you again for the report, but unfortunately, this isn’t something we’re planning to fix in near term.
We recommend not relying on certain denormal behavior as it can be different across multiple platforms.
While we understand that it’s desirable to at least have consistent values over time on a single platform, we don’t have bandwidth to work on this right now.
Roblox Studio will now always work in a single FP mode on x64 platform - the one that Roblox always ends up running in - FTZ enabled (so the example always prints ‘true’)
This fix will should come to x64 clients in around two weeks.
Results between different platforms can still be different, but they will not change at different points in time on the same device.
Another update, flush-to-zero is now consistently enabled on x64 clients and on RCC.