Specialize Num.toFloat for different target float types

Closes #2476
This commit is contained in:
ayazhafiz 2022-02-13 20:20:25 -05:00
parent cca2d10f41
commit 6e5c1d5914
2 changed files with 49 additions and 3 deletions

View file

@ -2490,3 +2490,41 @@ fn monomorphized_ints_aliased() {
u8
)
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
fn to_float_f32() {
assert_evals_to!(
indoc!(
r#"
n : U8
n = 100
f : F32
f = Num.toFloat n
f
"#
),
100.,
f32
)
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
fn to_float_f64() {
assert_evals_to!(
indoc!(
r#"
n : U8
n = 100
f : F64
f = Num.toFloat n
f
"#
),
100.,
f64
)
}