From: SourceForge.net <no...@so...> - 2008-12-28 03:55:35
|
Bugs item #2467104, was opened at 2008-12-25 15:23 Message generated for change (Comment added) made by rtoy You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=104933&aid=2467104&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: Open Resolution: None Priority: 5 Private: No Submitted By: Nobody/Anonymous (nobody) Assigned to: Nobody/Anonymous (nobody) Summary: plot2d of sin(x) incorrect Initial Comment: This is maxima-5.17.0 installed from source onto Kubuntu Ibex on a 32-bit x86. It is running on sbcl_1%3a1.0.18.0-1_i386.deb installed from binary. A simple "plot2d(sin(x), [x, -3.25, -3]);" results in the plot output available at http://www.vsta.org/andy/maxima_sin.jpg If you need to reach me, google "contact andy valencia". Thanks! ---------------------------------------------------------------------- Comment By: Raymond Toy (rtoy) Date: 2008-12-27 22:55 Message: That change is for clisp and has nothing to do with sbcl. ---------------------------------------------------------------------- Comment By: Nobody/Anonymous (nobody) Date: 2008-12-27 19:32 Message: > There is some code in Maxima (in src/clmacs.lisp) to set the default float > format to DOUBLE-FLOAT. So the above result shows that code is not working > as intended. It's not clear to me whose fault it is. Note that in my source tree the line: ;; (setq custom:*default-float-format* 'double-float) is commented out, with a comment above it. The comment references a stale URL, but the person doing the change was "rtoy". ---------------------------------------------------------------------- Comment By: Robert Dodier (robert_dodier) Date: 2008-12-27 17:40 Message: > (%i1) :lisp *read-default-float-format* > SINGLE-FLOAT There is some code in Maxima (in src/clmacs.lisp) to set the default float format to DOUBLE-FLOAT. So the above result shows that code is not working as intended. It's not clear to me whose fault it is. I don't know if we (Maxima developers) want to try to work around this, or change the code in src/clmacs.lisp, or what. In any event there is an straightforward workaround for users: put (setq *read-default-float-format* 'double-float) in $HOME/.maxima/maxima-init.lisp . ---------------------------------------------------------------------- Comment By: Nobody/Anonymous (nobody) Date: 2008-12-27 11:57 Message: Here's the output; it sure looks like SBCL has settled on the wrong float format: Maxima 5.17.0 http://maxima.sourceforge.net Using Lisp SBCL 1.0.18.debian Distributed under the GNU Public License. See the file COPYING. Dedicated to the memory of William Schelter. The function bug_report() provides bug reporting information. (%i1) :lisp *read-default-float-format* SINGLE-FLOAT (%i1) :lisp (prin1 1d-20) 1.d-20 1.d-20 (%i1) :lisp (format t "~g~%" 1d-20) 1.00000000000000000000d-20 NIL (%i1) :lisp (setq *read-default-float-format* 'double-float) DOUBLE-FLOAT (%i1) :lisp (prin1 1d-20) 1.e-20 1.e-20 (%i1) :lisp (format t "~g~%" 1d-20) 1.00000000000000000000e-20 NIL (%i1) ---------------------------------------------------------------------- Comment By: Robert Dodier (robert_dodier) Date: 2008-12-27 11:45 Message: By the way, about this: > I found a gnuplot manual, and the "set datafile fortran" option appears to be needed to accept this kind of exponentiation. Using the fortran option is kind of a last resort --- we'll try to figure out the "d" versus "e" problem, but if we can't resolve it, we could work around the problem with the fortran option. Thanks for the information. ---------------------------------------------------------------------- Comment By: Robert Dodier (robert_dodier) Date: 2008-12-27 11:39 Message: Hi Andy, > It looks like the output set has numbers of the format: > > -3.2413793103448274 9.96211369590875800d-2 Do I understand correctly that this is an excerpt from maxout.gnuplot or maxout.gnuplot_pipes? If so, something has gone wrong --- numbers are being printed with the "d" exponent marker but an "e" is intended. The numbers are double floats, but the Lisp environment is supposed to be arranged so that they are printed with "e" instead of "d". What do the following yield in Maxima? :lisp *read-default-float-format* :lisp (prin1 1d-20) :lisp (format t "~g~%" 1d-20) If *read-default-float-format* is something other than DOUBLE-FLOAT, try this: :lisp (setq *read-default-float-format* 'double-float) :lisp (prin1 1d-20) :lisp (format t "~g~%" 1d-20) Do prin1 and format yield something different than before? By the way, it would be better if you post the above results and any further comments directly into the bug report, so that others can follow this discussion. Thanks for your help, Robert ---------------------------------------------------------------------- Comment By: Robert Dodier (robert_dodier) Date: 2008-12-26 12:56 Message: Not observed with current CVS version + SBCL, Clisp, CMUCL, or ECL. Please try: :lisp (trace sin) :lisp (setf (gethash '%sin *flonum-op*) #'sin) plot2d(sin(x), [x, -3.25, -3]); which should show the computed values of sin(x). Please paste the trace output into this bug report. If you can identify the values of sin(x) for which spurious values are returned, try starting SBCL by itself and paste the computed return values (spurious or otherwise) into this report. Thanks for your help. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=104933&aid=2467104&group_id=4933 |