compiler_builtins/math/libm_math/fdim.rs
1/// Positive difference (f16)
2///
3/// Determines the positive difference between arguments, returning:
4/// * x - y if x > y, or
5/// * +0 if x <= y, or
6/// * NAN if either argument is NAN.
7///
8/// A range error may occur.
9#[cfg(f16_enabled)]
10#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
11pub fn fdimf16(x: f16, y: f16) -> f16 {
12 super::generic::fdim(x, y)
13}
14
15/// Positive difference (f32)
16///
17/// Determines the positive difference between arguments, returning:
18/// * x - y if x > y, or
19/// * +0 if x <= y, or
20/// * NAN if either argument is NAN.
21///
22/// A range error may occur.
23#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
24pub fn fdimf(x: f32, y: f32) -> f32 {
25 super::generic::fdim(x, y)
26}
27
28/// Positive difference (f64)
29///
30/// Determines the positive difference between arguments, returning:
31/// * x - y if x > y, or
32/// * +0 if x <= y, or
33/// * NAN if either argument is NAN.
34///
35/// A range error may occur.
36#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
37pub fn fdim(x: f64, y: f64) -> f64 {
38 super::generic::fdim(x, y)
39}
40
41/// Positive difference (f128)
42///
43/// Determines the positive difference between arguments, returning:
44/// * x - y if x > y, or
45/// * +0 if x <= y, or
46/// * NAN if either argument is NAN.
47///
48/// A range error may occur.
49#[cfg(f128_enabled)]
50#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
51pub fn fdimf128(x: f128, y: f128) -> f128 {
52 super::generic::fdim(x, y)
53}