From: SourceForge.net <noreply@so...>  20090624 22:43:42

Bugs item #751934, was opened at 20030610 16:13 Message generated for change (Comment added) made by crategus You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=104933&aid=751934&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  Simplification Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: Stavros Macrakis (macrakis) Assigned to: Nobody/Anonymous (nobody) Summary: Inconsistent simplification of 1.0*x etc. Initial Comment: Maxima is sloppy about simplifications involving floating point numbers. Notation: ==> means simplifies to (OK) means I think this is correct (No!) means I think this is incorrect 1.0*x ==> x (No!) Prefer: 1.0*x though 2.0*x ==> 2.0*x (OK) 0.0*x ==> 0.0 (OK) 2.0*x2.0*x ==> 0 (No!) Prefer: 0.0 though 2.02.0 ==> 0.0 (OK) (2.02.0)*x ==> 0.0 (OK) x^1.0 ==> x (No!) Prefer: x^1.0 though x^2.0 ==> x^2.0 (OK) x^1.0 ==> x^1.0 (OK) (normally displays as 1/ (x^1.0)) x+0.0 ==> x (???) I am not sure whether this is correct. All the above cases also happen with mixed float/fixed and with bfloats.  Whenever the result depends on the floatingpoint precision, the float must be maintained.  >Comment By: Dieter Kaiser (crategus) Date: 20090625 00:42 Message: Because of the the changes with revision 1.80 to TMS, TIMESIN and PLUSIN in simp.lisp some more examples simplifies correctly. When we add the following code to PLUSIN, even more examples simplify as expected. ;; (cadadr fm) is zero, add it to the first term of fm to preserve the type. (rplaca fm (add (car fm) (cadadr fm))) (return (rplacd fm (cddr fm))) These are some results. First for floating point numbers; (%i28) 0.0*x; (%o28) 0.0 (%i29) 1.0*x; (%o29) 1.0*x (%i30) 2.0*x2.0*x; (%o30) 0.0 The simplification with bigfloat numbers: (%i31) 0.0b0*x; (%o31) 0.0b0 (%i32) 1.0b0*x; (%o32) 1.0b0*x (%i33) 2.0b0*x2.0b0*x; (%o33) 0.0b0 And some examples with mixed numbers: (%i34) 2*x2.0*x; (%o34) 0.0 (%i35) 2.0*x2*x; (%o35) 0.0 (%i36) 2.0b0*x2*x; (%o36) 0.0b0 (%i37) 2.0b0*x2.0*x; (%o37) 0.0b0 Only the example x^1.0 > x^1.0 is missing. This can be changed in simpexpt. Dieter Kaiser  You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=104933&aid=751934&group_id=4933 