1// tables and constants for approximating erf(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 768 do { 12 r = i / 128; 13 t0 = double(erf(r)); 14 t1 = double(2/sqrt(pi) * exp(-r * r)); 15 print("{ " @ i @ ",\t" @ r @ ",\t" @ t0 @ ",\t" @ t1 @ " },"); 16}; 17 18// Constants 19double(1/3); 20double(1/10); 21double(2/15); 22double(2/9); 23double(2/45); 24double(2/sqrt(pi)); 25 26