mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-03 00:24:34 +00:00
FIXME for wasm NumRound
This commit is contained in:
parent
7c95189e4a
commit
06a6e8545b
1 changed files with 10 additions and 6 deletions
|
@ -171,12 +171,16 @@ pub fn build_call_low_level<'a>(
|
||||||
NumCos => return NotImplemented,
|
NumCos => return NotImplemented,
|
||||||
NumSqrtUnchecked => return NotImplemented,
|
NumSqrtUnchecked => return NotImplemented,
|
||||||
NumLogUnchecked => return NotImplemented,
|
NumLogUnchecked => return NotImplemented,
|
||||||
NumRound => match ret_layout.value_type() {
|
NumRound => {
|
||||||
I32 => code_builder.f32_nearest(),
|
// FIXME
|
||||||
I64 => code_builder.f64_nearest(),
|
// thread 'gen_num::f64_round' panicked at 'called `Result::unwrap()` on an `Err` value:
|
||||||
F32 => {}
|
// Io(Os { code: 2, kind: NotFound, message: "No such file or directory" })',
|
||||||
F64 => {}
|
// compiler/test_gen/src/helpers/wasm.rs:185:53
|
||||||
},
|
// Note: Wasm has a `nearest` op, but it does round-to-even when fraction is exactly 0.5
|
||||||
|
// which fails tests. Will this do? Or is specific behaviour important?
|
||||||
|
let width = float_width_from_layout(ret_layout);
|
||||||
|
return BuiltinCall(&bitcode::NUM_ROUND[width]);
|
||||||
|
}
|
||||||
NumToFloat => match (ret_layout.value_type(), storage.get(&args[0]).value_type()) {
|
NumToFloat => match (ret_layout.value_type(), storage.get(&args[0]).value_type()) {
|
||||||
(F32, I32) => code_builder.f32_convert_s_i32(),
|
(F32, I32) => code_builder.f32_convert_s_i32(),
|
||||||
(F32, I64) => code_builder.f32_convert_s_i64(),
|
(F32, I64) => code_builder.f32_convert_s_i64(),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue