Skip to content

Error functions in pure Julia form - #82

Open
ziyixi wants to merge 1 commit into
JuliaMath:masterfrom
ziyixi:master
Open

Error functions in pure Julia form#82
ziyixi wants to merge 1 commit into
JuliaMath:masterfrom
ziyixi:master

Conversation

@ziyixi

@ziyixi ziyixi commented Mar 14, 2018

Copy link
Copy Markdown

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
Copy Markdown
Member

Do also see the discussion in #52

Comment thread src/erf.jl
ysquared = y^2
numerator = a[5]*ysquared
denominator = ysquared
for i in 1:3

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Comment thread src/erf.jl
using Base.Math: @horner, libm
using Base.MPFR: ROUNDING_MODE

function ErrFunApprox(x::Float64,iserfc::Bool,result::Float64)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Comment thread src/erf.jl

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

Copy link
Copy Markdown
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

Comment thread src/erf.jl
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
Copy Markdown
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

Comment thread src/erf.jl
function ErrFunApprox(x::Float64,iserfc::Bool,result::Float64)
if isinf(x)
if x > 0
return iserfc?0.0:1.0

Copy link
Copy Markdown
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