SourceForge has been redesigned. Learn more.
Close

#1254 problem with the function floor

closed
nobody
5
2007-09-07
2007-08-23
Anonymous
No

> float(log(8)/log(2));
> 3.0;
> floor(%);
> 2; <--------------------- What?! It's an error!
> floor(3.0);
> 3;

-------------------------------------------------------------
Maxima version: 5.12.0
Maxima build date: 10:43 5/15/2007
host type: i686-pc-linux-gnu
lisp-implementation-type: CLISP
lisp-implementation-version: 2.41 (2006-10-13) (built 3371985193) (memory 3388207441)
-------------------------------------------------------------

Discussion

  • Raymond Toy

    Raymond Toy - 2007-08-23

    Logged In: YES
    user_id=28849
    Originator: NO

    This is really a deficiency with maxima's printer. float(log(8)/log(2)) is 2.9999999999999996. Hence, floor is correct in returning 2.

    To see this, use ":lisp $%o<n>", assuming your Lisp has an accurate printer. If not, then try
    :lisp (integer-decode-float $%o<n>). Compare that with :lisp (integer-decode-float 3d0).

    Set to pending.

     
  • Raymond Toy

    Raymond Toy - 2007-08-23
    • status: open --> pending
     
  • SourceForge Robot

    Logged In: YES
    user_id=1312539
    Originator: NO

    This Tracker item was closed automatically by the system. It was
    previously set to a Pending status, and the original submitter
    did not respond within 14 days (the time period specified by
    the administrator of this Tracker).

     
  • SourceForge Robot

    • status: pending --> closed
     
  • Stavros Macrakis

    Logged In: YES
    user_id=588346
    Originator: NO

    I don't know why the original poster was doing float(log(8)/log(2)) in the first place -- perhaps because he couldn't get it to simplify otherwise? If we knew who it was, we could suggest s/he try radcan, which does give exactly 3.

     

Log in to post a comment.