Promote float to double in cpp code gen

This commit is contained in:
crai0 2025-03-13 00:53:03 +01:00 committed by Olivier Goffart
parent 424b12ee36
commit a8eb44b739

View file

@ -3542,12 +3542,12 @@ fn compile_builtin_function_call(
format!("std::atan2({}, {}) / {}", a.next().unwrap(), a.next().unwrap(), pi_180)
}
BuiltinFunction::ToFixed => {
format!("[](float n, int d) {{ slint::SharedString out; slint::cbindgen_private::slint_shared_string_from_number_fixed(&out, n, std::max(d, 0)); return out; }}({}, {})",
format!("[](double n, int d) {{ slint::SharedString out; slint::cbindgen_private::slint_shared_string_from_number_fixed(&out, n, std::max(d, 0)); return out; }}({}, {})",
a.next().unwrap(), a.next().unwrap(),
)
}
BuiltinFunction::ToPrecision => {
format!("[](float n, int p) {{ slint::SharedString out; slint::cbindgen_private::slint_shared_string_from_number_precision(&out, n, std::max(p, 0)); return out; }}({}, {})",
format!("[](double n, int p) {{ slint::SharedString out; slint::cbindgen_private::slint_shared_string_from_number_precision(&out, n, std::max(p, 0)); return out; }}({}, {})",
a.next().unwrap(), a.next().unwrap(),
)
}