Files
pplus-library/modules/special/erf-approx/ref/python/plain.py
T
alexm 568474d52f
Test (in pplus-core) / in-core (push) Failing after 28m44s
Initial commit
2026-11-12 22:23:48 -05:00

10 lines
277 B
Python

import math
def erf_approx(x):
sign = -1.0 if x < 0.0 else 1.0
a = abs(x)
t = 1.0 / (1.0 + 0.3275911 * a)
poly = ((((1.061405429 * t - 1.453152027) * t + 1.421413741) * t - 0.284496736) * t + 0.254829592) * t
return sign * (1.0 - poly * math.exp(-a * a))