Basic Utilities #
Utility functions and helpers for the Hesper library.
@[extern lean_hesper_float64_to_bytes]
Convert Float64 (Lean Float) to 4 bytes (little-endian f32) Uses FFI to properly convert f64→f32→bytes
Convert IEEE 754 float32 bit pattern to Lean Float (float64). Float.ofBits expects float64 bits, so we must manually convert.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Convert 4 bytes (little-endian) to Float
Equations
- One or more equations did not get rendered due to their size.
Instances For
Convert 4 bytes (little-endian f32) to Float (f64) Properly handles f32→f64 conversion via FFI
Equations
Instances For
Pure version (fallback implementation using Lean) Note: This doesn't properly handle f32→f64 conversion! Use the FFI version above.
Equations
- Hesper.Basic.bytesToFloatArrayPure bytes = Array.map (fun (i : Nat) => Hesper.Basic.bytesToFloat bytes (i * 4)) (Array.range (bytes.size / 4))
Instances For
Convert UInt32 to 4 bytes (little-endian)
Equations
- One or more equations did not get rendered due to their size.
Instances For
Convert 4 bytes (little-endian) to UInt32
Equations
- One or more equations did not get rendered due to their size.
Instances For
@[extern lean_hesper_get_time_ns]
Get high-precision system time in nanoseconds. Used for benchmarking GPU performance.