A Solidity implementation of the CDF function with 1e-8 precision.
The implementation uses a Gaussian
/GaussianYul
for a more detailed explanation and breakdown of a few minor optimizations.
View computed parameters
# Maximum absolute error: 1.3430230007294523e-08
p = [
1.0000000134302306273277303995065049273812887383708033070765535,
-1.6270692420214419689048648107492650445124851868993666400546805,
0.95695939771557621630788382329318927876123532216447446035189629,
-0.16633851257171462994968608289343417448516569184903674878490485,
-0.045757328741294745592296128432121626122059153122475781868753213,
-0.0037075449565245192403519588225698683637412864376254631738819151,
0.028488362762927522030907690912222875179502188416622942809751882,
-0.016287529736941549594061740522247112596133132474157032579938495,
0.0048172203752504698927671605458443098230415330921338519326194087,
-0.00087210950306797040922396209123138809770604994758407050613031373,
0.000099149714653716020389941915394734964728925581883441887433840514,
-0.0000067602050744659632236787608312592389179948948837815547237917173,
0.0000002393840402106164843090318571199276741485022552134339717005062,
-0.0000000028518992951670794908019473353232308246724639330742090849192205,
]
q = [
1.0,
-0.49868824055465048831235903088578070819751012339484972855105241,
0.39420799004922720178799577859465503879202580871471965614479612,
-0.097268947975024830829217859353973885910383757802529177945661066,
0.030267961461764185107683252708473682723390196231235004968537513,
]
- Remco and his blog post Approximation Theory for detailing how to compute an optimal polynomial/rational approximation.
- philogy for open-sourcing Philogy/gud-ctf early and serving as a nice reference to view and test against.