diff options
Diffstat (limited to 'src/main/smp/sys/math.smp')
| -rw-r--r-- | src/main/smp/sys/math.smp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/main/smp/sys/math.smp b/src/main/smp/sys/math.smp new file mode 100644 index 00000000..a5e1887c --- /dev/null +++ b/src/main/smp/sys/math.smp @@ -0,0 +1,15 @@ +// Mathematical constants, rounded to the nearest f64 value. +val PI = 3.141592653589793; +val E = 2.718281828459045; + +// Fixed-semantics C bindings recognized by the compiler's intrinsic inliner. +// These preserve all 64 bits, including signed zero and NaN payloads. +// They are NOT numeric conversions (ordinary typed assignments still are). +{ f64 -> i64 } simple_f64_bits = "C"; +{ i64 -> f64 } simple_f64_from_bits = "C"; +val f64Bits = simple_f64_bits; +val f64FromBits = simple_f64_from_bits; + + +val max = { f64 x, f64 y -> return x > y ? x : y; }; +val min = { f64 x, f64 y -> return x < y ? x : y; }; |
