1// tables and constants for approximating erff(x). 2// 3// Copyright (c) 2023, Arm Limited. 4// SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception 5 6display = hexadecimal; 7prec=128; 8 9// Tables 10print("{ i, r, erf(r), 2/sqrt(pi) * exp(-r^2)}"); 11for i from 0 to 512 do { 12 r = i / 128; 13 t0 = single(erf(r)); 14 t1 = single(2/sqrt(pi) * exp(-r * r)); 15 print("{ " @ i @ ",\t" @ r @ ",\t" @ t0 @ ",\t" @ t1 @ " },"); 16}; 17 18// Constants 19single(1/3); 20single(2/sqrt(pi)); 21