From: SourceForge.net <no...@so...> - 2007-03-30 23:19:58
|
Bugs item #1691703, was opened at 2007-03-30 19:19 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=104933&aid=1691703&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: float(ceiling(...)) sometimes returns float, sometimes int Initial Comment: float(ceiling(log(9)/log(2))) => 3.0 (a float) float(ceiling(log(8)/log(2))) => 3 (an integer) This is because ceiling(log(9)/log(2))=4 but ceiling(log(8)/log(2)) => ceiling(log(8)/log(2)) and only simplifies to a number when the argument is evaluated as a float. float(ceiling(log(2^80)/log(2))) => 80 (an integer) float(ceiling(log(2^80-1)/log(2))) => 80.0 (a float) Shouldn't float(...) always be returning a float if it's returning a number? I think the problem is that it assumes that if f(x) simplifies to a number, and x is a float, then f(x) is a float. I think it makes sense for ceiling(2.3) => 3 (not 3.0), so the problem seems to be in float, not in simp-ceiling. You could argue that ceiling should do a better job in the first place, but that's an orthogonal issue, and in any case it will never handle all possible cases. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=104933&aid=1691703&group_id=4933 |