Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error functions in pure Julia form #82

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Error functions in pure Julia form #82

wants to merge 1 commit into from

Conversation

ziyixi
Copy link

@ziyixi ziyixi commented Mar 14, 2018

Hello everyone, I'm a prospective applicant of GSoC this year, and I'm interested in developing error functions in pure Julia form as GSoC in julialang.org says.

Here I write some code of error functions in pure Julia form, which is adapted from https://github.com/simonbyrne/apple-libm. And it has passed tests. Hope you will find it's useful!

Let me have a brief self-introduction of myself. I'm now a senior year undergraduate student major in geophysics and dual major in computer science. And this year I will pursue my PhD degree in the United States. So I should have enough time and required background to do this project. Hope I could be chosen into the project!

@ViralBShah
Copy link
Member

Do also see the discussion in #52

ysquared = y^2
numerator = a[5]*ysquared
denominator = ysquared
for i in 1:3
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -3,10 +3,136 @@
using Base.Math: @horner, libm
using Base.MPFR: ROUNDING_MODE

function ErrFunApprox(x::Float64,iserfc::Bool,result::Float64)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


xxbig = 27.2e+0
Maximum = 2.53e+307
_HUGE = 6.71e+7
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

explain why these constants

result = ysquared*(numerator+pp[5])/(denominator+qq[5])
result = (InvSqrtPI-result)/y
ysquared = trunc(y*16.0)/16.0
del = (y-ysquared)*(y+ysquared)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a comment to explain what this is doing

function ErrFunApprox(x::Float64,iserfc::Bool,result::Float64)
if isinf(x)
if x > 0
return iserfc?0.0:1.0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ternaries need spaces in 0.7, so this should be iserfc ? 0.0 : 1.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants