Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/CUDApp/blob/main/src/omega_gpu_hostmath.h # CUDApp CUDA++: AIEN’s GPU machine-code toolchain, runtime and driver client for NVIDIA GPUs without the CUDA toolkit. Hardware coverage and driver replacement limits are explicit. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `CUDApp / src / omega_gpu_hostmath.h` 24 lines · 1514 bytes Raw Blame History 1 /* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception */ 2 #ifndef OMEGA_GPU_HOSTMATH_H 3 #define OMEGA_GPU_HOSTMATH_H 4 /* 5 * omega_gpu_hostmath: libm-free double-precision host math for the production side of libomega_gpu.a 6 * (OWN-30B, 2026-10-13). The library must link without -lm (omegatool and the Rust FFI crate link it bare), 7 * so the few transcendental values the APIs build on the host (the RoPE cos/sin table, the inverse frequency 8 * powers, the router oracle's exp) come from here. Everything is plain double arithmetic: range reduction plus 9 * short Taylor/atanh series, checked against libm by tests/gpu_decode_attn_test.c --host-only (the test links -lm). 10 * 11 * log(x): x > 0 finite; NaN otherwise. Error a few ulp. 12 * exp(y): 0 below -745, +inf above 709.8. Error a few ulp. 13 * pow(b, e): b > 0 finite; exp(e * log(b)). Relative error about |e * log b| * 2^-52. 14 * sincos(a): valid for |a| < 2^20 * pi/2 (about 1.6e6; the RoPE table needs pos < 131072). Three-part 15 * Cody-Waite reduction with the fdlibm pi/2 pieces, series to r^16. Absolute error about 1e-16. 16 * pow2f(e): 2^e as f32, exact (built from the bit pattern) for -149 <= e <= 127; 0 below, +inf above. 17 * Replaces ldexpf(1.0f, e) (omega-mv#471). 18 */ 19 double omega_hostmath_log(double x); 20 double omega_hostmath_exp(double y); 21 double omega_hostmath_pow(double base, double e); 22 void omega_hostmath_sincos(double a, double *s, double *c); 23 float omega_hostmath_pow2f(int e); 24 #endif