Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(402)

Issue 22054: Address loss of precision issues in complex arcsin, arcsinh, arctan, arctanh (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
15 years, 1 month ago by pav
Modified:
14 years, 8 months ago
Visibility:
Public.

Description

Address loss of precision issues in complex arcsin, arcsinh, arctan, arctanh The complex-valued arc* functions (that -> 0 for z -> 0) have loss of precision issues for small arguments. This patch addresses this by switching to a series expansion in this regime. Applied in: http://scipy.org/scipy/numpy/changeset/6520

Patch Set 1 #

Total comments: 12

Patch Set 2 : Fix according to comments. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+178 lines, -26 lines) Patch
M numpy/core/src/umath_funcs.inc.src View 1 5 chunks +103 lines, -26 lines 0 comments Download
M numpy/core/tests/test_umath.py View 1 1 chunk +75 lines, -0 lines 0 comments Download

Messages

Total messages: 3
cournape
A few nitpicks + question concerning the precision of the test http://codereview.appspot.com/22054/diff/1/2 File numpy/core/src/umath_funcs.inc.src (right): ...
15 years, 1 month ago (2009-02-28 14:48:52 UTC) #1
pav
http://codereview.appspot.com/22054/diff/1/2 File numpy/core/src/umath_funcs.inc.src (right): http://codereview.appspot.com/22054/diff/1/2#newcode102 Line 102: #ifdef SERIES_HORNER_TERM On 2009/02/28 14:48:52, cournape wrote: > ...
15 years, 1 month ago (2009-02-28 16:22:17 UTC) #2
charlesr.harris
15 years, 1 month ago (2009-02-28 16:52:39 UTC) #3
Thanks for fixing these.

http://codereview.appspot.com/22054/diff/1/2
File numpy/core/src/umath_funcs.inc.src (left):

http://codereview.appspot.com/22054/diff/1/2#oldcode319
Line 319: * return nc_neg(nc_prodi(nc_log(nc_sum(nc_prod(nc_i,x),
I've started replacing these expressions with more readable versions here and
there. Maybe

returns -i*log(i*x + sqrt(1 - x**2))

http://codereview.appspot.com/22054/diff/1/2
File numpy/core/src/umath_funcs.inc.src (right):

http://codereview.appspot.com/22054/diff/1/2#newcode346
Line 346: } else {
Nitpick: Else like so

}
else {
}

I've been cleaning up the code style throughout the c files but haven't got to
the ufunc_func file yet, so this would make one less line to edit.

http://codereview.appspot.com/22054/diff/1/2#newcode347
Line 347: /* Small arguments: series expansion, to avoid loss of precision
Another nitpick, multiline comments like

/*
 * blah
 * blah
 */

http://codereview.appspot.com/22054/diff/1/2#newcode358
Line 358: SERIES_HORNER_TERM(r, &x2, 1./6);
Maybe 25./42.? You are telling the compiler make a cast, but it might be a bit
clearer to make it explicit all the way through.
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b