std_mel/types/float.rs
1use melodium_macro::mel_function;
2
3/// Return the positive infinity for floating type.
4///
5/// Comparing any finite value against `infinity()` with `<` returns `true`.
6#[mel_function(
7 generic F (Float)
8)]
9pub fn infinity() -> F {
10 let f = generics.get("F").unwrap();
11
12 f.float_infinity()
13}
14
15/// Return the negative infinity for floating type.
16#[mel_function(
17 generic F (Float)
18)]
19pub fn neg_infinity() -> F {
20 let f = generics.get("F").unwrap();
21
22 f.float_neg_infinity()
23}
24
25/// Return the not-a-number value for floating type.
26///
27/// ⚠️ `NaN` is not equal to itself; use `is_nan()` to test for it rather than equality comparison.
28#[mel_function(
29 generic F (Float)
30)]
31pub fn nan() -> F {
32 let f = generics.get("F").unwrap();
33
34 f.float_nan()
35}