From: SourceForge.net <noreply@so...>  20081021 12:52:28

Bugs item #2159499, was opened at 20081011 11:11 Message generated for change (Comment added) made by rtoy You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=104933&aid=2159499&group_id=4933 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Lisp Core  Floating point Group: None Status: Closed Resolution: Fixed Priority: 5 Private: No Submitted By: Dieter Kaiser (crategus) Assigned to: Nobody/Anonymous (nobody) Summary: Full bigfloat precision for Gamma after the second call Initial Comment: In a lot of cases (for some not) we get the full bigfloat precison for the Gamma function not in a first call but in a second call to the function: (%i4) fpprintprec:3; (%o4) 3 That is the first call. We get the full precision. If we have a fresh maxima and increase fpprec the first time we always get the full precision. (%i5) fpprec:64; (%o5) 64 (%i6) gamma(bfloat(1/2))bfloat(gamma(1/2)); (%o6) 3.11b62 Increasing fpprec. First call. Missing precision. (%i7) fpprec:128; (%o7) 128 (%i8) gamma(bfloat(1/2))bfloat(gamma(1/2)); (%o8) 1.91b91 Second call. Full precision. (%i9) gamma(bfloat(1/2))bfloat(gamma(1/2)); (%o9) 5.43b126 Increasing fpprec. First call. Missing precision. (%i10) fpprec:256; (%o10) 256 (%i11) gamma(bfloat(1/2))bfloat(gamma(1/2)); (%o11) 1.03b182 Now the second call. (%i12) gamma(bfloat(1/2))bfloat(gamma(1/2)); (%o12) 1.21b253 Increasing fpprec. Now full precsion in the first call. (%i13) fpprec:300; (%o13) 300 (%i14) gamma(bfloat(1/2))bfloat(gamma(1/2)); (%o14) 1.97b297 And again. Increasing fpprec. Missing precesion in the first call. (%i15) fpprec:512; (%o15) 512 (%i16) gamma(bfloat(1/2))bfloat(gamma(1/2)); (%o16) 3.0b365 Dieter Kaiser  >Comment By: Raymond Toy (rtoy) Date: 20081021 08:52 Message: Link to email thread on this topic: http://www.math.utexas.edu/pipermail/maxima/2008/013946.html  Comment By: Dieter Kaiser (crategus) Date: 20081021 06:59 Message: After a bug fix in float.lisp the effect that we do not get the full precision in a first call to gamma has vanished. Log Message of the bug fix in float.lisp: 1. bug fix for fppi1 helper function fprt18231_ (dependence on $fpprec caused wrong results when fpprec was changed by an other function) 2. another version of fprt18231_ added, which was tested to be faster in clisp and sbcl (author: Raymond Toy) Closing this bug report. Dieter Kaiser  Comment By: Dieter Kaiser (crategus) Date: 20081012 18:11 Message: I have studied the effect in more detail and detected that we have the problem only for a negative argument to bffac. That is true for gamma(0.5b0). The reflection formula calculates: bfloat(%pi*z/sin(%pi*z))/bffac(z,fpprec) If we add an additional bfloat to be sure that the argument of the sin function has the correct precision the described effect that we need a second call to get the full precision vanish. The modified line of code is bfloat(%pi*z/sin(bfloat(%pi*z)))/bffac(z,fpprec) I have not really understand the effect, but it seems to me that it works. Perhaps there is a problem with the sin function. Any comment? Dieter Kaiser  You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=104933&aid=2159499&group_id=4933 