omega-bridge
Omega-first language interoperability: checked conversion backends and native language bindings
Brought by drakestapleton
omega-bridge / tests / native / freestanding / f64.om
| 1 | note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 2 | om2 |
| 3 | fn average a f64 b f64 to f64 |
| 4 | two = f64 2.0e+0 |
| 5 | ret div add a b two |
| 6 | end |
| 7 | export fn fbits mode ulong abits ulong bbits ulong to ulong |
| 8 | a = bitcast f64 abits |
| 9 | b = bitcast f64 bbits |
| 10 | if eq mode 0 |
| 11 | ret bitcast ulong add a b |
| 12 | end |
| 13 | if eq mode 1 |
| 14 | ret bitcast ulong div a b |
| 15 | end |
| 16 | if eq mode 2 |
| 17 | ret bitcast ulong neg a |
| 18 | end |
| 19 | ret bitcast ulong average a b |
| 20 | end |