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/om/components/cm_quantile.om # 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 / om / components / cm_quantile.om` 67 lines · 2292 bytes Raw Blame History 1 note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 2 note Acklam coefficients preserve the exact C binary64 values; Wolfram-derived bit patterns. 3 fn cm_normal_tail q f64 to f64 4 v = bitcast f64 ulong `13798997430714945504` 5 v = add mul v q bitcast f64 ulong `13822851435045880248` 6 v = add mul v q bitcast f64 ulong `13835960482696009560` 7 v = add mul v q bitcast f64 ulong `13836295942911834650` 8 v = add mul v q bitcast f64 ulong `4616611452376731079` 9 v = add mul v q bitcast f64 ulong `4613798575908835234` 10 d = bitcast f64 ulong `4575625165243457492` 11 d = add mul d q bitcast f64 ulong `4599480671287182180` 12 d = add mul d q bitcast f64 ulong `4612688371394471446` 13 d = add mul d q bitcast f64 ulong `4615636595525398809` 14 d = add mul d q f64 1.0 15 ret div v d 16 end 17 fn cm_normal_middle q f64 to f64 18 r = mul q q 19 v = bitcast f64 ulong `13854155686354486565` 20 v = add mul v r bitcast f64 ulong `4641977866302784411` 21 v = add mul v r bitcast f64 ulong `13866933838737128345` 22 v = add mul v r bitcast f64 ulong `4639072047187312667` 23 v = add mul v r bitcast f64 ulong `13852696627858410445` 24 v = add mul v r bitcast f64 ulong `4612826843888178297` 25 v = mul v q 26 d = bitcast f64 ulong `13856235683484533956` 27 d = add mul d r bitcast f64 ulong `4639889312772538999` 28 d = add mul d r bitcast f64 ulong `13863054224260258002` 29 d = add mul d r bitcast f64 ulong `4634401141363829182` 30 d = add mul d r bitcast f64 ulong `13847038013971134502` 31 d = add mul d r f64 1.0 32 ret div v d 33 end 34 fn cm_normal_inv p f64 to f64 35 if le p f64 0.0 36 ret bitcast f64 ulong `18442240474082181120` 37 end 38 if ge p f64 1.0 39 ret bitcast f64 ulong `9218868437227405312` 40 end 41 if lt p bitcast f64 ulong `4582646808030102946` 42 v = mul f64 -2.0 cm_log p false 43 q = bitcast f64 cm_sqrt bitcast ulong v 44 ret cm_normal_tail q 45 end 46 if gt p bitcast f64 ulong `4606963994218089939` 47 v = mul f64 -2.0 cm_log sub f64 1.0 p false 48 q = bitcast f64 cm_sqrt bitcast ulong v 49 ret neg cm_normal_tail q 50 end 51 ret cm_normal_middle sub p f64 0.5 52 end 53 fn cm_quantile qb ulong db ulong to ulong 54 q = bitcast f64 qb 55 dof = bitcast f64 db 56 z = cm_normal_inv add f64 0.5 mul f64 0.5 q 57 if not gt dof f64 0.0 58 ret bitcast ulong z 59 end 60 z3 = mul mul z z z 61 z5 = mul mul z3 z z 62 a = div add z3 z mul f64 4.0 dof 63 b = add mul f64 5.0 z5 mul f64 16.0 z3 64 b = add b mul f64 3.0 z 65 b = div b mul mul f64 96.0 dof dof 66 ret bitcast ulong add add z a b 67 end