JDK-5031749 : REGRESSION: Javadoc for Math.floor() contradicts itself
  • Type: Bug
  • Component: docs
  • Sub-Component: guides
  • Affected Version: 5.0
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: windows_2000,windows_xp
  • CPU: x86
  • Submitted: 2004-04-14
  • Updated: 2021-09-15
  • Resolved: 2004-06-17
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
5.0 b57Fixed
Related Reports
Relates :  
Relates :  
Relates :  
Description

Name: jl125535			Date: 04/14/2004


URL OF THE PROBLEM DOCUMENTATION :
http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Math.html#floor(double)

A DESCRIPTION OF THE PROBLEM :
In the description section of the JavaDoc for Math.floor(), it says:

"Returns the largest (closest to positive infinity) double value that is not greater than the argument and is equal to a mathematical integer."

but then in the returns section, it says:

"the smallest (closest to negative infinity) floating-point value that is not less than the argument and is equal to a mathematical integer."

The latter is correct (assuming the docs for Math.ceil() are correct).

Release Regression From : 1.4.2
The above release value was the last known release where this 
bug was known to work. Since then there has been a regression.

(Incident Review ID: 250085) 
======================================================================

Name: gm110360			Date: 06/02/2004



The first line of Math.ceil and the returns line both describe Math.floor

The first line of Math.floor is correct (same as incorrect Math.ceil), but the returns line describes Math.ceil.
(Review ID: 276037)
======================================================================

Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: tiger-beta2 tiger-rc FIXED IN: tiger-rc INTEGRATED IN: tiger-b57 tiger-rc
25-06-2004

SUGGESTED FIX src/share/classes/java/lang>sccs sccsdiff -r1.68 -r1.69 Math.java ------- Math.java ------- 70c70 < public final strictfp class Math { --- > public final class Math { 300d299 < * <!--@return the value of &radic;&nbsp;<code>a</code>.--> 370,379c369,378 < * Returns the largest (closest to positive infinity) < * <code>double</code> value that is not greater than the argument and is < * equal to a mathematical integer. Special cases: < * <ul><li>If the argument value is already equal to a mathematical < * integer, then the result is the same as the argument. < * <li>If the argument is NaN or an infinity or positive zero or negative < * zero, then the result is the same as the argument. < * <li>If the argument value is less than zero but greater than -1.0, < * then the result is negative zero.</ul> < * Note that the value of <code>Math.ceil(x)</code> is exactly the --- > * Returns the smallest (closest to negative infinity) > * <code>double</code> value that is greater than or equal to the > * argument and is equal to a mathematical integer. Special cases: > * <ul><li>If the argument value is already equal to a > * mathematical integer, then the result is the same as the > * argument. <li>If the argument is NaN or an infinity or > * positive zero or negative zero, then the result is the same as > * the argument. <li>If the argument value is less than zero but > * greater than -1.0, then the result is negative zero.</ul> Note > * that the value of <code>Math.ceil(x)</code> is exactly the 381a381 > * 383,386c383,385 < * <!--@return the value &lceil;&nbsp;<code>a</code>&nbsp;&rceil;.--> < * @return the largest (closest to positive infinity) < * floating-point value that is not greater than the argument < * and is equal to a mathematical integer. --- > * @return the smallest (closest to negative infinity) > * floating-point value that is greater than or equal to > * the argument and is equal to a mathematical integer. 393,399c392,399 < * Returns the largest (closest to positive infinity) < * <code>double</code> value that is not greater than the argument and < * is equal to a mathematical integer. Special cases: < * <ul><li>If the argument value is already equal to a mathematical < * integer, then the result is the same as the argument. < * <li>If the argument is NaN or an infinity or positive zero or < * negative zero, then the result is the same as the argument.</ul> --- > * Returns the largest (closest to positive infinity) > * <code>double</code> value that is less than or equal to the > * argument and is equal to a mathematical integer. Special cases: > * <ul><li>If the argument value is already equal to a > * mathematical integer, then the result is the same as the > * argument. <li>If the argument is NaN or an infinity or > * positive zero or negative zero, then the result is the same as > * the argument.</ul> 402,404c402,403 < * <!--@return the value &lfloor;&nbsp;<code>a</code>&nbsp;&rfloor;.--> < * @return the smallest (closest to negative infinity) < * floating-point value that is not less than the argument --- > * @return the largest (closest to positive infinity) > * floating-point value that less than or equal to the argument src/share/classes/java/lang>sccs sccsdiff -r1.25 -r1.26 StrictMath.java ------- StrictMath.java ------- 146c146 < public static double toRadians(double angdeg) { --- > public static strictfp double toRadians(double angdeg) { 161c161 < public static double toDegrees(double angrad) { --- > public static strictfp double toDegrees(double angrad) { 285,295c285,295 < * Returns the smallest (closest to negative infinity) < * <code>double</code> value that is not less than the argument and is < * equal to a mathematical integer. Special cases: < * <ul><li>If the argument value is already equal to a mathematical < * integer, then the result is the same as the argument. < * <li>If the argument is NaN or an infinity or positive zero or negative < * zero, then the result is the same as the argument. < * <li>If the argument value is less than zero but greater than -1.0, < * then the result is negative zero.</ul> < * Note that the value of <code>Math.ceil(x)</code> is exactly the < * value of <code>-Math.floor(-x)</code>. --- > * Returns the smallest (closest to negative infinity) > * <code>double</code> value that is greater than or equal to the > * argument and is equal to a mathematical integer. Special cases: > * <ul><li>If the argument value is already equal to a > * mathematical integer, then the result is the same as the > * argument. <li>If the argument is NaN or an infinity or > * positive zero or negative zero, then the result is the same as > * the argument. <li>If the argument value is less than zero but > * greater than -1.0, then the result is negative zero.</ul> Note > * that the value of <code>StrictMath.ceil(x)</code> is exactly the > * value of <code>-StrictMath.floor(-x)</code>. 298d297 < * <!--@return the value &lceil;&nbsp;<code>a</code>&nbsp;&rceil;.--> 300,301c299,300 < * floating-point value that is not less than the argument < * and is equal to a mathematical integer. --- > * floating-point value that is greater than or equal to > * the argument and is equal to a mathematical integer. 306,312c305,312 < * Returns the largest (closest to positive infinity) < * <code>double</code> value that is not greater than the argument and < * is equal to a mathematical integer. Special cases: < * <ul><li>If the argument value is already equal to a mathematical < * integer, then the result is the same as the argument. < * <li>If the argument is NaN or an infinity or positive zero or < * negative zero, then the result is the same as the argument.</ul> --- > * Returns the largest (closest to positive infinity) > * <code>double</code> value that is less than or equal to the > * argument and is equal to a mathematical integer. Special cases: > * <ul><li>If the argument value is already equal to a > * mathematical integer, then the result is the same as the > * argument. <li>If the argument is NaN or an infinity or > * positive zero or negative zero, then the result is the same as > * the argument.</ul> 314,315c314 < * @param a a <code>double</code> value. < * <!--@return the value &lfloor;&nbsp;<code>a</code>&nbsp;&rfloor;.--> --- > * @param a a value. 317c316 < * floating-point value that is not greater than the argument --- > * floating-point value that less than or equal to the argument ###@###.### 2004-06-14
14-06-2004

EVALUATION java.lang.Math.ceil and java.lang.Math.floor descriptions are incorrect. ###@###.### 2004-04-15 Reassigning to Joe. ###@###.### 2004-04-30
15-04-2004