Open helehex opened 3 months ago
BTW: I found this because I was noticing false positives in my unit tests. So be careful I guess.
even use !=
or ==
the result still False
0 / 0
doesn't run at compile time at all:
fn main():
alias a = 0 / 0
print(a)
Error message:
/__w/modular/modular/open-source/mojo/stdlib/stdlib/builtin/_startup.mojo:113:4: error: call expansion failed
/__w/modular/modular/open-source/mojo/stdlib/stdlib/builtin/_startup.mojo:44:4: note: function instantiation failed
<unknown>:0: note: failed to compile-time evaluate function call
/__w/modular/modular/open-source/mojo/stdlib/stdlib/builtin/int.mojo:552:8: note: failed to interpret function @stdlib::builtin::int::Int::__truediv__(::Int,::Int)
/__w/modular/modular/open-source/mojo/stdlib/stdlib/builtin/int.mojo:561:30: note: call expansion failed
/__w/modular/modular/open-source/mojo/stdlib/stdlib/builtin/simd.mojo:563:35: note: failed to fold operation pop.div(#pop<simd "0"> : !pop.scalar<f64>, #pop<simd "0"> : !pop.scalar<f64>)
/home/vscode/.modular/pkg/packages.modular.com_nightly_mojo/bin/mojo: error: failed to run the pass manager
Maybe we should just implement a __truediv__ -> FloatLiteral
on IntLiteral
?
Bug description
Maybe I'm mistaken, but shouldn't
nan != x
always returnTrue
? When using themath.nan[]()
function to provide the nan, it returnsTrue
. This means that nan behaves differently right now, depending on it's payload bits.Steps to reproduce
System information