Home My Page Projects Code Snippets Project Openings SML/NJ Bugs
Summary Activity Tracker Lists

[#109] Math.pow does not produce an integer result on 2^3

Date:
2012-10-27 17:28
Priority:
3
State:
Open
Submitted by:
Bug Submitter (webuser)
Assigned to:
John Reppy (jhr)
Machine Architecture:
x86
Operating System:
MacOS X
Component:
Basis Library
Resolution:
None
Severity:
Major
OS Version:
10.8
SML/NJ Version:
110.75
Keywords:
reals
URL:
Transcript (of reproduction):
jhr@loki sml Standard ML of New Jersey v110.75 [built: Sun Sep 30 07:51:58 2012] - Real.trunc (Math.pow (2.0, 3.0)); [autoloading] [library $SMLNJ-BASIS/basis.cm is stable] [autoloading done] val it = 7 : int - 8.0 - Math.pow (2.0, 3.0); val it = 1.7763568394E~15 : real -
Source (for reproduction):
Real.trunc (Math.pow (2.0, 3.0)); 8.0 - Math.pow (2.0, 3.0);
Summary:
Math.pow does not produce an integer result on 2^3

Detailed description
Math.pow does not return an integer result when an integer is
raised to an integer power.
Submitted via web form by John Reppy jhr@cs.uchicago.edu

Comments:

Message  ↓
Date: 2018-03-25 12:03
Sender: John Reppy

Perhaps we should reimplement this function based on the netlike C implementation at http://www.netlib.org/fdlibm/

Attached Files:

Changes

Field Old Value Date By
assigned_tonone2018-03-25 12:03jhr
detailsMath.pow does not return an integer result when an integer is raised to an integer power. Submitted via web form by John Reppy jhr@cs.uchicago.edu 2018-03-25 12:03jhr
Transcript (of reproduction)jhr@loki sml Standard ML of New Jersey v110.75 [built: Sun Sep 30 07:51:58 2012] - Real.trunc (Math.pow (2.0, 3.0)); [autoloading] [library $SMLNJ-BASIS/basis.cm is stable] [autoloading done] val it = 7 : int - 8.0 - Math.pow (2.0, 3.0); val it = 1.7763568394E~15 : real - 2018-03-25 12:03jhr
Source (for reproduction)Real.trunc (Math.pow (2.0, 3.0)); 8.0 - Math.pow (2.0, 3.0); 2018-03-25 12:03jhr