1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170
//! Provides functions for examining and operating on floating point types.
use crate::{NSTDFloat32, NSTDFloat64};
/// Returns the smallest finite value representable by `NSTDFloat32`.
///
/// # Returns
///
/// `NSTDFloat32 min` - The smallest finite value representable by `NSTDFloat32`.
///
/// # Example
///
/// ```
/// use nstd_sys::core::fty::nstd_core_fty_min_f32;
///
/// assert!(nstd_core_fty_min_f32() == f32::MIN);
/// ```
#[inline]
#[cfg_attr(feature = "clib", no_mangle)]
pub extern "C" fn nstd_core_fty_min_f32() -> NSTDFloat32 {
NSTDFloat32::MIN
}
/// Returns the largest finite value representable by `NSTDFloat32`.
///
/// # Returns
///
/// `NSTDFloat32 max` - The largest finite value representable by `NSTDFloat32`.
///
/// # Example
///
/// ```
/// use nstd_sys::core::fty::nstd_core_fty_max_f32;
///
/// assert!(nstd_core_fty_max_f32() == f32::MAX);
/// ```
#[inline]
#[cfg_attr(feature = "clib", no_mangle)]
pub extern "C" fn nstd_core_fty_max_f32() -> NSTDFloat32 {
NSTDFloat32::MAX
}
/// Returns the smallest finite value representable by `NSTDFloat64`.
///
/// # Returns
///
/// `NSTDFloat64 min` - The smallest finite value representable by `NSTDFloat64`.
///
/// # Example
///
/// ```
/// use nstd_sys::core::fty::nstd_core_fty_min_f64;
///
/// assert!(nstd_core_fty_min_f64() == f64::MIN);
/// ```
#[inline]
#[cfg_attr(feature = "clib", no_mangle)]
pub extern "C" fn nstd_core_fty_min_f64() -> NSTDFloat64 {
NSTDFloat64::MIN
}
/// Returns the largest finite value representable by `NSTDFloat64`.
///
/// # Returns
///
/// `NSTDFloat64 max` - The largest finite value representable by `NSTDFloat64`.
///
/// # Example
///
/// ```
/// use nstd_sys::core::fty::nstd_core_fty_max_f64;
///
/// assert!(nstd_core_fty_max_f64() == f64::MAX);
/// ```
#[inline]
#[cfg_attr(feature = "clib", no_mangle)]
pub extern "C" fn nstd_core_fty_max_f64() -> NSTDFloat64 {
NSTDFloat64::MAX
}
/// Returns NaN represented as `NSTDFloat32`.
///
/// # Returns
///
/// `NSTDFloat32 nan` - NaN represented as `NSTDFloat32`.
#[inline]
#[cfg_attr(feature = "clib", no_mangle)]
pub extern "C" fn nstd_core_fty_nan_f32() -> NSTDFloat32 {
NSTDFloat32::NAN
}
/// Returns NaN represented as `NSTDFloat64`.
///
/// # Returns
///
/// `NSTDFloat64 nan` - NaN represented as `NSTDFloat64`.
#[inline]
#[cfg_attr(feature = "clib", no_mangle)]
pub extern "C" fn nstd_core_fty_nan_f64() -> NSTDFloat64 {
NSTDFloat64::NAN
}
/// Returns infinity represented as `NSTDFloat32`.
///
/// # Returns
///
/// `NSTDFloat32 inf` - Infinity represented as `NSTDFloat32`.
///
/// # Example
///
/// ```
/// use nstd_sys::core::fty::nstd_core_fty_inf_f32;
///
/// assert!(nstd_core_fty_inf_f32() == f32::INFINITY);
/// ```
#[inline]
#[cfg_attr(feature = "clib", no_mangle)]
pub extern "C" fn nstd_core_fty_inf_f32() -> NSTDFloat32 {
NSTDFloat32::INFINITY
}
/// Returns infinity represented as `NSTDFloat64`.
///
/// # Returns
///
/// `NSTDFloat64 inf` - Infinity represented as `NSTDFloat64`.
///
/// # Example
///
/// ```
/// use nstd_sys::core::fty::nstd_core_fty_inf_f64;
///
/// assert!(nstd_core_fty_inf_f64() == f64::INFINITY);
/// ```
#[inline]
#[cfg_attr(feature = "clib", no_mangle)]
pub extern "C" fn nstd_core_fty_inf_f64() -> NSTDFloat64 {
NSTDFloat64::INFINITY
}
/// Returns negative infinity represented as `NSTDFloat32`.
///
/// # Returns
///
/// `NSTDFloat32 neg_inf` - Negative infinity represented as `NSTDFloat32`.
///
/// # Example
///
/// ```
/// use nstd_sys::core::fty::nstd_core_fty_neg_inf_f32;
///
/// assert!(nstd_core_fty_neg_inf_f32() == f32::NEG_INFINITY);
/// ```
#[inline]
#[cfg_attr(feature = "clib", no_mangle)]
pub extern "C" fn nstd_core_fty_neg_inf_f32() -> NSTDFloat32 {
NSTDFloat32::NEG_INFINITY
}
/// Returns negative infinity represented as `NSTDFloat64`.
///
/// # Returns
///
/// `NSTDFloat64 neg_inf` - Negative infinity represented as `NSTDFloat64`.
///
/// # Example
///
/// ```
/// use nstd_sys::core::fty::nstd_core_fty_neg_inf_f64;
///
/// assert!(nstd_core_fty_neg_inf_f64() == f64::NEG_INFINITY);
/// ```
#[inline]
#[cfg_attr(feature = "clib", no_mangle)]
pub extern "C" fn nstd_core_fty_neg_inf_f64() -> NSTDFloat64 {
NSTDFloat64::NEG_INFINITY
}