2023-05-05 15:45:49 +00:00
|
|
|
#![feature(lang_items, start)]
|
|
|
|
#![warn(clippy::imprecise_flops)]
|
|
|
|
#![warn(clippy::suboptimal_flops)]
|
|
|
|
#![no_std]
|
|
|
|
|
2024-06-18 17:34:49 +00:00
|
|
|
// The following should not lint, as the suggested methods `{f16,f32,f64,f128}.mul_add()`
|
2024-09-09 08:43:46 +00:00
|
|
|
// and `{f16,f32,f64,f128}::abs()` are not available in no_std
|
2023-05-05 15:45:49 +00:00
|
|
|
|
|
|
|
pub fn mul_add() {
|
|
|
|
let a: f64 = 1234.567;
|
|
|
|
let b: f64 = 45.67834;
|
|
|
|
let c: f64 = 0.0004;
|
|
|
|
let _ = a * b + c;
|
|
|
|
}
|
|
|
|
|
|
|
|
fn fake_abs1(num: f64) -> f64 {
|
|
|
|
if num >= 0.0 { num } else { -num }
|
|
|
|
}
|
|
|
|
|
|
|
|
#[start]
|
|
|
|
fn main(_argc: isize, _argv: *const *const u8) -> isize {
|
|
|
|
0
|
|
|
|
}
|
|
|
|
|
|
|
|
#[panic_handler]
|
|
|
|
fn panic(_info: &core::panic::PanicInfo) -> ! {
|
|
|
|
loop {}
|
|
|
|
}
|
|
|
|
|
|
|
|
#[lang = "eh_personality"]
|
|
|
|
extern "C" fn eh_personality() {}
|