Skip to main content

relibc/header/float/
mod.rs

1//! `float.h` implementation.
2//!
3//! See <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/float.h.html>.
4
5use crate::{
6    header::_fenv::{FE_TONEAREST, fegetround},
7    platform::types::c_int,
8};
9
10/// See <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/float.h.html>.
11pub const FLT_RADIX: c_int = 2;
12
13/// See <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/float.h.html>.
14#[unsafe(no_mangle)]
15pub unsafe extern "C" fn flt_rounds() -> c_int {
16    match unsafe { fegetround() } {
17        FE_TONEAREST => 1,
18        _ => -1,
19    }
20}