Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Compile time float pow crashes #3900

Open
thatstoasty opened this issue Dec 19, 2024 · 1 comment
Open

[BUG] Compile time float pow crashes #3900

thatstoasty opened this issue Dec 19, 2024 · 1 comment
Labels
bug Something isn't working mojo-repo Tag all issues with this label

Comments

@thatstoasty
Copy link
Contributor

thatstoasty commented Dec 19, 2024

Bug description

Unable to use floats for an exponent operation at compile time.

Steps to reproduce

Reproduction example:

alias num = 1.23 ** 4.56

fn main():
    print(num)
open-source/mojo/stdlib/stdlib/builtin/_startup.mojo:114:4: error: call expansion failed
open-source/mojo/stdlib/stdlib/builtin/_startup.mojo:45:4: note: function instantiation failed
<unknown>:0: note: failed to compile-time evaluate function call
open-source/mojo/stdlib/stdlib/builtin/simd.mojo:851:8: note: failed to interpret function @stdlib::builtin::simd::SIMD::__pow__(::SIMD[$0, $1],::SIMD[$0, $1]),type=f64,size=1
open-source/mojo/stdlib/stdlib/builtin/simd.mojo:862:20: note: failed to evaluate call
open-source/mojo/stdlib/stdlib/builtin/simd.mojo:2996:4: note: failed to interpret function @stdlib::builtin::simd::_pow[::Int,::DType,::DType](::SIMD[$1, $0],::SIMD[$2, $0]),simd_width=1,type`=f64,type`1=f64
open-source/mojo/stdlib/stdlib/builtin/simd.mojo:3015:21: note: failed to evaluate call
open-source/mojo/stdlib/stdlib/builtin/simd.mojo:3054:4: note: failed to interpret function @stdlib::builtin::simd::_powf[::Int,::DType,::DType](::SIMD[$1, $0],::SIMD[$2, $0]),simd_width=1,type`=f64,type`1=f64
open-source/mojo/stdlib/stdlib/builtin/simd.mojo:3065:33: note: failed to evaluate call
open-source/mojo/stdlib/stdlib/builtin/simd.mojo:3035:4: note: failed to interpret function @stdlib::builtin::simd::_powf_scalar[::DType,::DType](::SIMD[$0, {1}],::SIMD[$1, {1}]),type`=f64,type`1=f64
open-source/mojo/stdlib/stdlib/builtin/simd.mojo:3050:20: note: failed to evaluate call
open-source/mojo/stdlib/stdlib/math/math.mojo:550:4: note: failed to interpret function @stdlib::math::math::exp[::DType,::Int](::SIMD[$0, $1]),type=f64,simd_width=1
open-source/mojo/stdlib/stdlib/math/math.mojo:65:27: note: call expansion failed
<unknown>:0:0: note: failed to evaluate call
open-source/mojo/stdlib/stdlib/builtin/simd.mojo:1590:8: note: failed to interpret function @stdlib::builtin::simd::SIMD::__floor__(::SIMD[$0, $1]),type=f64,size=1
open-source/mojo/stdlib/stdlib/builtin/simd.mojo:1596:57: note: failed to evaluate call
open-source/mojo/stdlib/stdlib/builtin/simd.mojo:1882:8: note: failed to interpret function @stdlib::builtin::simd::SIMD::_floor_ceil_trunc_impl[::StringLiteral](::SIMD[$0, $1]),type=f64,size=1,intrinsic="llvm.floor"
open-source/mojo/stdlib/stdlib/builtin/simd.mojo:1902:74: note: call expansion failed
open-source/mojo/stdlib/stdlib/sys/intrinsics.mojo:90:14: note: failed to interpret operation pop.call_llvm_intrinsic{fastmathFlags: #pop<fmf none>, hasSideEffects: false, intrin: "llvm.floor" : !kgen.string}(#kgen.pack<"1.8618819175149959"> : !kgen.pack<[[typevalue<#kgen.typeref<@"stdlib::builtin::simd::SIMD,type=f64,size=1">>, scalar<f64>]]>)
open-source/mojo/stdlib/stdlib/builtin/simd.mojo:1902:74: note: call expansion failed
open-source/mojo/stdlib/stdlib/sys/intrinsics.mojo:90:14: note: LLVM intrinsic operand has unknown value: #pop<simd "1.8618819175149959"> : !pop.scalar<f64>

System information

- What OS did you do install Mojo on ? MacOs 14.6.1
- Provide version information for Mojo by pasting the output of `mojo -v` mojo 24.6.0 (4487cd6e)
- Provide Magic CLI version by pasting the output of `magic -V` or `magic --version` magic 0.5.1
- Optionally, provide more information with `magic info`.
@thatstoasty thatstoasty added bug Something isn't working mojo-repo Tag all issues with this label labels Dec 19, 2024
@soraros
Copy link
Contributor

soraros commented Dec 19, 2024

Maybe related: #3613, #3258

@thatstoasty You can use triple quote mojo instead of rust for your markdown code block.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working mojo-repo Tag all issues with this label
Projects
None yet
Development

No branches or pull requests

2 participants