rem
stringlengths 0
477k
| add
stringlengths 0
313k
| context
stringlengths 6
599k
| meta
stringlengths 141
403
|
---|---|---|---|
return(subtype.substring(0, idx)); | return mimeType.substring(start + 1, end); | getSubType(){ int idx = mimeType.indexOf("/"); if (idx == -1) return(""); String subtype = mimeType.substring(idx + 1); idx = subtype.indexOf(" "); if (idx == -1) return(subtype); else return(subtype.substring(0, idx));} | 1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/1e7aa2954f7fa9e45a7b68da25c13d3846158a39/DataFlavor.java/buggy/core/src/classpath/java/java/awt/datatransfer/DataFlavor.java |
String mime = getMimeType(); int i = mime.indexOf(";"); if (i != -1) mime = mime.substring(0, i); | isMimeTypeEqual(String mimeType){ // FIXME: Need to handle default attributes and parameters return(this.mimeType.equals(mimeType));} | 1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/1e7aa2954f7fa9e45a7b68da25c13d3846158a39/DataFlavor.java/buggy/core/src/classpath/java/java/awt/datatransfer/DataFlavor.java |
|
return(this.mimeType.equals(mimeType)); | i = mimeType.indexOf(";"); if (i != -1) mimeType = mimeType.substring(0, i); return mime.equals(mimeType); | isMimeTypeEqual(String mimeType){ // FIXME: Need to handle default attributes and parameters return(this.mimeType.equals(mimeType));} | 1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/1e7aa2954f7fa9e45a7b68da25c13d3846158a39/DataFlavor.java/buggy/core/src/classpath/java/java/awt/datatransfer/DataFlavor.java |
throw new RuntimeException("Not implemented"); | return Remote.class.isAssignableFrom (representationClass); | isRepresentationClassRemote(){ // FIXME: Implement throw new RuntimeException("Not implemented");} | 1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/1e7aa2954f7fa9e45a7b68da25c13d3846158a39/DataFlavor.java/buggy/core/src/classpath/java/java/awt/datatransfer/DataFlavor.java |
return("DataFlavor[representationClass=" + representationClass.getName() + ",mimeType=" + mimeType + "humanPresentableName=" + humanPresentableName); | return(getClass().getName() + "[representationClass=" + getRepresentationClass().getName() + ",mimeType=" + getMimeType() + ",humanPresentableName=" + getHumanPresentableName() + "]"); | toString(){ return("DataFlavor[representationClass=" + representationClass.getName() + ",mimeType=" + mimeType + "humanPresentableName=" + humanPresentableName);} | 1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/1e7aa2954f7fa9e45a7b68da25c13d3846158a39/DataFlavor.java/buggy/core/src/classpath/java/java/awt/datatransfer/DataFlavor.java |
public AcceptAllFileFilter() { } | 1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/963ae61676e8c35a9e0998e0b7de1f942db82a26/BasicFileChooserUI.java/clean/core/src/classpath/javax/javax/swing/plaf/basic/BasicFileChooserUI.java |
||
protected ApproveSelectionAction() { } | 1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/963ae61676e8c35a9e0998e0b7de1f942db82a26/BasicFileChooserUI.java/clean/core/src/classpath/javax/javax/swing/plaf/basic/BasicFileChooserUI.java |
||
public BasicFileView() { } | 1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/963ae61676e8c35a9e0998e0b7de1f942db82a26/BasicFileChooserUI.java/clean/core/src/classpath/javax/javax/swing/plaf/basic/BasicFileChooserUI.java |
||
protected CancelSelectionAction() { } | 1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/963ae61676e8c35a9e0998e0b7de1f942db82a26/BasicFileChooserUI.java/clean/core/src/classpath/javax/javax/swing/plaf/basic/BasicFileChooserUI.java |
||
protected ChangeToParentDirectoryAction() { } | 1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/963ae61676e8c35a9e0998e0b7de1f942db82a26/BasicFileChooserUI.java/clean/core/src/classpath/javax/javax/swing/plaf/basic/BasicFileChooserUI.java |
||
protected GoHomeAction() { } | 1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/963ae61676e8c35a9e0998e0b7de1f942db82a26/BasicFileChooserUI.java/clean/core/src/classpath/javax/javax/swing/plaf/basic/BasicFileChooserUI.java |
||
protected NewFolderAction() { } | 1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/963ae61676e8c35a9e0998e0b7de1f942db82a26/BasicFileChooserUI.java/clean/core/src/classpath/javax/javax/swing/plaf/basic/BasicFileChooserUI.java |
||
protected SelectionListener() { } | 1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/963ae61676e8c35a9e0998e0b7de1f942db82a26/BasicFileChooserUI.java/clean/core/src/classpath/javax/javax/swing/plaf/basic/BasicFileChooserUI.java |
||
protected UpdateAction() { } | 1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/963ae61676e8c35a9e0998e0b7de1f942db82a26/BasicFileChooserUI.java/clean/core/src/classpath/javax/javax/swing/plaf/basic/BasicFileChooserUI.java |
||
public File createFileObject(String path) | public File createFileObject(File dir, String filename) | public File createFileObject(String path) { return new File(path); } | 1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/3826e72d9ebe31a854c4d01d6c8f1ec65a8d80fe/FileSystemView.java/buggy/core/src/classpath/javax/javax/swing/filechooser/FileSystemView.java |
return new File(path); | return new File(dir, filename); | public File createFileObject(String path) { return new File(path); } | 1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/3826e72d9ebe31a854c4d01d6c8f1ec65a8d80fe/FileSystemView.java/buggy/core/src/classpath/javax/javax/swing/filechooser/FileSystemView.java |
public String getDescription(File value0) { return null; } | public String getDescription(File file) { return null; } | public String getDescription(File value0) { return null; // TODO } // getDescription() | 1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/3826e72d9ebe31a854c4d01d6c8f1ec65a8d80fe/FileView.java/buggy/core/src/classpath/javax/javax/swing/filechooser/FileView.java |
public Icon getIcon(File value0) { return null; } | public Icon getIcon(File file) { return null; } | public Icon getIcon(File value0) { return null; // TODO } // getIcon() | 1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/3826e72d9ebe31a854c4d01d6c8f1ec65a8d80fe/FileView.java/buggy/core/src/classpath/javax/javax/swing/filechooser/FileView.java |
public String getName(File file) { return null; } | public String getName(File file) { return null; } | public String getName(File file) { return null; // TODO } // getName() | 1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/3826e72d9ebe31a854c4d01d6c8f1ec65a8d80fe/FileView.java/buggy/core/src/classpath/javax/javax/swing/filechooser/FileView.java |
public String getTypeDescription(File value0) { return null; } | public String getTypeDescription(File file) { return null; } | public String getTypeDescription(File value0) { return null; // TODO } // getTypeDescription() | 1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/3826e72d9ebe31a854c4d01d6c8f1ec65a8d80fe/FileView.java/buggy/core/src/classpath/javax/javax/swing/filechooser/FileView.java |
setBorder(noFocusBorder); | public BasicComboBoxRenderer() { setHorizontalAlignment(SwingConstants.LEFT); } | 1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/3826e72d9ebe31a854c4d01d6c8f1ec65a8d80fe/BasicComboBoxRenderer.java/buggy/core/src/classpath/javax/javax/swing/plaf/basic/BasicComboBoxRenderer.java |
|
public static double IEEEremainder(double x, double y) { | public static double IEEEremainder(double x, double y) { | public static double IEEEremainder(double x, double y) { // Purge off exception values. if (x == Double.NEGATIVE_INFINITY || !(x < Double.POSITIVE_INFINITY) || y == 0 || y != y) return Double.NaN; boolean negative = x < 0; x = abs(x); y = abs(y); if (x == y || x == 0) return 0 * x; // Get correct sign. // Achieve x < 2y, then take first shot at remainder. if (y < TWO_1023) x %= y + y; // Now adjust x to get correct precision. if (y < 4 / TWO_1023) { if (x + x > y) { x -= y; if (x + x >= y) x -= y; } } else { y *= 0.5; if (x > y) { x -= y; if (x >= y) x -= y; } } return negative ? -x : x; } | 1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/b2ed890086e708f00d163f3e8514bfa8b353f662/StrictMath.java/buggy/core/src/classpath/java/java/lang/StrictMath.java |
if (x == Double.NEGATIVE_INFINITY || !(x < Double.POSITIVE_INFINITY) || y == 0 || y != y) | if (x == Double.NEGATIVE_INFINITY || ! (x < Double.POSITIVE_INFINITY) || y == 0 || y != y) | public static double IEEEremainder(double x, double y) { // Purge off exception values. if (x == Double.NEGATIVE_INFINITY || !(x < Double.POSITIVE_INFINITY) || y == 0 || y != y) return Double.NaN; boolean negative = x < 0; x = abs(x); y = abs(y); if (x == y || x == 0) return 0 * x; // Get correct sign. // Achieve x < 2y, then take first shot at remainder. if (y < TWO_1023) x %= y + y; // Now adjust x to get correct precision. if (y < 4 / TWO_1023) { if (x + x > y) { x -= y; if (x + x >= y) x -= y; } } else { y *= 0.5; if (x > y) { x -= y; if (x >= y) x -= y; } } return negative ? -x : x; } | 1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/b2ed890086e708f00d163f3e8514bfa8b353f662/StrictMath.java/buggy/core/src/classpath/java/java/lang/StrictMath.java |
if (y < 4 / TWO_1023) { if (x + x > y) { | if (y < 4 / TWO_1023) { if (x + x > y) { | public static double IEEEremainder(double x, double y) { // Purge off exception values. if (x == Double.NEGATIVE_INFINITY || !(x < Double.POSITIVE_INFINITY) || y == 0 || y != y) return Double.NaN; boolean negative = x < 0; x = abs(x); y = abs(y); if (x == y || x == 0) return 0 * x; // Get correct sign. // Achieve x < 2y, then take first shot at remainder. if (y < TWO_1023) x %= y + y; // Now adjust x to get correct precision. if (y < 4 / TWO_1023) { if (x + x > y) { x -= y; if (x + x >= y) x -= y; } } else { y *= 0.5; if (x > y) { x -= y; if (x >= y) x -= y; } } return negative ? -x : x; } | 1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/b2ed890086e708f00d163f3e8514bfa8b353f662/StrictMath.java/buggy/core/src/classpath/java/java/lang/StrictMath.java |
} else { | } else { | public static double IEEEremainder(double x, double y) { // Purge off exception values. if (x == Double.NEGATIVE_INFINITY || !(x < Double.POSITIVE_INFINITY) || y == 0 || y != y) return Double.NaN; boolean negative = x < 0; x = abs(x); y = abs(y); if (x == y || x == 0) return 0 * x; // Get correct sign. // Achieve x < 2y, then take first shot at remainder. if (y < TWO_1023) x %= y + y; // Now adjust x to get correct precision. if (y < 4 / TWO_1023) { if (x + x > y) { x -= y; if (x + x >= y) x -= y; } } else { y *= 0.5; if (x > y) { x -= y; if (x >= y) x -= y; } } return negative ? -x : x; } | 1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/b2ed890086e708f00d163f3e8514bfa8b353f662/StrictMath.java/buggy/core/src/classpath/java/java/lang/StrictMath.java |
if (x > y) { | if (x > y) { | public static double IEEEremainder(double x, double y) { // Purge off exception values. if (x == Double.NEGATIVE_INFINITY || !(x < Double.POSITIVE_INFINITY) || y == 0 || y != y) return Double.NaN; boolean negative = x < 0; x = abs(x); y = abs(y); if (x == y || x == 0) return 0 * x; // Get correct sign. // Achieve x < 2y, then take first shot at remainder. if (y < TWO_1023) x %= y + y; // Now adjust x to get correct precision. if (y < 4 / TWO_1023) { if (x + x > y) { x -= y; if (x + x >= y) x -= y; } } else { y *= 0.5; if (x > y) { x -= y; if (x >= y) x -= y; } } return negative ? -x : x; } | 1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/b2ed890086e708f00d163f3e8514bfa8b353f662/StrictMath.java/buggy/core/src/classpath/java/java/lang/StrictMath.java |
private StrictMath() { | private StrictMath() { | private StrictMath() { } | 1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/b2ed890086e708f00d163f3e8514bfa8b353f662/StrictMath.java/buggy/core/src/classpath/java/java/lang/StrictMath.java |
public static int abs(int i) { | public static int abs(int i) { | public static int abs(int i) { return (i < 0) ? -i : i; } | 1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/b2ed890086e708f00d163f3e8514bfa8b353f662/StrictMath.java/buggy/core/src/classpath/java/java/lang/StrictMath.java |
public static double acos(double x) { | public static double acos(double x) { | public static double acos(double x) { boolean negative = x < 0; if (negative) x = -x; if (!(x <= 1)) return Double.NaN; if (x == 1) return negative ? PI : 0; if (x < 0.5) { if (x < 1 / TWO_57) return PI / 2; double z = x * x; double p = z * (PS0 + z * (PS1 + z * (PS2 + z * (PS3 + z * (PS4 + z * PS5))))); double q = 1 + z * (QS1 + z * (QS2 + z * (QS3 + z * QS4))); double r = x - (PI_L / 2 - x * (p / q)); return negative ? PI / 2 + r : PI / 2 - r; } if (negative) // x<=-0.5. { double z = (1 + x) * 0.5; double p = z * (PS0 + z * (PS1 + z * (PS2 + z * (PS3 + z * (PS4 + z * PS5))))); double q = 1 + z * (QS1 + z * (QS2 + z * (QS3 + z * QS4))); double s = sqrt(z); double w = p / q * s - PI_L / 2; return PI - 2 * (s + w); } double z = (1 - x) * 0.5; // x>0.5. double s = sqrt(z); double df = (float) s; double c = (z - df * df) / (s + df); double p = z * (PS0 + z * (PS1 + z * (PS2 + z * (PS3 + z * (PS4 + z * PS5))))); double q = 1 + z * (QS1 + z * (QS2 + z * (QS3 + z * QS4))); double w = p / q * s + c; return 2 * (df + w); } | 1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/b2ed890086e708f00d163f3e8514bfa8b353f662/StrictMath.java/buggy/core/src/classpath/java/java/lang/StrictMath.java |
if (!(x <= 1)) | if (! (x <= 1)) | public static double acos(double x) { boolean negative = x < 0; if (negative) x = -x; if (!(x <= 1)) return Double.NaN; if (x == 1) return negative ? PI : 0; if (x < 0.5) { if (x < 1 / TWO_57) return PI / 2; double z = x * x; double p = z * (PS0 + z * (PS1 + z * (PS2 + z * (PS3 + z * (PS4 + z * PS5))))); double q = 1 + z * (QS1 + z * (QS2 + z * (QS3 + z * QS4))); double r = x - (PI_L / 2 - x * (p / q)); return negative ? PI / 2 + r : PI / 2 - r; } if (negative) // x<=-0.5. { double z = (1 + x) * 0.5; double p = z * (PS0 + z * (PS1 + z * (PS2 + z * (PS3 + z * (PS4 + z * PS5))))); double q = 1 + z * (QS1 + z * (QS2 + z * (QS3 + z * QS4))); double s = sqrt(z); double w = p / q * s - PI_L / 2; return PI - 2 * (s + w); } double z = (1 - x) * 0.5; // x>0.5. double s = sqrt(z); double df = (float) s; double c = (z - df * df) / (s + df); double p = z * (PS0 + z * (PS1 + z * (PS2 + z * (PS3 + z * (PS4 + z * PS5))))); double q = 1 + z * (QS1 + z * (QS2 + z * (QS3 + z * QS4))); double w = p / q * s + c; return 2 * (df + w); } | 1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/b2ed890086e708f00d163f3e8514bfa8b353f662/StrictMath.java/buggy/core/src/classpath/java/java/lang/StrictMath.java |
if (x < 0.5) { | if (x < 0.5) { | public static double acos(double x) { boolean negative = x < 0; if (negative) x = -x; if (!(x <= 1)) return Double.NaN; if (x == 1) return negative ? PI : 0; if (x < 0.5) { if (x < 1 / TWO_57) return PI / 2; double z = x * x; double p = z * (PS0 + z * (PS1 + z * (PS2 + z * (PS3 + z * (PS4 + z * PS5))))); double q = 1 + z * (QS1 + z * (QS2 + z * (QS3 + z * QS4))); double r = x - (PI_L / 2 - x * (p / q)); return negative ? PI / 2 + r : PI / 2 - r; } if (negative) // x<=-0.5. { double z = (1 + x) * 0.5; double p = z * (PS0 + z * (PS1 + z * (PS2 + z * (PS3 + z * (PS4 + z * PS5))))); double q = 1 + z * (QS1 + z * (QS2 + z * (QS3 + z * QS4))); double s = sqrt(z); double w = p / q * s - PI_L / 2; return PI - 2 * (s + w); } double z = (1 - x) * 0.5; // x>0.5. double s = sqrt(z); double df = (float) s; double c = (z - df * df) / (s + df); double p = z * (PS0 + z * (PS1 + z * (PS2 + z * (PS3 + z * (PS4 + z * PS5))))); double q = 1 + z * (QS1 + z * (QS2 + z * (QS3 + z * QS4))); double w = p / q * s + c; return 2 * (df + w); } | 1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/b2ed890086e708f00d163f3e8514bfa8b353f662/StrictMath.java/buggy/core/src/classpath/java/java/lang/StrictMath.java |
double p = z * (PS0 + z * (PS1 + z * (PS2 + z * (PS3 + z * (PS4 + z * PS5))))); | double p = z * (PS0 + z * (PS1 + z * (PS2 + z * (PS3 + z * (PS4 + z * PS5))))); | public static double acos(double x) { boolean negative = x < 0; if (negative) x = -x; if (!(x <= 1)) return Double.NaN; if (x == 1) return negative ? PI : 0; if (x < 0.5) { if (x < 1 / TWO_57) return PI / 2; double z = x * x; double p = z * (PS0 + z * (PS1 + z * (PS2 + z * (PS3 + z * (PS4 + z * PS5))))); double q = 1 + z * (QS1 + z * (QS2 + z * (QS3 + z * QS4))); double r = x - (PI_L / 2 - x * (p / q)); return negative ? PI / 2 + r : PI / 2 - r; } if (negative) // x<=-0.5. { double z = (1 + x) * 0.5; double p = z * (PS0 + z * (PS1 + z * (PS2 + z * (PS3 + z * (PS4 + z * PS5))))); double q = 1 + z * (QS1 + z * (QS2 + z * (QS3 + z * QS4))); double s = sqrt(z); double w = p / q * s - PI_L / 2; return PI - 2 * (s + w); } double z = (1 - x) * 0.5; // x>0.5. double s = sqrt(z); double df = (float) s; double c = (z - df * df) / (s + df); double p = z * (PS0 + z * (PS1 + z * (PS2 + z * (PS3 + z * (PS4 + z * PS5))))); double q = 1 + z * (QS1 + z * (QS2 + z * (QS3 + z * QS4))); double w = p / q * s + c; return 2 * (df + w); } | 1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/b2ed890086e708f00d163f3e8514bfa8b353f662/StrictMath.java/buggy/core/src/classpath/java/java/lang/StrictMath.java |
double p = z * (PS0 + z * (PS1 + z * (PS2 + z * (PS3 + z * (PS4 + z * PS5))))); | double p = z * (PS0 + z * (PS1 + z * (PS2 + z * (PS3 + z * (PS4 + z * PS5))))); | public static double acos(double x) { boolean negative = x < 0; if (negative) x = -x; if (!(x <= 1)) return Double.NaN; if (x == 1) return negative ? PI : 0; if (x < 0.5) { if (x < 1 / TWO_57) return PI / 2; double z = x * x; double p = z * (PS0 + z * (PS1 + z * (PS2 + z * (PS3 + z * (PS4 + z * PS5))))); double q = 1 + z * (QS1 + z * (QS2 + z * (QS3 + z * QS4))); double r = x - (PI_L / 2 - x * (p / q)); return negative ? PI / 2 + r : PI / 2 - r; } if (negative) // x<=-0.5. { double z = (1 + x) * 0.5; double p = z * (PS0 + z * (PS1 + z * (PS2 + z * (PS3 + z * (PS4 + z * PS5))))); double q = 1 + z * (QS1 + z * (QS2 + z * (QS3 + z * QS4))); double s = sqrt(z); double w = p / q * s - PI_L / 2; return PI - 2 * (s + w); } double z = (1 - x) * 0.5; // x>0.5. double s = sqrt(z); double df = (float) s; double c = (z - df * df) / (s + df); double p = z * (PS0 + z * (PS1 + z * (PS2 + z * (PS3 + z * (PS4 + z * PS5))))); double q = 1 + z * (QS1 + z * (QS2 + z * (QS3 + z * QS4))); double w = p / q * s + c; return 2 * (df + w); } | 1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/b2ed890086e708f00d163f3e8514bfa8b353f662/StrictMath.java/buggy/core/src/classpath/java/java/lang/StrictMath.java |
double p = z * (PS0 + z * (PS1 + z * (PS2 + z * (PS3 + z * (PS4 + z * PS5))))); | double p = z * (PS0 + z * (PS1 + z * (PS2 + z * (PS3 + z * (PS4 + z * PS5))))); | public static double acos(double x) { boolean negative = x < 0; if (negative) x = -x; if (!(x <= 1)) return Double.NaN; if (x == 1) return negative ? PI : 0; if (x < 0.5) { if (x < 1 / TWO_57) return PI / 2; double z = x * x; double p = z * (PS0 + z * (PS1 + z * (PS2 + z * (PS3 + z * (PS4 + z * PS5))))); double q = 1 + z * (QS1 + z * (QS2 + z * (QS3 + z * QS4))); double r = x - (PI_L / 2 - x * (p / q)); return negative ? PI / 2 + r : PI / 2 - r; } if (negative) // x<=-0.5. { double z = (1 + x) * 0.5; double p = z * (PS0 + z * (PS1 + z * (PS2 + z * (PS3 + z * (PS4 + z * PS5))))); double q = 1 + z * (QS1 + z * (QS2 + z * (QS3 + z * QS4))); double s = sqrt(z); double w = p / q * s - PI_L / 2; return PI - 2 * (s + w); } double z = (1 - x) * 0.5; // x>0.5. double s = sqrt(z); double df = (float) s; double c = (z - df * df) / (s + df); double p = z * (PS0 + z * (PS1 + z * (PS2 + z * (PS3 + z * (PS4 + z * PS5))))); double q = 1 + z * (QS1 + z * (QS2 + z * (QS3 + z * QS4))); double w = p / q * s + c; return 2 * (df + w); } | 1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/b2ed890086e708f00d163f3e8514bfa8b353f662/StrictMath.java/buggy/core/src/classpath/java/java/lang/StrictMath.java |
public static double asin(double x) { | public static double asin(double x) { | public static double asin(double x) { boolean negative = x < 0; if (negative) x = -x; if (!(x <= 1)) return Double.NaN; if (x == 1) return negative ? -PI / 2 : PI / 2; if (x < 0.5) { if (x < 1 / TWO_27) return negative ? -x : x; double t = x * x; double p = t * (PS0 + t * (PS1 + t * (PS2 + t * (PS3 + t * (PS4 + t * PS5))))); double q = 1 + t * (QS1 + t * (QS2 + t * (QS3 + t * QS4))); return negative ? -x - x * (p / q) : x + x * (p / q); } double w = 1 - x; // 1>|x|>=0.5. double t = w * 0.5; double p = t * (PS0 + t * (PS1 + t * (PS2 + t * (PS3 + t * (PS4 + t * PS5))))); double q = 1 + t * (QS1 + t * (QS2 + t * (QS3 + t * QS4))); double s = sqrt(t); if (x >= 0.975) { w = p / q; t = PI / 2 - (2 * (s + s * w) - PI_L / 2); } else { w = (float) s; double c = (t - w * w) / (s + w); p = 2 * s * (p / q) - (PI_L / 2 - 2 * c); q = PI / 4 - 2 * w; t = PI / 4 - (p - q); } return negative ? -t : t; } | 1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/b2ed890086e708f00d163f3e8514bfa8b353f662/StrictMath.java/buggy/core/src/classpath/java/java/lang/StrictMath.java |
if (!(x <= 1)) | if (! (x <= 1)) | public static double asin(double x) { boolean negative = x < 0; if (negative) x = -x; if (!(x <= 1)) return Double.NaN; if (x == 1) return negative ? -PI / 2 : PI / 2; if (x < 0.5) { if (x < 1 / TWO_27) return negative ? -x : x; double t = x * x; double p = t * (PS0 + t * (PS1 + t * (PS2 + t * (PS3 + t * (PS4 + t * PS5))))); double q = 1 + t * (QS1 + t * (QS2 + t * (QS3 + t * QS4))); return negative ? -x - x * (p / q) : x + x * (p / q); } double w = 1 - x; // 1>|x|>=0.5. double t = w * 0.5; double p = t * (PS0 + t * (PS1 + t * (PS2 + t * (PS3 + t * (PS4 + t * PS5))))); double q = 1 + t * (QS1 + t * (QS2 + t * (QS3 + t * QS4))); double s = sqrt(t); if (x >= 0.975) { w = p / q; t = PI / 2 - (2 * (s + s * w) - PI_L / 2); } else { w = (float) s; double c = (t - w * w) / (s + w); p = 2 * s * (p / q) - (PI_L / 2 - 2 * c); q = PI / 4 - 2 * w; t = PI / 4 - (p - q); } return negative ? -t : t; } | 1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/b2ed890086e708f00d163f3e8514bfa8b353f662/StrictMath.java/buggy/core/src/classpath/java/java/lang/StrictMath.java |
if (x < 0.5) { | if (x < 0.5) { | public static double asin(double x) { boolean negative = x < 0; if (negative) x = -x; if (!(x <= 1)) return Double.NaN; if (x == 1) return negative ? -PI / 2 : PI / 2; if (x < 0.5) { if (x < 1 / TWO_27) return negative ? -x : x; double t = x * x; double p = t * (PS0 + t * (PS1 + t * (PS2 + t * (PS3 + t * (PS4 + t * PS5))))); double q = 1 + t * (QS1 + t * (QS2 + t * (QS3 + t * QS4))); return negative ? -x - x * (p / q) : x + x * (p / q); } double w = 1 - x; // 1>|x|>=0.5. double t = w * 0.5; double p = t * (PS0 + t * (PS1 + t * (PS2 + t * (PS3 + t * (PS4 + t * PS5))))); double q = 1 + t * (QS1 + t * (QS2 + t * (QS3 + t * QS4))); double s = sqrt(t); if (x >= 0.975) { w = p / q; t = PI / 2 - (2 * (s + s * w) - PI_L / 2); } else { w = (float) s; double c = (t - w * w) / (s + w); p = 2 * s * (p / q) - (PI_L / 2 - 2 * c); q = PI / 4 - 2 * w; t = PI / 4 - (p - q); } return negative ? -t : t; } | 1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/b2ed890086e708f00d163f3e8514bfa8b353f662/StrictMath.java/buggy/core/src/classpath/java/java/lang/StrictMath.java |
double p = t * (PS0 + t * (PS1 + t * (PS2 + t * (PS3 + t * (PS4 + t * PS5))))); | double p = t * (PS0 + t * (PS1 + t * (PS2 + t * (PS3 + t * (PS4 + t * PS5))))); | public static double asin(double x) { boolean negative = x < 0; if (negative) x = -x; if (!(x <= 1)) return Double.NaN; if (x == 1) return negative ? -PI / 2 : PI / 2; if (x < 0.5) { if (x < 1 / TWO_27) return negative ? -x : x; double t = x * x; double p = t * (PS0 + t * (PS1 + t * (PS2 + t * (PS3 + t * (PS4 + t * PS5))))); double q = 1 + t * (QS1 + t * (QS2 + t * (QS3 + t * QS4))); return negative ? -x - x * (p / q) : x + x * (p / q); } double w = 1 - x; // 1>|x|>=0.5. double t = w * 0.5; double p = t * (PS0 + t * (PS1 + t * (PS2 + t * (PS3 + t * (PS4 + t * PS5))))); double q = 1 + t * (QS1 + t * (QS2 + t * (QS3 + t * QS4))); double s = sqrt(t); if (x >= 0.975) { w = p / q; t = PI / 2 - (2 * (s + s * w) - PI_L / 2); } else { w = (float) s; double c = (t - w * w) / (s + w); p = 2 * s * (p / q) - (PI_L / 2 - 2 * c); q = PI / 4 - 2 * w; t = PI / 4 - (p - q); } return negative ? -t : t; } | 1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/b2ed890086e708f00d163f3e8514bfa8b353f662/StrictMath.java/buggy/core/src/classpath/java/java/lang/StrictMath.java |
double p = t * (PS0 + t * (PS1 + t * (PS2 + t * (PS3 + t * (PS4 + t * PS5))))); | double p = t * (PS0 + t * (PS1 + t * (PS2 + t * (PS3 + t * (PS4 + t * PS5))))); | public static double asin(double x) { boolean negative = x < 0; if (negative) x = -x; if (!(x <= 1)) return Double.NaN; if (x == 1) return negative ? -PI / 2 : PI / 2; if (x < 0.5) { if (x < 1 / TWO_27) return negative ? -x : x; double t = x * x; double p = t * (PS0 + t * (PS1 + t * (PS2 + t * (PS3 + t * (PS4 + t * PS5))))); double q = 1 + t * (QS1 + t * (QS2 + t * (QS3 + t * QS4))); return negative ? -x - x * (p / q) : x + x * (p / q); } double w = 1 - x; // 1>|x|>=0.5. double t = w * 0.5; double p = t * (PS0 + t * (PS1 + t * (PS2 + t * (PS3 + t * (PS4 + t * PS5))))); double q = 1 + t * (QS1 + t * (QS2 + t * (QS3 + t * QS4))); double s = sqrt(t); if (x >= 0.975) { w = p / q; t = PI / 2 - (2 * (s + s * w) - PI_L / 2); } else { w = (float) s; double c = (t - w * w) / (s + w); p = 2 * s * (p / q) - (PI_L / 2 - 2 * c); q = PI / 4 - 2 * w; t = PI / 4 - (p - q); } return negative ? -t : t; } | 1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/b2ed890086e708f00d163f3e8514bfa8b353f662/StrictMath.java/buggy/core/src/classpath/java/java/lang/StrictMath.java |
if (x >= 0.975) { | if (x >= 0.975) { | public static double asin(double x) { boolean negative = x < 0; if (negative) x = -x; if (!(x <= 1)) return Double.NaN; if (x == 1) return negative ? -PI / 2 : PI / 2; if (x < 0.5) { if (x < 1 / TWO_27) return negative ? -x : x; double t = x * x; double p = t * (PS0 + t * (PS1 + t * (PS2 + t * (PS3 + t * (PS4 + t * PS5))))); double q = 1 + t * (QS1 + t * (QS2 + t * (QS3 + t * QS4))); return negative ? -x - x * (p / q) : x + x * (p / q); } double w = 1 - x; // 1>|x|>=0.5. double t = w * 0.5; double p = t * (PS0 + t * (PS1 + t * (PS2 + t * (PS3 + t * (PS4 + t * PS5))))); double q = 1 + t * (QS1 + t * (QS2 + t * (QS3 + t * QS4))); double s = sqrt(t); if (x >= 0.975) { w = p / q; t = PI / 2 - (2 * (s + s * w) - PI_L / 2); } else { w = (float) s; double c = (t - w * w) / (s + w); p = 2 * s * (p / q) - (PI_L / 2 - 2 * c); q = PI / 4 - 2 * w; t = PI / 4 - (p - q); } return negative ? -t : t; } | 1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/b2ed890086e708f00d163f3e8514bfa8b353f662/StrictMath.java/buggy/core/src/classpath/java/java/lang/StrictMath.java |
} else { | } else { | public static double asin(double x) { boolean negative = x < 0; if (negative) x = -x; if (!(x <= 1)) return Double.NaN; if (x == 1) return negative ? -PI / 2 : PI / 2; if (x < 0.5) { if (x < 1 / TWO_27) return negative ? -x : x; double t = x * x; double p = t * (PS0 + t * (PS1 + t * (PS2 + t * (PS3 + t * (PS4 + t * PS5))))); double q = 1 + t * (QS1 + t * (QS2 + t * (QS3 + t * QS4))); return negative ? -x - x * (p / q) : x + x * (p / q); } double w = 1 - x; // 1>|x|>=0.5. double t = w * 0.5; double p = t * (PS0 + t * (PS1 + t * (PS2 + t * (PS3 + t * (PS4 + t * PS5))))); double q = 1 + t * (QS1 + t * (QS2 + t * (QS3 + t * QS4))); double s = sqrt(t); if (x >= 0.975) { w = p / q; t = PI / 2 - (2 * (s + s * w) - PI_L / 2); } else { w = (float) s; double c = (t - w * w) / (s + w); p = 2 * s * (p / q) - (PI_L / 2 - 2 * c); q = PI / 4 - 2 * w; t = PI / 4 - (p - q); } return negative ? -t : t; } | 1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/b2ed890086e708f00d163f3e8514bfa8b353f662/StrictMath.java/buggy/core/src/classpath/java/java/lang/StrictMath.java |
public static double atan(double x) { | public static double atan(double x) { | public static double atan(double x) { double lo; double hi; boolean negative = x < 0; if (negative) x = -x; if (x >= TWO_66) return negative ? -PI / 2 : PI / 2; if (!(x >= 0.4375)) // |x|<7/16, or NaN. { if (!(x >= 1 / TWO_29)) // Small, or NaN. return negative ? -x : x; lo = hi = 0; } else if (x < 1.1875) { if (x < 0.6875) // 7/16<=|x|<11/16. { x = (2 * x - 1) / (2 + x); hi = ATAN_0_5H; lo = ATAN_0_5L; } else // 11/16<=|x|<19/16. { x = (x - 1) / (x + 1); hi = PI / 4; lo = PI_L / 4; } } else if (x < 2.4375) // 19/16<=|x|<39/16. { x = (x - 1.5) / (1 + 1.5 * x); hi = ATAN_1_5H; lo = ATAN_1_5L; } else // 39/16<=|x|<2**66. { x = -1 / x; hi = PI / 2; lo = PI_L / 2; } // Break sum from i=0 to 10 ATi*z**(i+1) into odd and even poly. double z = x * x; double w = z * z; double s1 = z * (AT0 + w * (AT2 + w * (AT4 + w * (AT6 + w * (AT8 + w * AT10))))); double s2 = w * (AT1 + w * (AT3 + w * (AT5 + w * (AT7 + w * AT9)))); if (hi == 0) return negative ? x * (s1 + s2) - x : x - x * (s1 + s2); z = hi - ((x * (s1 + s2) - lo) - x); return negative ? -z : z; } | 1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/b2ed890086e708f00d163f3e8514bfa8b353f662/StrictMath.java/buggy/core/src/classpath/java/java/lang/StrictMath.java |
if (!(x >= 0.4375)) | if (! (x >= 0.4375)) | public static double atan(double x) { double lo; double hi; boolean negative = x < 0; if (negative) x = -x; if (x >= TWO_66) return negative ? -PI / 2 : PI / 2; if (!(x >= 0.4375)) // |x|<7/16, or NaN. { if (!(x >= 1 / TWO_29)) // Small, or NaN. return negative ? -x : x; lo = hi = 0; } else if (x < 1.1875) { if (x < 0.6875) // 7/16<=|x|<11/16. { x = (2 * x - 1) / (2 + x); hi = ATAN_0_5H; lo = ATAN_0_5L; } else // 11/16<=|x|<19/16. { x = (x - 1) / (x + 1); hi = PI / 4; lo = PI_L / 4; } } else if (x < 2.4375) // 19/16<=|x|<39/16. { x = (x - 1.5) / (1 + 1.5 * x); hi = ATAN_1_5H; lo = ATAN_1_5L; } else // 39/16<=|x|<2**66. { x = -1 / x; hi = PI / 2; lo = PI_L / 2; } // Break sum from i=0 to 10 ATi*z**(i+1) into odd and even poly. double z = x * x; double w = z * z; double s1 = z * (AT0 + w * (AT2 + w * (AT4 + w * (AT6 + w * (AT8 + w * AT10))))); double s2 = w * (AT1 + w * (AT3 + w * (AT5 + w * (AT7 + w * AT9)))); if (hi == 0) return negative ? x * (s1 + s2) - x : x - x * (s1 + s2); z = hi - ((x * (s1 + s2) - lo) - x); return negative ? -z : z; } | 1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/b2ed890086e708f00d163f3e8514bfa8b353f662/StrictMath.java/buggy/core/src/classpath/java/java/lang/StrictMath.java |
if (!(x >= 1 / TWO_29)) | if (! (x >= 1 / TWO_29)) | public static double atan(double x) { double lo; double hi; boolean negative = x < 0; if (negative) x = -x; if (x >= TWO_66) return negative ? -PI / 2 : PI / 2; if (!(x >= 0.4375)) // |x|<7/16, or NaN. { if (!(x >= 1 / TWO_29)) // Small, or NaN. return negative ? -x : x; lo = hi = 0; } else if (x < 1.1875) { if (x < 0.6875) // 7/16<=|x|<11/16. { x = (2 * x - 1) / (2 + x); hi = ATAN_0_5H; lo = ATAN_0_5L; } else // 11/16<=|x|<19/16. { x = (x - 1) / (x + 1); hi = PI / 4; lo = PI_L / 4; } } else if (x < 2.4375) // 19/16<=|x|<39/16. { x = (x - 1.5) / (1 + 1.5 * x); hi = ATAN_1_5H; lo = ATAN_1_5L; } else // 39/16<=|x|<2**66. { x = -1 / x; hi = PI / 2; lo = PI_L / 2; } // Break sum from i=0 to 10 ATi*z**(i+1) into odd and even poly. double z = x * x; double w = z * z; double s1 = z * (AT0 + w * (AT2 + w * (AT4 + w * (AT6 + w * (AT8 + w * AT10))))); double s2 = w * (AT1 + w * (AT3 + w * (AT5 + w * (AT7 + w * AT9)))); if (hi == 0) return negative ? x * (s1 + s2) - x : x - x * (s1 + s2); z = hi - ((x * (s1 + s2) - lo) - x); return negative ? -z : z; } | 1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/b2ed890086e708f00d163f3e8514bfa8b353f662/StrictMath.java/buggy/core/src/classpath/java/java/lang/StrictMath.java |
} else if (x < 1.1875) { | } else if (x < 1.1875) { | public static double atan(double x) { double lo; double hi; boolean negative = x < 0; if (negative) x = -x; if (x >= TWO_66) return negative ? -PI / 2 : PI / 2; if (!(x >= 0.4375)) // |x|<7/16, or NaN. { if (!(x >= 1 / TWO_29)) // Small, or NaN. return negative ? -x : x; lo = hi = 0; } else if (x < 1.1875) { if (x < 0.6875) // 7/16<=|x|<11/16. { x = (2 * x - 1) / (2 + x); hi = ATAN_0_5H; lo = ATAN_0_5L; } else // 11/16<=|x|<19/16. { x = (x - 1) / (x + 1); hi = PI / 4; lo = PI_L / 4; } } else if (x < 2.4375) // 19/16<=|x|<39/16. { x = (x - 1.5) / (1 + 1.5 * x); hi = ATAN_1_5H; lo = ATAN_1_5L; } else // 39/16<=|x|<2**66. { x = -1 / x; hi = PI / 2; lo = PI_L / 2; } // Break sum from i=0 to 10 ATi*z**(i+1) into odd and even poly. double z = x * x; double w = z * z; double s1 = z * (AT0 + w * (AT2 + w * (AT4 + w * (AT6 + w * (AT8 + w * AT10))))); double s2 = w * (AT1 + w * (AT3 + w * (AT5 + w * (AT7 + w * AT9)))); if (hi == 0) return negative ? x * (s1 + s2) - x : x - x * (s1 + s2); z = hi - ((x * (s1 + s2) - lo) - x); return negative ? -z : z; } | 1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/b2ed890086e708f00d163f3e8514bfa8b353f662/StrictMath.java/buggy/core/src/classpath/java/java/lang/StrictMath.java |
} else | } else | public static double atan(double x) { double lo; double hi; boolean negative = x < 0; if (negative) x = -x; if (x >= TWO_66) return negative ? -PI / 2 : PI / 2; if (!(x >= 0.4375)) // |x|<7/16, or NaN. { if (!(x >= 1 / TWO_29)) // Small, or NaN. return negative ? -x : x; lo = hi = 0; } else if (x < 1.1875) { if (x < 0.6875) // 7/16<=|x|<11/16. { x = (2 * x - 1) / (2 + x); hi = ATAN_0_5H; lo = ATAN_0_5L; } else // 11/16<=|x|<19/16. { x = (x - 1) / (x + 1); hi = PI / 4; lo = PI_L / 4; } } else if (x < 2.4375) // 19/16<=|x|<39/16. { x = (x - 1.5) / (1 + 1.5 * x); hi = ATAN_1_5H; lo = ATAN_1_5L; } else // 39/16<=|x|<2**66. { x = -1 / x; hi = PI / 2; lo = PI_L / 2; } // Break sum from i=0 to 10 ATi*z**(i+1) into odd and even poly. double z = x * x; double w = z * z; double s1 = z * (AT0 + w * (AT2 + w * (AT4 + w * (AT6 + w * (AT8 + w * AT10))))); double s2 = w * (AT1 + w * (AT3 + w * (AT5 + w * (AT7 + w * AT9)))); if (hi == 0) return negative ? x * (s1 + s2) - x : x - x * (s1 + s2); z = hi - ((x * (s1 + s2) - lo) - x); return negative ? -z : z; } | 1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/b2ed890086e708f00d163f3e8514bfa8b353f662/StrictMath.java/buggy/core/src/classpath/java/java/lang/StrictMath.java |
} else if (x < 2.4375) | } else if (x < 2.4375) | public static double atan(double x) { double lo; double hi; boolean negative = x < 0; if (negative) x = -x; if (x >= TWO_66) return negative ? -PI / 2 : PI / 2; if (!(x >= 0.4375)) // |x|<7/16, or NaN. { if (!(x >= 1 / TWO_29)) // Small, or NaN. return negative ? -x : x; lo = hi = 0; } else if (x < 1.1875) { if (x < 0.6875) // 7/16<=|x|<11/16. { x = (2 * x - 1) / (2 + x); hi = ATAN_0_5H; lo = ATAN_0_5L; } else // 11/16<=|x|<19/16. { x = (x - 1) / (x + 1); hi = PI / 4; lo = PI_L / 4; } } else if (x < 2.4375) // 19/16<=|x|<39/16. { x = (x - 1.5) / (1 + 1.5 * x); hi = ATAN_1_5H; lo = ATAN_1_5L; } else // 39/16<=|x|<2**66. { x = -1 / x; hi = PI / 2; lo = PI_L / 2; } // Break sum from i=0 to 10 ATi*z**(i+1) into odd and even poly. double z = x * x; double w = z * z; double s1 = z * (AT0 + w * (AT2 + w * (AT4 + w * (AT6 + w * (AT8 + w * AT10))))); double s2 = w * (AT1 + w * (AT3 + w * (AT5 + w * (AT7 + w * AT9)))); if (hi == 0) return negative ? x * (s1 + s2) - x : x - x * (s1 + s2); z = hi - ((x * (s1 + s2) - lo) - x); return negative ? -z : z; } | 1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/b2ed890086e708f00d163f3e8514bfa8b353f662/StrictMath.java/buggy/core/src/classpath/java/java/lang/StrictMath.java |
} else | } else | public static double atan(double x) { double lo; double hi; boolean negative = x < 0; if (negative) x = -x; if (x >= TWO_66) return negative ? -PI / 2 : PI / 2; if (!(x >= 0.4375)) // |x|<7/16, or NaN. { if (!(x >= 1 / TWO_29)) // Small, or NaN. return negative ? -x : x; lo = hi = 0; } else if (x < 1.1875) { if (x < 0.6875) // 7/16<=|x|<11/16. { x = (2 * x - 1) / (2 + x); hi = ATAN_0_5H; lo = ATAN_0_5L; } else // 11/16<=|x|<19/16. { x = (x - 1) / (x + 1); hi = PI / 4; lo = PI_L / 4; } } else if (x < 2.4375) // 19/16<=|x|<39/16. { x = (x - 1.5) / (1 + 1.5 * x); hi = ATAN_1_5H; lo = ATAN_1_5L; } else // 39/16<=|x|<2**66. { x = -1 / x; hi = PI / 2; lo = PI_L / 2; } // Break sum from i=0 to 10 ATi*z**(i+1) into odd and even poly. double z = x * x; double w = z * z; double s1 = z * (AT0 + w * (AT2 + w * (AT4 + w * (AT6 + w * (AT8 + w * AT10))))); double s2 = w * (AT1 + w * (AT3 + w * (AT5 + w * (AT7 + w * AT9)))); if (hi == 0) return negative ? x * (s1 + s2) - x : x - x * (s1 + s2); z = hi - ((x * (s1 + s2) - lo) - x); return negative ? -z : z; } | 1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/b2ed890086e708f00d163f3e8514bfa8b353f662/StrictMath.java/buggy/core/src/classpath/java/java/lang/StrictMath.java |
double s1 = z * (AT0 + w * (AT2 + w * (AT4 + w * (AT6 + w * (AT8 + w * AT10))))); | double s1 = z * (AT0 + w * (AT2 + w * (AT4 + w * (AT6 + w * (AT8 + w * AT10))))); | public static double atan(double x) { double lo; double hi; boolean negative = x < 0; if (negative) x = -x; if (x >= TWO_66) return negative ? -PI / 2 : PI / 2; if (!(x >= 0.4375)) // |x|<7/16, or NaN. { if (!(x >= 1 / TWO_29)) // Small, or NaN. return negative ? -x : x; lo = hi = 0; } else if (x < 1.1875) { if (x < 0.6875) // 7/16<=|x|<11/16. { x = (2 * x - 1) / (2 + x); hi = ATAN_0_5H; lo = ATAN_0_5L; } else // 11/16<=|x|<19/16. { x = (x - 1) / (x + 1); hi = PI / 4; lo = PI_L / 4; } } else if (x < 2.4375) // 19/16<=|x|<39/16. { x = (x - 1.5) / (1 + 1.5 * x); hi = ATAN_1_5H; lo = ATAN_1_5L; } else // 39/16<=|x|<2**66. { x = -1 / x; hi = PI / 2; lo = PI_L / 2; } // Break sum from i=0 to 10 ATi*z**(i+1) into odd and even poly. double z = x * x; double w = z * z; double s1 = z * (AT0 + w * (AT2 + w * (AT4 + w * (AT6 + w * (AT8 + w * AT10))))); double s2 = w * (AT1 + w * (AT3 + w * (AT5 + w * (AT7 + w * AT9)))); if (hi == 0) return negative ? x * (s1 + s2) - x : x - x * (s1 + s2); z = hi - ((x * (s1 + s2) - lo) - x); return negative ? -z : z; } | 1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/b2ed890086e708f00d163f3e8514bfa8b353f662/StrictMath.java/buggy/core/src/classpath/java/java/lang/StrictMath.java |
public static double atan2(double y, double x) { | public static double atan2(double y, double x) { | public static double atan2(double y, double x) { if (x != x || y != y) return Double.NaN; if (x == 1) return atan(y); if (x == Double.POSITIVE_INFINITY) { if (y == Double.POSITIVE_INFINITY) return PI / 4; if (y == Double.NEGATIVE_INFINITY) return -PI / 4; return 0 * y; } if (x == Double.NEGATIVE_INFINITY) { if (y == Double.POSITIVE_INFINITY) return 3 * PI / 4; if (y == Double.NEGATIVE_INFINITY) return -3 * PI / 4; return (1 / (0 * y) == Double.POSITIVE_INFINITY) ? PI : -PI; } if (y == 0) { if (1 / (0 * x) == Double.POSITIVE_INFINITY) return y; return (1 / y == Double.POSITIVE_INFINITY) ? PI : -PI; } if (y == Double.POSITIVE_INFINITY || y == Double.NEGATIVE_INFINITY || x == 0) return y < 0 ? -PI / 2 : PI / 2; double z = abs(y / x); // Safe to do y/x. if (z > TWO_60) z = PI / 2 + 0.5 * PI_L; else if (x < 0 && z < 1 / TWO_60) z = 0; else z = atan(z); if (x > 0) return y > 0 ? z : -z; return y > 0 ? PI - (z - PI_L) : z - PI_L - PI; } | 1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/b2ed890086e708f00d163f3e8514bfa8b353f662/StrictMath.java/buggy/core/src/classpath/java/java/lang/StrictMath.java |
if (x == Double.POSITIVE_INFINITY) { | if (x == Double.POSITIVE_INFINITY) { | public static double atan2(double y, double x) { if (x != x || y != y) return Double.NaN; if (x == 1) return atan(y); if (x == Double.POSITIVE_INFINITY) { if (y == Double.POSITIVE_INFINITY) return PI / 4; if (y == Double.NEGATIVE_INFINITY) return -PI / 4; return 0 * y; } if (x == Double.NEGATIVE_INFINITY) { if (y == Double.POSITIVE_INFINITY) return 3 * PI / 4; if (y == Double.NEGATIVE_INFINITY) return -3 * PI / 4; return (1 / (0 * y) == Double.POSITIVE_INFINITY) ? PI : -PI; } if (y == 0) { if (1 / (0 * x) == Double.POSITIVE_INFINITY) return y; return (1 / y == Double.POSITIVE_INFINITY) ? PI : -PI; } if (y == Double.POSITIVE_INFINITY || y == Double.NEGATIVE_INFINITY || x == 0) return y < 0 ? -PI / 2 : PI / 2; double z = abs(y / x); // Safe to do y/x. if (z > TWO_60) z = PI / 2 + 0.5 * PI_L; else if (x < 0 && z < 1 / TWO_60) z = 0; else z = atan(z); if (x > 0) return y > 0 ? z : -z; return y > 0 ? PI - (z - PI_L) : z - PI_L - PI; } | 1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/b2ed890086e708f00d163f3e8514bfa8b353f662/StrictMath.java/buggy/core/src/classpath/java/java/lang/StrictMath.java |
if (x == Double.NEGATIVE_INFINITY) { | if (x == Double.NEGATIVE_INFINITY) { | public static double atan2(double y, double x) { if (x != x || y != y) return Double.NaN; if (x == 1) return atan(y); if (x == Double.POSITIVE_INFINITY) { if (y == Double.POSITIVE_INFINITY) return PI / 4; if (y == Double.NEGATIVE_INFINITY) return -PI / 4; return 0 * y; } if (x == Double.NEGATIVE_INFINITY) { if (y == Double.POSITIVE_INFINITY) return 3 * PI / 4; if (y == Double.NEGATIVE_INFINITY) return -3 * PI / 4; return (1 / (0 * y) == Double.POSITIVE_INFINITY) ? PI : -PI; } if (y == 0) { if (1 / (0 * x) == Double.POSITIVE_INFINITY) return y; return (1 / y == Double.POSITIVE_INFINITY) ? PI : -PI; } if (y == Double.POSITIVE_INFINITY || y == Double.NEGATIVE_INFINITY || x == 0) return y < 0 ? -PI / 2 : PI / 2; double z = abs(y / x); // Safe to do y/x. if (z > TWO_60) z = PI / 2 + 0.5 * PI_L; else if (x < 0 && z < 1 / TWO_60) z = 0; else z = atan(z); if (x > 0) return y > 0 ? z : -z; return y > 0 ? PI - (z - PI_L) : z - PI_L - PI; } | 1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/b2ed890086e708f00d163f3e8514bfa8b353f662/StrictMath.java/buggy/core/src/classpath/java/java/lang/StrictMath.java |
if (y == 0) { | if (y == 0) { | public static double atan2(double y, double x) { if (x != x || y != y) return Double.NaN; if (x == 1) return atan(y); if (x == Double.POSITIVE_INFINITY) { if (y == Double.POSITIVE_INFINITY) return PI / 4; if (y == Double.NEGATIVE_INFINITY) return -PI / 4; return 0 * y; } if (x == Double.NEGATIVE_INFINITY) { if (y == Double.POSITIVE_INFINITY) return 3 * PI / 4; if (y == Double.NEGATIVE_INFINITY) return -3 * PI / 4; return (1 / (0 * y) == Double.POSITIVE_INFINITY) ? PI : -PI; } if (y == 0) { if (1 / (0 * x) == Double.POSITIVE_INFINITY) return y; return (1 / y == Double.POSITIVE_INFINITY) ? PI : -PI; } if (y == Double.POSITIVE_INFINITY || y == Double.NEGATIVE_INFINITY || x == 0) return y < 0 ? -PI / 2 : PI / 2; double z = abs(y / x); // Safe to do y/x. if (z > TWO_60) z = PI / 2 + 0.5 * PI_L; else if (x < 0 && z < 1 / TWO_60) z = 0; else z = atan(z); if (x > 0) return y > 0 ? z : -z; return y > 0 ? PI - (z - PI_L) : z - PI_L - PI; } | 1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/b2ed890086e708f00d163f3e8514bfa8b353f662/StrictMath.java/buggy/core/src/classpath/java/java/lang/StrictMath.java |
if (y == Double.POSITIVE_INFINITY || y == Double.NEGATIVE_INFINITY || x == 0) | if (y == Double.POSITIVE_INFINITY || y == Double.NEGATIVE_INFINITY || x == 0) | public static double atan2(double y, double x) { if (x != x || y != y) return Double.NaN; if (x == 1) return atan(y); if (x == Double.POSITIVE_INFINITY) { if (y == Double.POSITIVE_INFINITY) return PI / 4; if (y == Double.NEGATIVE_INFINITY) return -PI / 4; return 0 * y; } if (x == Double.NEGATIVE_INFINITY) { if (y == Double.POSITIVE_INFINITY) return 3 * PI / 4; if (y == Double.NEGATIVE_INFINITY) return -3 * PI / 4; return (1 / (0 * y) == Double.POSITIVE_INFINITY) ? PI : -PI; } if (y == 0) { if (1 / (0 * x) == Double.POSITIVE_INFINITY) return y; return (1 / y == Double.POSITIVE_INFINITY) ? PI : -PI; } if (y == Double.POSITIVE_INFINITY || y == Double.NEGATIVE_INFINITY || x == 0) return y < 0 ? -PI / 2 : PI / 2; double z = abs(y / x); // Safe to do y/x. if (z > TWO_60) z = PI / 2 + 0.5 * PI_L; else if (x < 0 && z < 1 / TWO_60) z = 0; else z = atan(z); if (x > 0) return y > 0 ? z : -z; return y > 0 ? PI - (z - PI_L) : z - PI_L - PI; } | 1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/b2ed890086e708f00d163f3e8514bfa8b353f662/StrictMath.java/buggy/core/src/classpath/java/java/lang/StrictMath.java |
public static double ceil(double a) { | public static double ceil(double a) { | public static double ceil(double a) { return -floor(-a); } | 1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/b2ed890086e708f00d163f3e8514bfa8b353f662/StrictMath.java/buggy/core/src/classpath/java/java/lang/StrictMath.java |
public static double cos(double a) { if (a == Double.NEGATIVE_INFINITY || !(a < Double.POSITIVE_INFINITY)) | public static double cos(double a) { if (a == Double.NEGATIVE_INFINITY || ! (a < Double.POSITIVE_INFINITY)) | public static double cos(double a) { if (a == Double.NEGATIVE_INFINITY || !(a < Double.POSITIVE_INFINITY)) return Double.NaN; if (abs(a) <= PI / 4) return cos(a, 0); // Argument reduction needed. double[] y = new double[2]; int n = remPiOver2(a, y); switch (n & 3) { case 0 : return cos(y[0], y[1]); case 1 : return -sin(y[0], y[1]); case 2 : return -cos(y[0], y[1]); default : return sin(y[0], y[1]); } } | 1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/b2ed890086e708f00d163f3e8514bfa8b353f662/StrictMath.java/buggy/core/src/classpath/java/java/lang/StrictMath.java |
switch (n & 3) { case 0 : | switch (n & 3) { case 0: | public static double cos(double a) { if (a == Double.NEGATIVE_INFINITY || !(a < Double.POSITIVE_INFINITY)) return Double.NaN; if (abs(a) <= PI / 4) return cos(a, 0); // Argument reduction needed. double[] y = new double[2]; int n = remPiOver2(a, y); switch (n & 3) { case 0 : return cos(y[0], y[1]); case 1 : return -sin(y[0], y[1]); case 2 : return -cos(y[0], y[1]); default : return sin(y[0], y[1]); } } | 1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/b2ed890086e708f00d163f3e8514bfa8b353f662/StrictMath.java/buggy/core/src/classpath/java/java/lang/StrictMath.java |
case 1 : | case 1: | public static double cos(double a) { if (a == Double.NEGATIVE_INFINITY || !(a < Double.POSITIVE_INFINITY)) return Double.NaN; if (abs(a) <= PI / 4) return cos(a, 0); // Argument reduction needed. double[] y = new double[2]; int n = remPiOver2(a, y); switch (n & 3) { case 0 : return cos(y[0], y[1]); case 1 : return -sin(y[0], y[1]); case 2 : return -cos(y[0], y[1]); default : return sin(y[0], y[1]); } } | 1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/b2ed890086e708f00d163f3e8514bfa8b353f662/StrictMath.java/buggy/core/src/classpath/java/java/lang/StrictMath.java |
case 2 : | case 2: | public static double cos(double a) { if (a == Double.NEGATIVE_INFINITY || !(a < Double.POSITIVE_INFINITY)) return Double.NaN; if (abs(a) <= PI / 4) return cos(a, 0); // Argument reduction needed. double[] y = new double[2]; int n = remPiOver2(a, y); switch (n & 3) { case 0 : return cos(y[0], y[1]); case 1 : return -sin(y[0], y[1]); case 2 : return -cos(y[0], y[1]); default : return sin(y[0], y[1]); } } | 1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/b2ed890086e708f00d163f3e8514bfa8b353f662/StrictMath.java/buggy/core/src/classpath/java/java/lang/StrictMath.java |
default : | default: | public static double cos(double a) { if (a == Double.NEGATIVE_INFINITY || !(a < Double.POSITIVE_INFINITY)) return Double.NaN; if (abs(a) <= PI / 4) return cos(a, 0); // Argument reduction needed. double[] y = new double[2]; int n = remPiOver2(a, y); switch (n & 3) { case 0 : return cos(y[0], y[1]); case 1 : return -sin(y[0], y[1]); case 2 : return -cos(y[0], y[1]); default : return sin(y[0], y[1]); } } | 1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/b2ed890086e708f00d163f3e8514bfa8b353f662/StrictMath.java/buggy/core/src/classpath/java/java/lang/StrictMath.java |
public static double exp(double x) { | public static double exp(double x) { | public static double exp(double x) { if (x != x) return x; if (x > EXP_LIMIT_H) return Double.POSITIVE_INFINITY; if (x < EXP_LIMIT_L) return 0; // Argument reduction. double hi; double lo; int k; double t = abs(x); if (t > 0.5 * LN2) { if (t < 1.5 * LN2) { hi = t - LN2_H; lo = LN2_L; k = 1; } else { k = (int) (INV_LN2 * t + 0.5); hi = t - k * LN2_H; lo = k * LN2_L; } if (x < 0) { hi = -hi; lo = -lo; k = -k; } x = hi - lo; } else if (t < 1 / TWO_28) return 1; else lo = hi = k = 0; // Now x is in primary range. t = x * x; double c = x - t * (P1 + t * (P2 + t * (P3 + t * (P4 + t * P5)))); if (k == 0) return 1 - (x * c / (c - 2) - x); double y = 1 - (lo - x * c / (2 - c) - hi); return scale(y, k); } | 1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/b2ed890086e708f00d163f3e8514bfa8b353f662/StrictMath.java/buggy/core/src/classpath/java/java/lang/StrictMath.java |
if (t > 0.5 * LN2) { if (t < 1.5 * LN2) { | if (t > 0.5 * LN2) { if (t < 1.5 * LN2) { | public static double exp(double x) { if (x != x) return x; if (x > EXP_LIMIT_H) return Double.POSITIVE_INFINITY; if (x < EXP_LIMIT_L) return 0; // Argument reduction. double hi; double lo; int k; double t = abs(x); if (t > 0.5 * LN2) { if (t < 1.5 * LN2) { hi = t - LN2_H; lo = LN2_L; k = 1; } else { k = (int) (INV_LN2 * t + 0.5); hi = t - k * LN2_H; lo = k * LN2_L; } if (x < 0) { hi = -hi; lo = -lo; k = -k; } x = hi - lo; } else if (t < 1 / TWO_28) return 1; else lo = hi = k = 0; // Now x is in primary range. t = x * x; double c = x - t * (P1 + t * (P2 + t * (P3 + t * (P4 + t * P5)))); if (k == 0) return 1 - (x * c / (c - 2) - x); double y = 1 - (lo - x * c / (2 - c) - hi); return scale(y, k); } | 1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/b2ed890086e708f00d163f3e8514bfa8b353f662/StrictMath.java/buggy/core/src/classpath/java/java/lang/StrictMath.java |
} else { | } else { | public static double exp(double x) { if (x != x) return x; if (x > EXP_LIMIT_H) return Double.POSITIVE_INFINITY; if (x < EXP_LIMIT_L) return 0; // Argument reduction. double hi; double lo; int k; double t = abs(x); if (t > 0.5 * LN2) { if (t < 1.5 * LN2) { hi = t - LN2_H; lo = LN2_L; k = 1; } else { k = (int) (INV_LN2 * t + 0.5); hi = t - k * LN2_H; lo = k * LN2_L; } if (x < 0) { hi = -hi; lo = -lo; k = -k; } x = hi - lo; } else if (t < 1 / TWO_28) return 1; else lo = hi = k = 0; // Now x is in primary range. t = x * x; double c = x - t * (P1 + t * (P2 + t * (P3 + t * (P4 + t * P5)))); if (k == 0) return 1 - (x * c / (c - 2) - x); double y = 1 - (lo - x * c / (2 - c) - hi); return scale(y, k); } | 1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/b2ed890086e708f00d163f3e8514bfa8b353f662/StrictMath.java/buggy/core/src/classpath/java/java/lang/StrictMath.java |
if (x < 0) { | if (x < 0) { | public static double exp(double x) { if (x != x) return x; if (x > EXP_LIMIT_H) return Double.POSITIVE_INFINITY; if (x < EXP_LIMIT_L) return 0; // Argument reduction. double hi; double lo; int k; double t = abs(x); if (t > 0.5 * LN2) { if (t < 1.5 * LN2) { hi = t - LN2_H; lo = LN2_L; k = 1; } else { k = (int) (INV_LN2 * t + 0.5); hi = t - k * LN2_H; lo = k * LN2_L; } if (x < 0) { hi = -hi; lo = -lo; k = -k; } x = hi - lo; } else if (t < 1 / TWO_28) return 1; else lo = hi = k = 0; // Now x is in primary range. t = x * x; double c = x - t * (P1 + t * (P2 + t * (P3 + t * (P4 + t * P5)))); if (k == 0) return 1 - (x * c / (c - 2) - x); double y = 1 - (lo - x * c / (2 - c) - hi); return scale(y, k); } | 1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/b2ed890086e708f00d163f3e8514bfa8b353f662/StrictMath.java/buggy/core/src/classpath/java/java/lang/StrictMath.java |
} else if (t < 1 / TWO_28) | } else if (t < 1 / TWO_28) | public static double exp(double x) { if (x != x) return x; if (x > EXP_LIMIT_H) return Double.POSITIVE_INFINITY; if (x < EXP_LIMIT_L) return 0; // Argument reduction. double hi; double lo; int k; double t = abs(x); if (t > 0.5 * LN2) { if (t < 1.5 * LN2) { hi = t - LN2_H; lo = LN2_L; k = 1; } else { k = (int) (INV_LN2 * t + 0.5); hi = t - k * LN2_H; lo = k * LN2_L; } if (x < 0) { hi = -hi; lo = -lo; k = -k; } x = hi - lo; } else if (t < 1 / TWO_28) return 1; else lo = hi = k = 0; // Now x is in primary range. t = x * x; double c = x - t * (P1 + t * (P2 + t * (P3 + t * (P4 + t * P5)))); if (k == 0) return 1 - (x * c / (c - 2) - x); double y = 1 - (lo - x * c / (2 - c) - hi); return scale(y, k); } | 1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/b2ed890086e708f00d163f3e8514bfa8b353f662/StrictMath.java/buggy/core/src/classpath/java/java/lang/StrictMath.java |
public static double floor(double a) { | public static double floor(double a) { | public static double floor(double a) { double x = abs(a); if (!(x < TWO_52) || (long) a == a) return a; // No fraction bits; includes NaN and infinity. if (x < 1) return a >= 0 ? 0 * a : -1; // Worry about signed zero. return a < 0 ? (long) a - 1.0 : (long) a; // Cast to long truncates. } | 1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/b2ed890086e708f00d163f3e8514bfa8b353f662/StrictMath.java/buggy/core/src/classpath/java/java/lang/StrictMath.java |
if (!(x < TWO_52) || (long) a == a) | if (! (x < TWO_52) || (long) a == a) | public static double floor(double a) { double x = abs(a); if (!(x < TWO_52) || (long) a == a) return a; // No fraction bits; includes NaN and infinity. if (x < 1) return a >= 0 ? 0 * a : -1; // Worry about signed zero. return a < 0 ? (long) a - 1.0 : (long) a; // Cast to long truncates. } | 1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/b2ed890086e708f00d163f3e8514bfa8b353f662/StrictMath.java/buggy/core/src/classpath/java/java/lang/StrictMath.java |
public static double log(double x) { | public static double log(double x) { | public static double log(double x) { if (x == 0) return Double.NEGATIVE_INFINITY; if (x < 0) return Double.NaN; if (!(x < Double.POSITIVE_INFINITY)) return x; // Normalize x. long bits = Double.doubleToLongBits(x); int exp = (int) (bits >> 52); if (exp == 0) // Subnormal x. { x *= TWO_54; bits = Double.doubleToLongBits(x); exp = (int) (bits >> 52) - 54; } exp -= 1023; // Unbias exponent. bits = (bits & 0x000fffffffffffffL) | 0x3ff0000000000000L; x = Double.longBitsToDouble(bits); if (x >= SQRT_2) { x *= 0.5; exp++; } x--; if (abs(x) < 1 / TWO_20) { if (x == 0) return exp * LN2_H + exp * LN2_L; double r = x * x * (0.5 - 1 / 3.0 * x); if (exp == 0) return x - r; return exp * LN2_H - ((r - exp * LN2_L) - x); } double s = x / (2 + x); double z = s * s; double w = z * z; double t1 = w * (LG2 + w * (LG4 + w * LG6)); double t2 = z * (LG1 + w * (LG3 + w * (LG5 + w * LG7))); double r = t2 + t1; if (bits >= 0x3ff6174a00000000L && bits < 0x3ff6b85200000000L) { double h = 0.5 * x * x; // Need more accuracy for x near sqrt(2). if (exp == 0) return x - (h - s * (h + r)); return exp * LN2_H - ((h - (s * (h + r) + exp * LN2_L)) - x); } if (exp == 0) return x - s * (x - r); return exp * LN2_H - ((s * (x - r) - exp * LN2_L) - x); } | 1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/b2ed890086e708f00d163f3e8514bfa8b353f662/StrictMath.java/buggy/core/src/classpath/java/java/lang/StrictMath.java |
if (!(x < Double.POSITIVE_INFINITY)) | if (! (x < Double.POSITIVE_INFINITY)) | public static double log(double x) { if (x == 0) return Double.NEGATIVE_INFINITY; if (x < 0) return Double.NaN; if (!(x < Double.POSITIVE_INFINITY)) return x; // Normalize x. long bits = Double.doubleToLongBits(x); int exp = (int) (bits >> 52); if (exp == 0) // Subnormal x. { x *= TWO_54; bits = Double.doubleToLongBits(x); exp = (int) (bits >> 52) - 54; } exp -= 1023; // Unbias exponent. bits = (bits & 0x000fffffffffffffL) | 0x3ff0000000000000L; x = Double.longBitsToDouble(bits); if (x >= SQRT_2) { x *= 0.5; exp++; } x--; if (abs(x) < 1 / TWO_20) { if (x == 0) return exp * LN2_H + exp * LN2_L; double r = x * x * (0.5 - 1 / 3.0 * x); if (exp == 0) return x - r; return exp * LN2_H - ((r - exp * LN2_L) - x); } double s = x / (2 + x); double z = s * s; double w = z * z; double t1 = w * (LG2 + w * (LG4 + w * LG6)); double t2 = z * (LG1 + w * (LG3 + w * (LG5 + w * LG7))); double r = t2 + t1; if (bits >= 0x3ff6174a00000000L && bits < 0x3ff6b85200000000L) { double h = 0.5 * x * x; // Need more accuracy for x near sqrt(2). if (exp == 0) return x - (h - s * (h + r)); return exp * LN2_H - ((h - (s * (h + r) + exp * LN2_L)) - x); } if (exp == 0) return x - s * (x - r); return exp * LN2_H - ((s * (x - r) - exp * LN2_L) - x); } | 1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/b2ed890086e708f00d163f3e8514bfa8b353f662/StrictMath.java/buggy/core/src/classpath/java/java/lang/StrictMath.java |
if (x >= SQRT_2) { | if (x >= SQRT_2) { | public static double log(double x) { if (x == 0) return Double.NEGATIVE_INFINITY; if (x < 0) return Double.NaN; if (!(x < Double.POSITIVE_INFINITY)) return x; // Normalize x. long bits = Double.doubleToLongBits(x); int exp = (int) (bits >> 52); if (exp == 0) // Subnormal x. { x *= TWO_54; bits = Double.doubleToLongBits(x); exp = (int) (bits >> 52) - 54; } exp -= 1023; // Unbias exponent. bits = (bits & 0x000fffffffffffffL) | 0x3ff0000000000000L; x = Double.longBitsToDouble(bits); if (x >= SQRT_2) { x *= 0.5; exp++; } x--; if (abs(x) < 1 / TWO_20) { if (x == 0) return exp * LN2_H + exp * LN2_L; double r = x * x * (0.5 - 1 / 3.0 * x); if (exp == 0) return x - r; return exp * LN2_H - ((r - exp * LN2_L) - x); } double s = x / (2 + x); double z = s * s; double w = z * z; double t1 = w * (LG2 + w * (LG4 + w * LG6)); double t2 = z * (LG1 + w * (LG3 + w * (LG5 + w * LG7))); double r = t2 + t1; if (bits >= 0x3ff6174a00000000L && bits < 0x3ff6b85200000000L) { double h = 0.5 * x * x; // Need more accuracy for x near sqrt(2). if (exp == 0) return x - (h - s * (h + r)); return exp * LN2_H - ((h - (s * (h + r) + exp * LN2_L)) - x); } if (exp == 0) return x - s * (x - r); return exp * LN2_H - ((s * (x - r) - exp * LN2_L) - x); } | 1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/b2ed890086e708f00d163f3e8514bfa8b353f662/StrictMath.java/buggy/core/src/classpath/java/java/lang/StrictMath.java |
if (abs(x) < 1 / TWO_20) { | if (abs(x) < 1 / TWO_20) { | public static double log(double x) { if (x == 0) return Double.NEGATIVE_INFINITY; if (x < 0) return Double.NaN; if (!(x < Double.POSITIVE_INFINITY)) return x; // Normalize x. long bits = Double.doubleToLongBits(x); int exp = (int) (bits >> 52); if (exp == 0) // Subnormal x. { x *= TWO_54; bits = Double.doubleToLongBits(x); exp = (int) (bits >> 52) - 54; } exp -= 1023; // Unbias exponent. bits = (bits & 0x000fffffffffffffL) | 0x3ff0000000000000L; x = Double.longBitsToDouble(bits); if (x >= SQRT_2) { x *= 0.5; exp++; } x--; if (abs(x) < 1 / TWO_20) { if (x == 0) return exp * LN2_H + exp * LN2_L; double r = x * x * (0.5 - 1 / 3.0 * x); if (exp == 0) return x - r; return exp * LN2_H - ((r - exp * LN2_L) - x); } double s = x / (2 + x); double z = s * s; double w = z * z; double t1 = w * (LG2 + w * (LG4 + w * LG6)); double t2 = z * (LG1 + w * (LG3 + w * (LG5 + w * LG7))); double r = t2 + t1; if (bits >= 0x3ff6174a00000000L && bits < 0x3ff6b85200000000L) { double h = 0.5 * x * x; // Need more accuracy for x near sqrt(2). if (exp == 0) return x - (h - s * (h + r)); return exp * LN2_H - ((h - (s * (h + r) + exp * LN2_L)) - x); } if (exp == 0) return x - s * (x - r); return exp * LN2_H - ((s * (x - r) - exp * LN2_L) - x); } | 1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/b2ed890086e708f00d163f3e8514bfa8b353f662/StrictMath.java/buggy/core/src/classpath/java/java/lang/StrictMath.java |
if (bits >= 0x3ff6174a00000000L && bits < 0x3ff6b85200000000L) { | if (bits >= 0x3ff6174a00000000L && bits < 0x3ff6b85200000000L) { | public static double log(double x) { if (x == 0) return Double.NEGATIVE_INFINITY; if (x < 0) return Double.NaN; if (!(x < Double.POSITIVE_INFINITY)) return x; // Normalize x. long bits = Double.doubleToLongBits(x); int exp = (int) (bits >> 52); if (exp == 0) // Subnormal x. { x *= TWO_54; bits = Double.doubleToLongBits(x); exp = (int) (bits >> 52) - 54; } exp -= 1023; // Unbias exponent. bits = (bits & 0x000fffffffffffffL) | 0x3ff0000000000000L; x = Double.longBitsToDouble(bits); if (x >= SQRT_2) { x *= 0.5; exp++; } x--; if (abs(x) < 1 / TWO_20) { if (x == 0) return exp * LN2_H + exp * LN2_L; double r = x * x * (0.5 - 1 / 3.0 * x); if (exp == 0) return x - r; return exp * LN2_H - ((r - exp * LN2_L) - x); } double s = x / (2 + x); double z = s * s; double w = z * z; double t1 = w * (LG2 + w * (LG4 + w * LG6)); double t2 = z * (LG1 + w * (LG3 + w * (LG5 + w * LG7))); double r = t2 + t1; if (bits >= 0x3ff6174a00000000L && bits < 0x3ff6b85200000000L) { double h = 0.5 * x * x; // Need more accuracy for x near sqrt(2). if (exp == 0) return x - (h - s * (h + r)); return exp * LN2_H - ((h - (s * (h + r) + exp * LN2_L)) - x); } if (exp == 0) return x - s * (x - r); return exp * LN2_H - ((s * (x - r) - exp * LN2_L) - x); } | 1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/b2ed890086e708f00d163f3e8514bfa8b353f662/StrictMath.java/buggy/core/src/classpath/java/java/lang/StrictMath.java |
public static int max(int a, int b) { | public static int max(int a, int b) { | public static int max(int a, int b) { return (a > b) ? a : b; } | 1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/b2ed890086e708f00d163f3e8514bfa8b353f662/StrictMath.java/buggy/core/src/classpath/java/java/lang/StrictMath.java |
public static int min(int a, int b) { | public static int min(int a, int b) { | public static int min(int a, int b) { return (a < b) ? a : b; } | 1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/b2ed890086e708f00d163f3e8514bfa8b353f662/StrictMath.java/buggy/core/src/classpath/java/java/lang/StrictMath.java |
public static double pow(double x, double y) { | public static double pow(double x, double y) { | public static double pow(double x, double y) { // Special cases first. if (y == 0) return 1; if (y == 1) return x; if (y == -1) return 1 / x; if (x != x || y != y) return Double.NaN; // When x < 0, yisint tells if y is not an integer (0), even(1), // or odd (2). int yisint = 0; if (x < 0 && floor(y) == y) yisint = (y % 2 == 0) ? 2 : 1; double ax = abs(x); double ay = abs(y); // More special cases, of y. if (ay == Double.POSITIVE_INFINITY) { if (ax == 1) return Double.NaN; if (ax > 1) return y > 0 ? y : 0; return y < 0 ? -y : 0; } if (y == 2) return x * x; if (y == 0.5) return sqrt(x); // More special cases, of x. if (x == 0 || ax == Double.POSITIVE_INFINITY || ax == 1) { if (y < 0) ax = 1 / ax; if (x < 0) { if (x == -1 && yisint == 0) ax = Double.NaN; else if (yisint == 1) ax = -ax; } return ax; } if (x < 0 && yisint == 0) return Double.NaN; // Now we can start! double t; double t1; double t2; double u; double v; double w; if (ay > TWO_31) { if (ay > TWO_64) // Automatic over/underflow. return ((ax < 1) ? y < 0 : y > 0) ? Double.POSITIVE_INFINITY : 0; // Over/underflow if x is not close to one. if (ax < 0.9999995231628418) return y < 0 ? Double.POSITIVE_INFINITY : 0; if (ax >= 1.0000009536743164) return y > 0 ? Double.POSITIVE_INFINITY : 0; // Now |1-x| is <= 2**-20, sufficient to compute // log(x) by x-x^2/2+x^3/3-x^4/4. t = x - 1; w = t * t * (0.5 - t * (1 / 3.0 - t * 0.25)); u = INV_LN2_H * t; v = t * INV_LN2_L - w * INV_LN2; t1 = (float) (u + v); t2 = v - (t1 - u); } else { long bits = Double.doubleToLongBits(ax); int exp = (int) (bits >> 52); if (exp == 0) // Subnormal x. { ax *= TWO_54; bits = Double.doubleToLongBits(ax); exp = (int) (bits >> 52) - 54; } exp -= 1023; // Unbias exponent. ax = Double.longBitsToDouble((bits & 0x000fffffffffffffL) | 0x3ff0000000000000L); boolean k; if (ax < SQRT_1_5) // |x|<sqrt(3/2). k = false; else if (ax < SQRT_3) // |x|<sqrt(3). k = true; else { k = false; ax *= 0.5; exp++; } // Compute s = s_h+s_l = (x-1)/(x+1) or (x-1.5)/(x+1.5). u = ax - (k ? 1.5 : 1); v = 1 / (ax + (k ? 1.5 : 1)); double s = u * v; double s_h = (float) s; double t_h = (float) (ax + (k ? 1.5 : 1)); double t_l = ax - (t_h - (k ? 1.5 : 1)); double s_l = v * ((u - s_h * t_h) - s_h * t_l); // Compute log(ax). double s2 = s * s; double r = s_l * (s_h + s) + s2 * s2 * (L1 + s2 * (L2 + s2 * (L3 + s2 * (L4 + s2 * (L5 + s2 * L6))))); s2 = s_h * s_h; t_h = (float) (3.0 + s2 + r); t_l = r - (t_h - 3.0 - s2); // u+v = s*(1+...). u = s_h * t_h; v = s_l * t_h + t_l * s; // 2/(3log2)*(s+...). double p_h = (float) (u + v); double p_l = v - (p_h - u); double z_h = CP_H * p_h; double z_l = CP_L * p_h + p_l * CP + (k ? DP_L : 0); // log2(ax) = (s+..)*2/(3*log2) = exp + dp_h + z_h + z_l. t = exp; t1 = (float) (z_h + z_l + (k ? DP_H : 0) + t); t2 = z_l - (t1 - t - (k ? DP_H : 0) - z_h); } // Split up y into y1+y2 and compute (y1+y2)*(t1+t2). boolean negative = x < 0 && yisint == 1; double y1 = (float) y; double p_l = (y - y1) * t1 + y * t2; double p_h = y1 * t1; double z = p_l + p_h; if (z >= 1024) // Detect overflow. { if (z > 1024 || p_l + OVT > z - p_h) return negative ? Double.NEGATIVE_INFINITY : Double.POSITIVE_INFINITY; } else if (z <= -1075) // Detect underflow. { if (z < -1075 || p_l <= z - p_h) return negative ? -0.0 : 0; } // Compute 2**(p_h+p_l). int n = round((float) z); p_h -= n; t = (float) (p_l + p_h); u = t * LN2_H; v = (p_l - (t - p_h)) * LN2 + t * LN2_L; z = u + v; w = v - (z - u); t = z * z; t1 = z - t * (P1 + t * (P2 + t * (P3 + t * (P4 + t * P5)))); double r = (z * t1) / (t1 - 2) - (w + z * w); z = scale(1 - (r - z), n); return negative ? -z : z; } | 1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/b2ed890086e708f00d163f3e8514bfa8b353f662/StrictMath.java/buggy/core/src/classpath/java/java/lang/StrictMath.java |
if (ay == Double.POSITIVE_INFINITY) { | if (ay == Double.POSITIVE_INFINITY) { | public static double pow(double x, double y) { // Special cases first. if (y == 0) return 1; if (y == 1) return x; if (y == -1) return 1 / x; if (x != x || y != y) return Double.NaN; // When x < 0, yisint tells if y is not an integer (0), even(1), // or odd (2). int yisint = 0; if (x < 0 && floor(y) == y) yisint = (y % 2 == 0) ? 2 : 1; double ax = abs(x); double ay = abs(y); // More special cases, of y. if (ay == Double.POSITIVE_INFINITY) { if (ax == 1) return Double.NaN; if (ax > 1) return y > 0 ? y : 0; return y < 0 ? -y : 0; } if (y == 2) return x * x; if (y == 0.5) return sqrt(x); // More special cases, of x. if (x == 0 || ax == Double.POSITIVE_INFINITY || ax == 1) { if (y < 0) ax = 1 / ax; if (x < 0) { if (x == -1 && yisint == 0) ax = Double.NaN; else if (yisint == 1) ax = -ax; } return ax; } if (x < 0 && yisint == 0) return Double.NaN; // Now we can start! double t; double t1; double t2; double u; double v; double w; if (ay > TWO_31) { if (ay > TWO_64) // Automatic over/underflow. return ((ax < 1) ? y < 0 : y > 0) ? Double.POSITIVE_INFINITY : 0; // Over/underflow if x is not close to one. if (ax < 0.9999995231628418) return y < 0 ? Double.POSITIVE_INFINITY : 0; if (ax >= 1.0000009536743164) return y > 0 ? Double.POSITIVE_INFINITY : 0; // Now |1-x| is <= 2**-20, sufficient to compute // log(x) by x-x^2/2+x^3/3-x^4/4. t = x - 1; w = t * t * (0.5 - t * (1 / 3.0 - t * 0.25)); u = INV_LN2_H * t; v = t * INV_LN2_L - w * INV_LN2; t1 = (float) (u + v); t2 = v - (t1 - u); } else { long bits = Double.doubleToLongBits(ax); int exp = (int) (bits >> 52); if (exp == 0) // Subnormal x. { ax *= TWO_54; bits = Double.doubleToLongBits(ax); exp = (int) (bits >> 52) - 54; } exp -= 1023; // Unbias exponent. ax = Double.longBitsToDouble((bits & 0x000fffffffffffffL) | 0x3ff0000000000000L); boolean k; if (ax < SQRT_1_5) // |x|<sqrt(3/2). k = false; else if (ax < SQRT_3) // |x|<sqrt(3). k = true; else { k = false; ax *= 0.5; exp++; } // Compute s = s_h+s_l = (x-1)/(x+1) or (x-1.5)/(x+1.5). u = ax - (k ? 1.5 : 1); v = 1 / (ax + (k ? 1.5 : 1)); double s = u * v; double s_h = (float) s; double t_h = (float) (ax + (k ? 1.5 : 1)); double t_l = ax - (t_h - (k ? 1.5 : 1)); double s_l = v * ((u - s_h * t_h) - s_h * t_l); // Compute log(ax). double s2 = s * s; double r = s_l * (s_h + s) + s2 * s2 * (L1 + s2 * (L2 + s2 * (L3 + s2 * (L4 + s2 * (L5 + s2 * L6))))); s2 = s_h * s_h; t_h = (float) (3.0 + s2 + r); t_l = r - (t_h - 3.0 - s2); // u+v = s*(1+...). u = s_h * t_h; v = s_l * t_h + t_l * s; // 2/(3log2)*(s+...). double p_h = (float) (u + v); double p_l = v - (p_h - u); double z_h = CP_H * p_h; double z_l = CP_L * p_h + p_l * CP + (k ? DP_L : 0); // log2(ax) = (s+..)*2/(3*log2) = exp + dp_h + z_h + z_l. t = exp; t1 = (float) (z_h + z_l + (k ? DP_H : 0) + t); t2 = z_l - (t1 - t - (k ? DP_H : 0) - z_h); } // Split up y into y1+y2 and compute (y1+y2)*(t1+t2). boolean negative = x < 0 && yisint == 1; double y1 = (float) y; double p_l = (y - y1) * t1 + y * t2; double p_h = y1 * t1; double z = p_l + p_h; if (z >= 1024) // Detect overflow. { if (z > 1024 || p_l + OVT > z - p_h) return negative ? Double.NEGATIVE_INFINITY : Double.POSITIVE_INFINITY; } else if (z <= -1075) // Detect underflow. { if (z < -1075 || p_l <= z - p_h) return negative ? -0.0 : 0; } // Compute 2**(p_h+p_l). int n = round((float) z); p_h -= n; t = (float) (p_l + p_h); u = t * LN2_H; v = (p_l - (t - p_h)) * LN2 + t * LN2_L; z = u + v; w = v - (z - u); t = z * z; t1 = z - t * (P1 + t * (P2 + t * (P3 + t * (P4 + t * P5)))); double r = (z * t1) / (t1 - 2) - (w + z * w); z = scale(1 - (r - z), n); return negative ? -z : z; } | 1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/b2ed890086e708f00d163f3e8514bfa8b353f662/StrictMath.java/buggy/core/src/classpath/java/java/lang/StrictMath.java |
if (x == 0 || ax == Double.POSITIVE_INFINITY || ax == 1) { | if (x == 0 || ax == Double.POSITIVE_INFINITY || ax == 1) { | public static double pow(double x, double y) { // Special cases first. if (y == 0) return 1; if (y == 1) return x; if (y == -1) return 1 / x; if (x != x || y != y) return Double.NaN; // When x < 0, yisint tells if y is not an integer (0), even(1), // or odd (2). int yisint = 0; if (x < 0 && floor(y) == y) yisint = (y % 2 == 0) ? 2 : 1; double ax = abs(x); double ay = abs(y); // More special cases, of y. if (ay == Double.POSITIVE_INFINITY) { if (ax == 1) return Double.NaN; if (ax > 1) return y > 0 ? y : 0; return y < 0 ? -y : 0; } if (y == 2) return x * x; if (y == 0.5) return sqrt(x); // More special cases, of x. if (x == 0 || ax == Double.POSITIVE_INFINITY || ax == 1) { if (y < 0) ax = 1 / ax; if (x < 0) { if (x == -1 && yisint == 0) ax = Double.NaN; else if (yisint == 1) ax = -ax; } return ax; } if (x < 0 && yisint == 0) return Double.NaN; // Now we can start! double t; double t1; double t2; double u; double v; double w; if (ay > TWO_31) { if (ay > TWO_64) // Automatic over/underflow. return ((ax < 1) ? y < 0 : y > 0) ? Double.POSITIVE_INFINITY : 0; // Over/underflow if x is not close to one. if (ax < 0.9999995231628418) return y < 0 ? Double.POSITIVE_INFINITY : 0; if (ax >= 1.0000009536743164) return y > 0 ? Double.POSITIVE_INFINITY : 0; // Now |1-x| is <= 2**-20, sufficient to compute // log(x) by x-x^2/2+x^3/3-x^4/4. t = x - 1; w = t * t * (0.5 - t * (1 / 3.0 - t * 0.25)); u = INV_LN2_H * t; v = t * INV_LN2_L - w * INV_LN2; t1 = (float) (u + v); t2 = v - (t1 - u); } else { long bits = Double.doubleToLongBits(ax); int exp = (int) (bits >> 52); if (exp == 0) // Subnormal x. { ax *= TWO_54; bits = Double.doubleToLongBits(ax); exp = (int) (bits >> 52) - 54; } exp -= 1023; // Unbias exponent. ax = Double.longBitsToDouble((bits & 0x000fffffffffffffL) | 0x3ff0000000000000L); boolean k; if (ax < SQRT_1_5) // |x|<sqrt(3/2). k = false; else if (ax < SQRT_3) // |x|<sqrt(3). k = true; else { k = false; ax *= 0.5; exp++; } // Compute s = s_h+s_l = (x-1)/(x+1) or (x-1.5)/(x+1.5). u = ax - (k ? 1.5 : 1); v = 1 / (ax + (k ? 1.5 : 1)); double s = u * v; double s_h = (float) s; double t_h = (float) (ax + (k ? 1.5 : 1)); double t_l = ax - (t_h - (k ? 1.5 : 1)); double s_l = v * ((u - s_h * t_h) - s_h * t_l); // Compute log(ax). double s2 = s * s; double r = s_l * (s_h + s) + s2 * s2 * (L1 + s2 * (L2 + s2 * (L3 + s2 * (L4 + s2 * (L5 + s2 * L6))))); s2 = s_h * s_h; t_h = (float) (3.0 + s2 + r); t_l = r - (t_h - 3.0 - s2); // u+v = s*(1+...). u = s_h * t_h; v = s_l * t_h + t_l * s; // 2/(3log2)*(s+...). double p_h = (float) (u + v); double p_l = v - (p_h - u); double z_h = CP_H * p_h; double z_l = CP_L * p_h + p_l * CP + (k ? DP_L : 0); // log2(ax) = (s+..)*2/(3*log2) = exp + dp_h + z_h + z_l. t = exp; t1 = (float) (z_h + z_l + (k ? DP_H : 0) + t); t2 = z_l - (t1 - t - (k ? DP_H : 0) - z_h); } // Split up y into y1+y2 and compute (y1+y2)*(t1+t2). boolean negative = x < 0 && yisint == 1; double y1 = (float) y; double p_l = (y - y1) * t1 + y * t2; double p_h = y1 * t1; double z = p_l + p_h; if (z >= 1024) // Detect overflow. { if (z > 1024 || p_l + OVT > z - p_h) return negative ? Double.NEGATIVE_INFINITY : Double.POSITIVE_INFINITY; } else if (z <= -1075) // Detect underflow. { if (z < -1075 || p_l <= z - p_h) return negative ? -0.0 : 0; } // Compute 2**(p_h+p_l). int n = round((float) z); p_h -= n; t = (float) (p_l + p_h); u = t * LN2_H; v = (p_l - (t - p_h)) * LN2 + t * LN2_L; z = u + v; w = v - (z - u); t = z * z; t1 = z - t * (P1 + t * (P2 + t * (P3 + t * (P4 + t * P5)))); double r = (z * t1) / (t1 - 2) - (w + z * w); z = scale(1 - (r - z), n); return negative ? -z : z; } | 1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/b2ed890086e708f00d163f3e8514bfa8b353f662/StrictMath.java/buggy/core/src/classpath/java/java/lang/StrictMath.java |
if (x < 0) { | if (x < 0) { | public static double pow(double x, double y) { // Special cases first. if (y == 0) return 1; if (y == 1) return x; if (y == -1) return 1 / x; if (x != x || y != y) return Double.NaN; // When x < 0, yisint tells if y is not an integer (0), even(1), // or odd (2). int yisint = 0; if (x < 0 && floor(y) == y) yisint = (y % 2 == 0) ? 2 : 1; double ax = abs(x); double ay = abs(y); // More special cases, of y. if (ay == Double.POSITIVE_INFINITY) { if (ax == 1) return Double.NaN; if (ax > 1) return y > 0 ? y : 0; return y < 0 ? -y : 0; } if (y == 2) return x * x; if (y == 0.5) return sqrt(x); // More special cases, of x. if (x == 0 || ax == Double.POSITIVE_INFINITY || ax == 1) { if (y < 0) ax = 1 / ax; if (x < 0) { if (x == -1 && yisint == 0) ax = Double.NaN; else if (yisint == 1) ax = -ax; } return ax; } if (x < 0 && yisint == 0) return Double.NaN; // Now we can start! double t; double t1; double t2; double u; double v; double w; if (ay > TWO_31) { if (ay > TWO_64) // Automatic over/underflow. return ((ax < 1) ? y < 0 : y > 0) ? Double.POSITIVE_INFINITY : 0; // Over/underflow if x is not close to one. if (ax < 0.9999995231628418) return y < 0 ? Double.POSITIVE_INFINITY : 0; if (ax >= 1.0000009536743164) return y > 0 ? Double.POSITIVE_INFINITY : 0; // Now |1-x| is <= 2**-20, sufficient to compute // log(x) by x-x^2/2+x^3/3-x^4/4. t = x - 1; w = t * t * (0.5 - t * (1 / 3.0 - t * 0.25)); u = INV_LN2_H * t; v = t * INV_LN2_L - w * INV_LN2; t1 = (float) (u + v); t2 = v - (t1 - u); } else { long bits = Double.doubleToLongBits(ax); int exp = (int) (bits >> 52); if (exp == 0) // Subnormal x. { ax *= TWO_54; bits = Double.doubleToLongBits(ax); exp = (int) (bits >> 52) - 54; } exp -= 1023; // Unbias exponent. ax = Double.longBitsToDouble((bits & 0x000fffffffffffffL) | 0x3ff0000000000000L); boolean k; if (ax < SQRT_1_5) // |x|<sqrt(3/2). k = false; else if (ax < SQRT_3) // |x|<sqrt(3). k = true; else { k = false; ax *= 0.5; exp++; } // Compute s = s_h+s_l = (x-1)/(x+1) or (x-1.5)/(x+1.5). u = ax - (k ? 1.5 : 1); v = 1 / (ax + (k ? 1.5 : 1)); double s = u * v; double s_h = (float) s; double t_h = (float) (ax + (k ? 1.5 : 1)); double t_l = ax - (t_h - (k ? 1.5 : 1)); double s_l = v * ((u - s_h * t_h) - s_h * t_l); // Compute log(ax). double s2 = s * s; double r = s_l * (s_h + s) + s2 * s2 * (L1 + s2 * (L2 + s2 * (L3 + s2 * (L4 + s2 * (L5 + s2 * L6))))); s2 = s_h * s_h; t_h = (float) (3.0 + s2 + r); t_l = r - (t_h - 3.0 - s2); // u+v = s*(1+...). u = s_h * t_h; v = s_l * t_h + t_l * s; // 2/(3log2)*(s+...). double p_h = (float) (u + v); double p_l = v - (p_h - u); double z_h = CP_H * p_h; double z_l = CP_L * p_h + p_l * CP + (k ? DP_L : 0); // log2(ax) = (s+..)*2/(3*log2) = exp + dp_h + z_h + z_l. t = exp; t1 = (float) (z_h + z_l + (k ? DP_H : 0) + t); t2 = z_l - (t1 - t - (k ? DP_H : 0) - z_h); } // Split up y into y1+y2 and compute (y1+y2)*(t1+t2). boolean negative = x < 0 && yisint == 1; double y1 = (float) y; double p_l = (y - y1) * t1 + y * t2; double p_h = y1 * t1; double z = p_l + p_h; if (z >= 1024) // Detect overflow. { if (z > 1024 || p_l + OVT > z - p_h) return negative ? Double.NEGATIVE_INFINITY : Double.POSITIVE_INFINITY; } else if (z <= -1075) // Detect underflow. { if (z < -1075 || p_l <= z - p_h) return negative ? -0.0 : 0; } // Compute 2**(p_h+p_l). int n = round((float) z); p_h -= n; t = (float) (p_l + p_h); u = t * LN2_H; v = (p_l - (t - p_h)) * LN2 + t * LN2_L; z = u + v; w = v - (z - u); t = z * z; t1 = z - t * (P1 + t * (P2 + t * (P3 + t * (P4 + t * P5)))); double r = (z * t1) / (t1 - 2) - (w + z * w); z = scale(1 - (r - z), n); return negative ? -z : z; } | 1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/b2ed890086e708f00d163f3e8514bfa8b353f662/StrictMath.java/buggy/core/src/classpath/java/java/lang/StrictMath.java |
if (ay > TWO_31) { | if (ay > TWO_31) { | public static double pow(double x, double y) { // Special cases first. if (y == 0) return 1; if (y == 1) return x; if (y == -1) return 1 / x; if (x != x || y != y) return Double.NaN; // When x < 0, yisint tells if y is not an integer (0), even(1), // or odd (2). int yisint = 0; if (x < 0 && floor(y) == y) yisint = (y % 2 == 0) ? 2 : 1; double ax = abs(x); double ay = abs(y); // More special cases, of y. if (ay == Double.POSITIVE_INFINITY) { if (ax == 1) return Double.NaN; if (ax > 1) return y > 0 ? y : 0; return y < 0 ? -y : 0; } if (y == 2) return x * x; if (y == 0.5) return sqrt(x); // More special cases, of x. if (x == 0 || ax == Double.POSITIVE_INFINITY || ax == 1) { if (y < 0) ax = 1 / ax; if (x < 0) { if (x == -1 && yisint == 0) ax = Double.NaN; else if (yisint == 1) ax = -ax; } return ax; } if (x < 0 && yisint == 0) return Double.NaN; // Now we can start! double t; double t1; double t2; double u; double v; double w; if (ay > TWO_31) { if (ay > TWO_64) // Automatic over/underflow. return ((ax < 1) ? y < 0 : y > 0) ? Double.POSITIVE_INFINITY : 0; // Over/underflow if x is not close to one. if (ax < 0.9999995231628418) return y < 0 ? Double.POSITIVE_INFINITY : 0; if (ax >= 1.0000009536743164) return y > 0 ? Double.POSITIVE_INFINITY : 0; // Now |1-x| is <= 2**-20, sufficient to compute // log(x) by x-x^2/2+x^3/3-x^4/4. t = x - 1; w = t * t * (0.5 - t * (1 / 3.0 - t * 0.25)); u = INV_LN2_H * t; v = t * INV_LN2_L - w * INV_LN2; t1 = (float) (u + v); t2 = v - (t1 - u); } else { long bits = Double.doubleToLongBits(ax); int exp = (int) (bits >> 52); if (exp == 0) // Subnormal x. { ax *= TWO_54; bits = Double.doubleToLongBits(ax); exp = (int) (bits >> 52) - 54; } exp -= 1023; // Unbias exponent. ax = Double.longBitsToDouble((bits & 0x000fffffffffffffL) | 0x3ff0000000000000L); boolean k; if (ax < SQRT_1_5) // |x|<sqrt(3/2). k = false; else if (ax < SQRT_3) // |x|<sqrt(3). k = true; else { k = false; ax *= 0.5; exp++; } // Compute s = s_h+s_l = (x-1)/(x+1) or (x-1.5)/(x+1.5). u = ax - (k ? 1.5 : 1); v = 1 / (ax + (k ? 1.5 : 1)); double s = u * v; double s_h = (float) s; double t_h = (float) (ax + (k ? 1.5 : 1)); double t_l = ax - (t_h - (k ? 1.5 : 1)); double s_l = v * ((u - s_h * t_h) - s_h * t_l); // Compute log(ax). double s2 = s * s; double r = s_l * (s_h + s) + s2 * s2 * (L1 + s2 * (L2 + s2 * (L3 + s2 * (L4 + s2 * (L5 + s2 * L6))))); s2 = s_h * s_h; t_h = (float) (3.0 + s2 + r); t_l = r - (t_h - 3.0 - s2); // u+v = s*(1+...). u = s_h * t_h; v = s_l * t_h + t_l * s; // 2/(3log2)*(s+...). double p_h = (float) (u + v); double p_l = v - (p_h - u); double z_h = CP_H * p_h; double z_l = CP_L * p_h + p_l * CP + (k ? DP_L : 0); // log2(ax) = (s+..)*2/(3*log2) = exp + dp_h + z_h + z_l. t = exp; t1 = (float) (z_h + z_l + (k ? DP_H : 0) + t); t2 = z_l - (t1 - t - (k ? DP_H : 0) - z_h); } // Split up y into y1+y2 and compute (y1+y2)*(t1+t2). boolean negative = x < 0 && yisint == 1; double y1 = (float) y; double p_l = (y - y1) * t1 + y * t2; double p_h = y1 * t1; double z = p_l + p_h; if (z >= 1024) // Detect overflow. { if (z > 1024 || p_l + OVT > z - p_h) return negative ? Double.NEGATIVE_INFINITY : Double.POSITIVE_INFINITY; } else if (z <= -1075) // Detect underflow. { if (z < -1075 || p_l <= z - p_h) return negative ? -0.0 : 0; } // Compute 2**(p_h+p_l). int n = round((float) z); p_h -= n; t = (float) (p_l + p_h); u = t * LN2_H; v = (p_l - (t - p_h)) * LN2 + t * LN2_L; z = u + v; w = v - (z - u); t = z * z; t1 = z - t * (P1 + t * (P2 + t * (P3 + t * (P4 + t * P5)))); double r = (z * t1) / (t1 - 2) - (w + z * w); z = scale(1 - (r - z), n); return negative ? -z : z; } | 1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/b2ed890086e708f00d163f3e8514bfa8b353f662/StrictMath.java/buggy/core/src/classpath/java/java/lang/StrictMath.java |
} else { | } else { | public static double pow(double x, double y) { // Special cases first. if (y == 0) return 1; if (y == 1) return x; if (y == -1) return 1 / x; if (x != x || y != y) return Double.NaN; // When x < 0, yisint tells if y is not an integer (0), even(1), // or odd (2). int yisint = 0; if (x < 0 && floor(y) == y) yisint = (y % 2 == 0) ? 2 : 1; double ax = abs(x); double ay = abs(y); // More special cases, of y. if (ay == Double.POSITIVE_INFINITY) { if (ax == 1) return Double.NaN; if (ax > 1) return y > 0 ? y : 0; return y < 0 ? -y : 0; } if (y == 2) return x * x; if (y == 0.5) return sqrt(x); // More special cases, of x. if (x == 0 || ax == Double.POSITIVE_INFINITY || ax == 1) { if (y < 0) ax = 1 / ax; if (x < 0) { if (x == -1 && yisint == 0) ax = Double.NaN; else if (yisint == 1) ax = -ax; } return ax; } if (x < 0 && yisint == 0) return Double.NaN; // Now we can start! double t; double t1; double t2; double u; double v; double w; if (ay > TWO_31) { if (ay > TWO_64) // Automatic over/underflow. return ((ax < 1) ? y < 0 : y > 0) ? Double.POSITIVE_INFINITY : 0; // Over/underflow if x is not close to one. if (ax < 0.9999995231628418) return y < 0 ? Double.POSITIVE_INFINITY : 0; if (ax >= 1.0000009536743164) return y > 0 ? Double.POSITIVE_INFINITY : 0; // Now |1-x| is <= 2**-20, sufficient to compute // log(x) by x-x^2/2+x^3/3-x^4/4. t = x - 1; w = t * t * (0.5 - t * (1 / 3.0 - t * 0.25)); u = INV_LN2_H * t; v = t * INV_LN2_L - w * INV_LN2; t1 = (float) (u + v); t2 = v - (t1 - u); } else { long bits = Double.doubleToLongBits(ax); int exp = (int) (bits >> 52); if (exp == 0) // Subnormal x. { ax *= TWO_54; bits = Double.doubleToLongBits(ax); exp = (int) (bits >> 52) - 54; } exp -= 1023; // Unbias exponent. ax = Double.longBitsToDouble((bits & 0x000fffffffffffffL) | 0x3ff0000000000000L); boolean k; if (ax < SQRT_1_5) // |x|<sqrt(3/2). k = false; else if (ax < SQRT_3) // |x|<sqrt(3). k = true; else { k = false; ax *= 0.5; exp++; } // Compute s = s_h+s_l = (x-1)/(x+1) or (x-1.5)/(x+1.5). u = ax - (k ? 1.5 : 1); v = 1 / (ax + (k ? 1.5 : 1)); double s = u * v; double s_h = (float) s; double t_h = (float) (ax + (k ? 1.5 : 1)); double t_l = ax - (t_h - (k ? 1.5 : 1)); double s_l = v * ((u - s_h * t_h) - s_h * t_l); // Compute log(ax). double s2 = s * s; double r = s_l * (s_h + s) + s2 * s2 * (L1 + s2 * (L2 + s2 * (L3 + s2 * (L4 + s2 * (L5 + s2 * L6))))); s2 = s_h * s_h; t_h = (float) (3.0 + s2 + r); t_l = r - (t_h - 3.0 - s2); // u+v = s*(1+...). u = s_h * t_h; v = s_l * t_h + t_l * s; // 2/(3log2)*(s+...). double p_h = (float) (u + v); double p_l = v - (p_h - u); double z_h = CP_H * p_h; double z_l = CP_L * p_h + p_l * CP + (k ? DP_L : 0); // log2(ax) = (s+..)*2/(3*log2) = exp + dp_h + z_h + z_l. t = exp; t1 = (float) (z_h + z_l + (k ? DP_H : 0) + t); t2 = z_l - (t1 - t - (k ? DP_H : 0) - z_h); } // Split up y into y1+y2 and compute (y1+y2)*(t1+t2). boolean negative = x < 0 && yisint == 1; double y1 = (float) y; double p_l = (y - y1) * t1 + y * t2; double p_h = y1 * t1; double z = p_l + p_h; if (z >= 1024) // Detect overflow. { if (z > 1024 || p_l + OVT > z - p_h) return negative ? Double.NEGATIVE_INFINITY : Double.POSITIVE_INFINITY; } else if (z <= -1075) // Detect underflow. { if (z < -1075 || p_l <= z - p_h) return negative ? -0.0 : 0; } // Compute 2**(p_h+p_l). int n = round((float) z); p_h -= n; t = (float) (p_l + p_h); u = t * LN2_H; v = (p_l - (t - p_h)) * LN2 + t * LN2_L; z = u + v; w = v - (z - u); t = z * z; t1 = z - t * (P1 + t * (P2 + t * (P3 + t * (P4 + t * P5)))); double r = (z * t1) / (t1 - 2) - (w + z * w); z = scale(1 - (r - z), n); return negative ? -z : z; } | 1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/b2ed890086e708f00d163f3e8514bfa8b353f662/StrictMath.java/buggy/core/src/classpath/java/java/lang/StrictMath.java |
ax = Double.longBitsToDouble((bits & 0x000fffffffffffffL) | 0x3ff0000000000000L); | ax = Double.longBitsToDouble((bits & 0x000fffffffffffffL) | 0x3ff0000000000000L); | public static double pow(double x, double y) { // Special cases first. if (y == 0) return 1; if (y == 1) return x; if (y == -1) return 1 / x; if (x != x || y != y) return Double.NaN; // When x < 0, yisint tells if y is not an integer (0), even(1), // or odd (2). int yisint = 0; if (x < 0 && floor(y) == y) yisint = (y % 2 == 0) ? 2 : 1; double ax = abs(x); double ay = abs(y); // More special cases, of y. if (ay == Double.POSITIVE_INFINITY) { if (ax == 1) return Double.NaN; if (ax > 1) return y > 0 ? y : 0; return y < 0 ? -y : 0; } if (y == 2) return x * x; if (y == 0.5) return sqrt(x); // More special cases, of x. if (x == 0 || ax == Double.POSITIVE_INFINITY || ax == 1) { if (y < 0) ax = 1 / ax; if (x < 0) { if (x == -1 && yisint == 0) ax = Double.NaN; else if (yisint == 1) ax = -ax; } return ax; } if (x < 0 && yisint == 0) return Double.NaN; // Now we can start! double t; double t1; double t2; double u; double v; double w; if (ay > TWO_31) { if (ay > TWO_64) // Automatic over/underflow. return ((ax < 1) ? y < 0 : y > 0) ? Double.POSITIVE_INFINITY : 0; // Over/underflow if x is not close to one. if (ax < 0.9999995231628418) return y < 0 ? Double.POSITIVE_INFINITY : 0; if (ax >= 1.0000009536743164) return y > 0 ? Double.POSITIVE_INFINITY : 0; // Now |1-x| is <= 2**-20, sufficient to compute // log(x) by x-x^2/2+x^3/3-x^4/4. t = x - 1; w = t * t * (0.5 - t * (1 / 3.0 - t * 0.25)); u = INV_LN2_H * t; v = t * INV_LN2_L - w * INV_LN2; t1 = (float) (u + v); t2 = v - (t1 - u); } else { long bits = Double.doubleToLongBits(ax); int exp = (int) (bits >> 52); if (exp == 0) // Subnormal x. { ax *= TWO_54; bits = Double.doubleToLongBits(ax); exp = (int) (bits >> 52) - 54; } exp -= 1023; // Unbias exponent. ax = Double.longBitsToDouble((bits & 0x000fffffffffffffL) | 0x3ff0000000000000L); boolean k; if (ax < SQRT_1_5) // |x|<sqrt(3/2). k = false; else if (ax < SQRT_3) // |x|<sqrt(3). k = true; else { k = false; ax *= 0.5; exp++; } // Compute s = s_h+s_l = (x-1)/(x+1) or (x-1.5)/(x+1.5). u = ax - (k ? 1.5 : 1); v = 1 / (ax + (k ? 1.5 : 1)); double s = u * v; double s_h = (float) s; double t_h = (float) (ax + (k ? 1.5 : 1)); double t_l = ax - (t_h - (k ? 1.5 : 1)); double s_l = v * ((u - s_h * t_h) - s_h * t_l); // Compute log(ax). double s2 = s * s; double r = s_l * (s_h + s) + s2 * s2 * (L1 + s2 * (L2 + s2 * (L3 + s2 * (L4 + s2 * (L5 + s2 * L6))))); s2 = s_h * s_h; t_h = (float) (3.0 + s2 + r); t_l = r - (t_h - 3.0 - s2); // u+v = s*(1+...). u = s_h * t_h; v = s_l * t_h + t_l * s; // 2/(3log2)*(s+...). double p_h = (float) (u + v); double p_l = v - (p_h - u); double z_h = CP_H * p_h; double z_l = CP_L * p_h + p_l * CP + (k ? DP_L : 0); // log2(ax) = (s+..)*2/(3*log2) = exp + dp_h + z_h + z_l. t = exp; t1 = (float) (z_h + z_l + (k ? DP_H : 0) + t); t2 = z_l - (t1 - t - (k ? DP_H : 0) - z_h); } // Split up y into y1+y2 and compute (y1+y2)*(t1+t2). boolean negative = x < 0 && yisint == 1; double y1 = (float) y; double p_l = (y - y1) * t1 + y * t2; double p_h = y1 * t1; double z = p_l + p_h; if (z >= 1024) // Detect overflow. { if (z > 1024 || p_l + OVT > z - p_h) return negative ? Double.NEGATIVE_INFINITY : Double.POSITIVE_INFINITY; } else if (z <= -1075) // Detect underflow. { if (z < -1075 || p_l <= z - p_h) return negative ? -0.0 : 0; } // Compute 2**(p_h+p_l). int n = round((float) z); p_h -= n; t = (float) (p_l + p_h); u = t * LN2_H; v = (p_l - (t - p_h)) * LN2 + t * LN2_L; z = u + v; w = v - (z - u); t = z * z; t1 = z - t * (P1 + t * (P2 + t * (P3 + t * (P4 + t * P5)))); double r = (z * t1) / (t1 - 2) - (w + z * w); z = scale(1 - (r - z), n); return negative ? -z : z; } | 1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/b2ed890086e708f00d163f3e8514bfa8b353f662/StrictMath.java/buggy/core/src/classpath/java/java/lang/StrictMath.java |
else { | else { | public static double pow(double x, double y) { // Special cases first. if (y == 0) return 1; if (y == 1) return x; if (y == -1) return 1 / x; if (x != x || y != y) return Double.NaN; // When x < 0, yisint tells if y is not an integer (0), even(1), // or odd (2). int yisint = 0; if (x < 0 && floor(y) == y) yisint = (y % 2 == 0) ? 2 : 1; double ax = abs(x); double ay = abs(y); // More special cases, of y. if (ay == Double.POSITIVE_INFINITY) { if (ax == 1) return Double.NaN; if (ax > 1) return y > 0 ? y : 0; return y < 0 ? -y : 0; } if (y == 2) return x * x; if (y == 0.5) return sqrt(x); // More special cases, of x. if (x == 0 || ax == Double.POSITIVE_INFINITY || ax == 1) { if (y < 0) ax = 1 / ax; if (x < 0) { if (x == -1 && yisint == 0) ax = Double.NaN; else if (yisint == 1) ax = -ax; } return ax; } if (x < 0 && yisint == 0) return Double.NaN; // Now we can start! double t; double t1; double t2; double u; double v; double w; if (ay > TWO_31) { if (ay > TWO_64) // Automatic over/underflow. return ((ax < 1) ? y < 0 : y > 0) ? Double.POSITIVE_INFINITY : 0; // Over/underflow if x is not close to one. if (ax < 0.9999995231628418) return y < 0 ? Double.POSITIVE_INFINITY : 0; if (ax >= 1.0000009536743164) return y > 0 ? Double.POSITIVE_INFINITY : 0; // Now |1-x| is <= 2**-20, sufficient to compute // log(x) by x-x^2/2+x^3/3-x^4/4. t = x - 1; w = t * t * (0.5 - t * (1 / 3.0 - t * 0.25)); u = INV_LN2_H * t; v = t * INV_LN2_L - w * INV_LN2; t1 = (float) (u + v); t2 = v - (t1 - u); } else { long bits = Double.doubleToLongBits(ax); int exp = (int) (bits >> 52); if (exp == 0) // Subnormal x. { ax *= TWO_54; bits = Double.doubleToLongBits(ax); exp = (int) (bits >> 52) - 54; } exp -= 1023; // Unbias exponent. ax = Double.longBitsToDouble((bits & 0x000fffffffffffffL) | 0x3ff0000000000000L); boolean k; if (ax < SQRT_1_5) // |x|<sqrt(3/2). k = false; else if (ax < SQRT_3) // |x|<sqrt(3). k = true; else { k = false; ax *= 0.5; exp++; } // Compute s = s_h+s_l = (x-1)/(x+1) or (x-1.5)/(x+1.5). u = ax - (k ? 1.5 : 1); v = 1 / (ax + (k ? 1.5 : 1)); double s = u * v; double s_h = (float) s; double t_h = (float) (ax + (k ? 1.5 : 1)); double t_l = ax - (t_h - (k ? 1.5 : 1)); double s_l = v * ((u - s_h * t_h) - s_h * t_l); // Compute log(ax). double s2 = s * s; double r = s_l * (s_h + s) + s2 * s2 * (L1 + s2 * (L2 + s2 * (L3 + s2 * (L4 + s2 * (L5 + s2 * L6))))); s2 = s_h * s_h; t_h = (float) (3.0 + s2 + r); t_l = r - (t_h - 3.0 - s2); // u+v = s*(1+...). u = s_h * t_h; v = s_l * t_h + t_l * s; // 2/(3log2)*(s+...). double p_h = (float) (u + v); double p_l = v - (p_h - u); double z_h = CP_H * p_h; double z_l = CP_L * p_h + p_l * CP + (k ? DP_L : 0); // log2(ax) = (s+..)*2/(3*log2) = exp + dp_h + z_h + z_l. t = exp; t1 = (float) (z_h + z_l + (k ? DP_H : 0) + t); t2 = z_l - (t1 - t - (k ? DP_H : 0) - z_h); } // Split up y into y1+y2 and compute (y1+y2)*(t1+t2). boolean negative = x < 0 && yisint == 1; double y1 = (float) y; double p_l = (y - y1) * t1 + y * t2; double p_h = y1 * t1; double z = p_l + p_h; if (z >= 1024) // Detect overflow. { if (z > 1024 || p_l + OVT > z - p_h) return negative ? Double.NEGATIVE_INFINITY : Double.POSITIVE_INFINITY; } else if (z <= -1075) // Detect underflow. { if (z < -1075 || p_l <= z - p_h) return negative ? -0.0 : 0; } // Compute 2**(p_h+p_l). int n = round((float) z); p_h -= n; t = (float) (p_l + p_h); u = t * LN2_H; v = (p_l - (t - p_h)) * LN2 + t * LN2_L; z = u + v; w = v - (z - u); t = z * z; t1 = z - t * (P1 + t * (P2 + t * (P3 + t * (P4 + t * P5)))); double r = (z * t1) / (t1 - 2) - (w + z * w); z = scale(1 - (r - z), n); return negative ? -z : z; } | 1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/b2ed890086e708f00d163f3e8514bfa8b353f662/StrictMath.java/buggy/core/src/classpath/java/java/lang/StrictMath.java |
double r = s_l * (s_h + s) + s2 * s2 * (L1 + s2 * (L2 + s2 * (L3 + s2 * (L4 + s2 * (L5 + s2 * L6))))); | double r = s_l * (s_h + s) + s2 * s2 * (L1 + s2 * (L2 + s2 * (L3 + s2 * (L4 + s2 * (L5 + s2 * L6))))); | public static double pow(double x, double y) { // Special cases first. if (y == 0) return 1; if (y == 1) return x; if (y == -1) return 1 / x; if (x != x || y != y) return Double.NaN; // When x < 0, yisint tells if y is not an integer (0), even(1), // or odd (2). int yisint = 0; if (x < 0 && floor(y) == y) yisint = (y % 2 == 0) ? 2 : 1; double ax = abs(x); double ay = abs(y); // More special cases, of y. if (ay == Double.POSITIVE_INFINITY) { if (ax == 1) return Double.NaN; if (ax > 1) return y > 0 ? y : 0; return y < 0 ? -y : 0; } if (y == 2) return x * x; if (y == 0.5) return sqrt(x); // More special cases, of x. if (x == 0 || ax == Double.POSITIVE_INFINITY || ax == 1) { if (y < 0) ax = 1 / ax; if (x < 0) { if (x == -1 && yisint == 0) ax = Double.NaN; else if (yisint == 1) ax = -ax; } return ax; } if (x < 0 && yisint == 0) return Double.NaN; // Now we can start! double t; double t1; double t2; double u; double v; double w; if (ay > TWO_31) { if (ay > TWO_64) // Automatic over/underflow. return ((ax < 1) ? y < 0 : y > 0) ? Double.POSITIVE_INFINITY : 0; // Over/underflow if x is not close to one. if (ax < 0.9999995231628418) return y < 0 ? Double.POSITIVE_INFINITY : 0; if (ax >= 1.0000009536743164) return y > 0 ? Double.POSITIVE_INFINITY : 0; // Now |1-x| is <= 2**-20, sufficient to compute // log(x) by x-x^2/2+x^3/3-x^4/4. t = x - 1; w = t * t * (0.5 - t * (1 / 3.0 - t * 0.25)); u = INV_LN2_H * t; v = t * INV_LN2_L - w * INV_LN2; t1 = (float) (u + v); t2 = v - (t1 - u); } else { long bits = Double.doubleToLongBits(ax); int exp = (int) (bits >> 52); if (exp == 0) // Subnormal x. { ax *= TWO_54; bits = Double.doubleToLongBits(ax); exp = (int) (bits >> 52) - 54; } exp -= 1023; // Unbias exponent. ax = Double.longBitsToDouble((bits & 0x000fffffffffffffL) | 0x3ff0000000000000L); boolean k; if (ax < SQRT_1_5) // |x|<sqrt(3/2). k = false; else if (ax < SQRT_3) // |x|<sqrt(3). k = true; else { k = false; ax *= 0.5; exp++; } // Compute s = s_h+s_l = (x-1)/(x+1) or (x-1.5)/(x+1.5). u = ax - (k ? 1.5 : 1); v = 1 / (ax + (k ? 1.5 : 1)); double s = u * v; double s_h = (float) s; double t_h = (float) (ax + (k ? 1.5 : 1)); double t_l = ax - (t_h - (k ? 1.5 : 1)); double s_l = v * ((u - s_h * t_h) - s_h * t_l); // Compute log(ax). double s2 = s * s; double r = s_l * (s_h + s) + s2 * s2 * (L1 + s2 * (L2 + s2 * (L3 + s2 * (L4 + s2 * (L5 + s2 * L6))))); s2 = s_h * s_h; t_h = (float) (3.0 + s2 + r); t_l = r - (t_h - 3.0 - s2); // u+v = s*(1+...). u = s_h * t_h; v = s_l * t_h + t_l * s; // 2/(3log2)*(s+...). double p_h = (float) (u + v); double p_l = v - (p_h - u); double z_h = CP_H * p_h; double z_l = CP_L * p_h + p_l * CP + (k ? DP_L : 0); // log2(ax) = (s+..)*2/(3*log2) = exp + dp_h + z_h + z_l. t = exp; t1 = (float) (z_h + z_l + (k ? DP_H : 0) + t); t2 = z_l - (t1 - t - (k ? DP_H : 0) - z_h); } // Split up y into y1+y2 and compute (y1+y2)*(t1+t2). boolean negative = x < 0 && yisint == 1; double y1 = (float) y; double p_l = (y - y1) * t1 + y * t2; double p_h = y1 * t1; double z = p_l + p_h; if (z >= 1024) // Detect overflow. { if (z > 1024 || p_l + OVT > z - p_h) return negative ? Double.NEGATIVE_INFINITY : Double.POSITIVE_INFINITY; } else if (z <= -1075) // Detect underflow. { if (z < -1075 || p_l <= z - p_h) return negative ? -0.0 : 0; } // Compute 2**(p_h+p_l). int n = round((float) z); p_h -= n; t = (float) (p_l + p_h); u = t * LN2_H; v = (p_l - (t - p_h)) * LN2 + t * LN2_L; z = u + v; w = v - (z - u); t = z * z; t1 = z - t * (P1 + t * (P2 + t * (P3 + t * (P4 + t * P5)))); double r = (z * t1) / (t1 - 2) - (w + z * w); z = scale(1 - (r - z), n); return negative ? -z : z; } | 1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/b2ed890086e708f00d163f3e8514bfa8b353f662/StrictMath.java/buggy/core/src/classpath/java/java/lang/StrictMath.java |
return negative ? Double.NEGATIVE_INFINITY : Double.POSITIVE_INFINITY; } else if (z <= -1075) | return negative ? Double.NEGATIVE_INFINITY : Double.POSITIVE_INFINITY; } else if (z <= -1075) | public static double pow(double x, double y) { // Special cases first. if (y == 0) return 1; if (y == 1) return x; if (y == -1) return 1 / x; if (x != x || y != y) return Double.NaN; // When x < 0, yisint tells if y is not an integer (0), even(1), // or odd (2). int yisint = 0; if (x < 0 && floor(y) == y) yisint = (y % 2 == 0) ? 2 : 1; double ax = abs(x); double ay = abs(y); // More special cases, of y. if (ay == Double.POSITIVE_INFINITY) { if (ax == 1) return Double.NaN; if (ax > 1) return y > 0 ? y : 0; return y < 0 ? -y : 0; } if (y == 2) return x * x; if (y == 0.5) return sqrt(x); // More special cases, of x. if (x == 0 || ax == Double.POSITIVE_INFINITY || ax == 1) { if (y < 0) ax = 1 / ax; if (x < 0) { if (x == -1 && yisint == 0) ax = Double.NaN; else if (yisint == 1) ax = -ax; } return ax; } if (x < 0 && yisint == 0) return Double.NaN; // Now we can start! double t; double t1; double t2; double u; double v; double w; if (ay > TWO_31) { if (ay > TWO_64) // Automatic over/underflow. return ((ax < 1) ? y < 0 : y > 0) ? Double.POSITIVE_INFINITY : 0; // Over/underflow if x is not close to one. if (ax < 0.9999995231628418) return y < 0 ? Double.POSITIVE_INFINITY : 0; if (ax >= 1.0000009536743164) return y > 0 ? Double.POSITIVE_INFINITY : 0; // Now |1-x| is <= 2**-20, sufficient to compute // log(x) by x-x^2/2+x^3/3-x^4/4. t = x - 1; w = t * t * (0.5 - t * (1 / 3.0 - t * 0.25)); u = INV_LN2_H * t; v = t * INV_LN2_L - w * INV_LN2; t1 = (float) (u + v); t2 = v - (t1 - u); } else { long bits = Double.doubleToLongBits(ax); int exp = (int) (bits >> 52); if (exp == 0) // Subnormal x. { ax *= TWO_54; bits = Double.doubleToLongBits(ax); exp = (int) (bits >> 52) - 54; } exp -= 1023; // Unbias exponent. ax = Double.longBitsToDouble((bits & 0x000fffffffffffffL) | 0x3ff0000000000000L); boolean k; if (ax < SQRT_1_5) // |x|<sqrt(3/2). k = false; else if (ax < SQRT_3) // |x|<sqrt(3). k = true; else { k = false; ax *= 0.5; exp++; } // Compute s = s_h+s_l = (x-1)/(x+1) or (x-1.5)/(x+1.5). u = ax - (k ? 1.5 : 1); v = 1 / (ax + (k ? 1.5 : 1)); double s = u * v; double s_h = (float) s; double t_h = (float) (ax + (k ? 1.5 : 1)); double t_l = ax - (t_h - (k ? 1.5 : 1)); double s_l = v * ((u - s_h * t_h) - s_h * t_l); // Compute log(ax). double s2 = s * s; double r = s_l * (s_h + s) + s2 * s2 * (L1 + s2 * (L2 + s2 * (L3 + s2 * (L4 + s2 * (L5 + s2 * L6))))); s2 = s_h * s_h; t_h = (float) (3.0 + s2 + r); t_l = r - (t_h - 3.0 - s2); // u+v = s*(1+...). u = s_h * t_h; v = s_l * t_h + t_l * s; // 2/(3log2)*(s+...). double p_h = (float) (u + v); double p_l = v - (p_h - u); double z_h = CP_H * p_h; double z_l = CP_L * p_h + p_l * CP + (k ? DP_L : 0); // log2(ax) = (s+..)*2/(3*log2) = exp + dp_h + z_h + z_l. t = exp; t1 = (float) (z_h + z_l + (k ? DP_H : 0) + t); t2 = z_l - (t1 - t - (k ? DP_H : 0) - z_h); } // Split up y into y1+y2 and compute (y1+y2)*(t1+t2). boolean negative = x < 0 && yisint == 1; double y1 = (float) y; double p_l = (y - y1) * t1 + y * t2; double p_h = y1 * t1; double z = p_l + p_h; if (z >= 1024) // Detect overflow. { if (z > 1024 || p_l + OVT > z - p_h) return negative ? Double.NEGATIVE_INFINITY : Double.POSITIVE_INFINITY; } else if (z <= -1075) // Detect underflow. { if (z < -1075 || p_l <= z - p_h) return negative ? -0.0 : 0; } // Compute 2**(p_h+p_l). int n = round((float) z); p_h -= n; t = (float) (p_l + p_h); u = t * LN2_H; v = (p_l - (t - p_h)) * LN2 + t * LN2_L; z = u + v; w = v - (z - u); t = z * z; t1 = z - t * (P1 + t * (P2 + t * (P3 + t * (P4 + t * P5)))); double r = (z * t1) / (t1 - 2) - (w + z * w); z = scale(1 - (r - z), n); return negative ? -z : z; } | 1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/b2ed890086e708f00d163f3e8514bfa8b353f662/StrictMath.java/buggy/core/src/classpath/java/java/lang/StrictMath.java |
public static synchronized double random() { | public static synchronized double random() { | public static synchronized double random() { if (rand == null) rand = new Random(); return rand.nextDouble(); } | 1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/b2ed890086e708f00d163f3e8514bfa8b353f662/StrictMath.java/buggy/core/src/classpath/java/java/lang/StrictMath.java |
private static int remPiOver2(double x, double[] y) { | private static int remPiOver2(double x, double[] y) { | private static int remPiOver2(double x, double[] y) { boolean negative = x < 0; x = abs(x); double z; int n; if (x < 3 * PI / 4) // If |x| is small. { z = x - PIO2_1; if ((float) x != (float) (PI / 2)) // 33+53 bit pi is good enough. { y[0] = z - PIO2_1L; y[1] = z - y[0] - PIO2_1L; } else // Near pi/2, use 33+33+53 bit pi. { z -= PIO2_2; y[0] = z - PIO2_2L; y[1] = z - y[0] - PIO2_2L; } n = 1; } else if (x <= TWO_20 * PI / 2) // Medium size. { n = (int) (2 / PI * x + 0.5); z = x - n * PIO2_1; double w = n * PIO2_1L; // First round good to 85 bits. y[0] = z - w; if (n >= 32 || (float) x == (float) (w)) { if (x / y[0] >= TWO_16) // Second iteration, good to 118 bits. { double t = z; w = n * PIO2_2; z = t - w; w = n * PIO2_2L - (t - z - w); y[0] = z - w; if (x / y[0] >= TWO_49) // Third iteration, 151 bits accuracy. { t = z; w = n * PIO2_3; z = t - w; w = n * PIO2_3L - (t - z - w); y[0] = z - w; } } } y[1] = z - y[0] - w; } else { // All other (large) arguments. int e0 = (int) (Double.doubleToLongBits(x) >> 52) - 1046; z = scale(x, -e0); // e0 = ilogb(z) - 23. double[] tx = new double[3]; for (int i = 0; i < 2; i++) { tx[i] = (int) z; z = (z - tx[i]) * TWO_24; } tx[2] = z; int nx = 2; while (tx[nx] == 0) nx--; n = remPiOver2(tx, y, e0, nx); } if (negative) { y[0] = -y[0]; y[1] = -y[1]; return -n; } return n; } | 1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/b2ed890086e708f00d163f3e8514bfa8b353f662/StrictMath.java/buggy/core/src/classpath/java/java/lang/StrictMath.java |
} else | } else | private static int remPiOver2(double x, double[] y) { boolean negative = x < 0; x = abs(x); double z; int n; if (x < 3 * PI / 4) // If |x| is small. { z = x - PIO2_1; if ((float) x != (float) (PI / 2)) // 33+53 bit pi is good enough. { y[0] = z - PIO2_1L; y[1] = z - y[0] - PIO2_1L; } else // Near pi/2, use 33+33+53 bit pi. { z -= PIO2_2; y[0] = z - PIO2_2L; y[1] = z - y[0] - PIO2_2L; } n = 1; } else if (x <= TWO_20 * PI / 2) // Medium size. { n = (int) (2 / PI * x + 0.5); z = x - n * PIO2_1; double w = n * PIO2_1L; // First round good to 85 bits. y[0] = z - w; if (n >= 32 || (float) x == (float) (w)) { if (x / y[0] >= TWO_16) // Second iteration, good to 118 bits. { double t = z; w = n * PIO2_2; z = t - w; w = n * PIO2_2L - (t - z - w); y[0] = z - w; if (x / y[0] >= TWO_49) // Third iteration, 151 bits accuracy. { t = z; w = n * PIO2_3; z = t - w; w = n * PIO2_3L - (t - z - w); y[0] = z - w; } } } y[1] = z - y[0] - w; } else { // All other (large) arguments. int e0 = (int) (Double.doubleToLongBits(x) >> 52) - 1046; z = scale(x, -e0); // e0 = ilogb(z) - 23. double[] tx = new double[3]; for (int i = 0; i < 2; i++) { tx[i] = (int) z; z = (z - tx[i]) * TWO_24; } tx[2] = z; int nx = 2; while (tx[nx] == 0) nx--; n = remPiOver2(tx, y, e0, nx); } if (negative) { y[0] = -y[0]; y[1] = -y[1]; return -n; } return n; } | 1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/b2ed890086e708f00d163f3e8514bfa8b353f662/StrictMath.java/buggy/core/src/classpath/java/java/lang/StrictMath.java |
} else if (x <= TWO_20 * PI / 2) | } else if (x <= TWO_20 * PI / 2) | private static int remPiOver2(double x, double[] y) { boolean negative = x < 0; x = abs(x); double z; int n; if (x < 3 * PI / 4) // If |x| is small. { z = x - PIO2_1; if ((float) x != (float) (PI / 2)) // 33+53 bit pi is good enough. { y[0] = z - PIO2_1L; y[1] = z - y[0] - PIO2_1L; } else // Near pi/2, use 33+33+53 bit pi. { z -= PIO2_2; y[0] = z - PIO2_2L; y[1] = z - y[0] - PIO2_2L; } n = 1; } else if (x <= TWO_20 * PI / 2) // Medium size. { n = (int) (2 / PI * x + 0.5); z = x - n * PIO2_1; double w = n * PIO2_1L; // First round good to 85 bits. y[0] = z - w; if (n >= 32 || (float) x == (float) (w)) { if (x / y[0] >= TWO_16) // Second iteration, good to 118 bits. { double t = z; w = n * PIO2_2; z = t - w; w = n * PIO2_2L - (t - z - w); y[0] = z - w; if (x / y[0] >= TWO_49) // Third iteration, 151 bits accuracy. { t = z; w = n * PIO2_3; z = t - w; w = n * PIO2_3L - (t - z - w); y[0] = z - w; } } } y[1] = z - y[0] - w; } else { // All other (large) arguments. int e0 = (int) (Double.doubleToLongBits(x) >> 52) - 1046; z = scale(x, -e0); // e0 = ilogb(z) - 23. double[] tx = new double[3]; for (int i = 0; i < 2; i++) { tx[i] = (int) z; z = (z - tx[i]) * TWO_24; } tx[2] = z; int nx = 2; while (tx[nx] == 0) nx--; n = remPiOver2(tx, y, e0, nx); } if (negative) { y[0] = -y[0]; y[1] = -y[1]; return -n; } return n; } | 1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/b2ed890086e708f00d163f3e8514bfa8b353f662/StrictMath.java/buggy/core/src/classpath/java/java/lang/StrictMath.java |
if (n >= 32 || (float) x == (float) (w)) { | if (n >= 32 || (float) x == (float) (w)) { | private static int remPiOver2(double x, double[] y) { boolean negative = x < 0; x = abs(x); double z; int n; if (x < 3 * PI / 4) // If |x| is small. { z = x - PIO2_1; if ((float) x != (float) (PI / 2)) // 33+53 bit pi is good enough. { y[0] = z - PIO2_1L; y[1] = z - y[0] - PIO2_1L; } else // Near pi/2, use 33+33+53 bit pi. { z -= PIO2_2; y[0] = z - PIO2_2L; y[1] = z - y[0] - PIO2_2L; } n = 1; } else if (x <= TWO_20 * PI / 2) // Medium size. { n = (int) (2 / PI * x + 0.5); z = x - n * PIO2_1; double w = n * PIO2_1L; // First round good to 85 bits. y[0] = z - w; if (n >= 32 || (float) x == (float) (w)) { if (x / y[0] >= TWO_16) // Second iteration, good to 118 bits. { double t = z; w = n * PIO2_2; z = t - w; w = n * PIO2_2L - (t - z - w); y[0] = z - w; if (x / y[0] >= TWO_49) // Third iteration, 151 bits accuracy. { t = z; w = n * PIO2_3; z = t - w; w = n * PIO2_3L - (t - z - w); y[0] = z - w; } } } y[1] = z - y[0] - w; } else { // All other (large) arguments. int e0 = (int) (Double.doubleToLongBits(x) >> 52) - 1046; z = scale(x, -e0); // e0 = ilogb(z) - 23. double[] tx = new double[3]; for (int i = 0; i < 2; i++) { tx[i] = (int) z; z = (z - tx[i]) * TWO_24; } tx[2] = z; int nx = 2; while (tx[nx] == 0) nx--; n = remPiOver2(tx, y, e0, nx); } if (negative) { y[0] = -y[0]; y[1] = -y[1]; return -n; } return n; } | 1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/b2ed890086e708f00d163f3e8514bfa8b353f662/StrictMath.java/buggy/core/src/classpath/java/java/lang/StrictMath.java |
} else { | } else { | private static int remPiOver2(double x, double[] y) { boolean negative = x < 0; x = abs(x); double z; int n; if (x < 3 * PI / 4) // If |x| is small. { z = x - PIO2_1; if ((float) x != (float) (PI / 2)) // 33+53 bit pi is good enough. { y[0] = z - PIO2_1L; y[1] = z - y[0] - PIO2_1L; } else // Near pi/2, use 33+33+53 bit pi. { z -= PIO2_2; y[0] = z - PIO2_2L; y[1] = z - y[0] - PIO2_2L; } n = 1; } else if (x <= TWO_20 * PI / 2) // Medium size. { n = (int) (2 / PI * x + 0.5); z = x - n * PIO2_1; double w = n * PIO2_1L; // First round good to 85 bits. y[0] = z - w; if (n >= 32 || (float) x == (float) (w)) { if (x / y[0] >= TWO_16) // Second iteration, good to 118 bits. { double t = z; w = n * PIO2_2; z = t - w; w = n * PIO2_2L - (t - z - w); y[0] = z - w; if (x / y[0] >= TWO_49) // Third iteration, 151 bits accuracy. { t = z; w = n * PIO2_3; z = t - w; w = n * PIO2_3L - (t - z - w); y[0] = z - w; } } } y[1] = z - y[0] - w; } else { // All other (large) arguments. int e0 = (int) (Double.doubleToLongBits(x) >> 52) - 1046; z = scale(x, -e0); // e0 = ilogb(z) - 23. double[] tx = new double[3]; for (int i = 0; i < 2; i++) { tx[i] = (int) z; z = (z - tx[i]) * TWO_24; } tx[2] = z; int nx = 2; while (tx[nx] == 0) nx--; n = remPiOver2(tx, y, e0, nx); } if (negative) { y[0] = -y[0]; y[1] = -y[1]; return -n; } return n; } | 1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/b2ed890086e708f00d163f3e8514bfa8b353f662/StrictMath.java/buggy/core/src/classpath/java/java/lang/StrictMath.java |
for (int i = 0; i < 2; i++) { | for (int i = 0; i < 2; i++) { | private static int remPiOver2(double x, double[] y) { boolean negative = x < 0; x = abs(x); double z; int n; if (x < 3 * PI / 4) // If |x| is small. { z = x - PIO2_1; if ((float) x != (float) (PI / 2)) // 33+53 bit pi is good enough. { y[0] = z - PIO2_1L; y[1] = z - y[0] - PIO2_1L; } else // Near pi/2, use 33+33+53 bit pi. { z -= PIO2_2; y[0] = z - PIO2_2L; y[1] = z - y[0] - PIO2_2L; } n = 1; } else if (x <= TWO_20 * PI / 2) // Medium size. { n = (int) (2 / PI * x + 0.5); z = x - n * PIO2_1; double w = n * PIO2_1L; // First round good to 85 bits. y[0] = z - w; if (n >= 32 || (float) x == (float) (w)) { if (x / y[0] >= TWO_16) // Second iteration, good to 118 bits. { double t = z; w = n * PIO2_2; z = t - w; w = n * PIO2_2L - (t - z - w); y[0] = z - w; if (x / y[0] >= TWO_49) // Third iteration, 151 bits accuracy. { t = z; w = n * PIO2_3; z = t - w; w = n * PIO2_3L - (t - z - w); y[0] = z - w; } } } y[1] = z - y[0] - w; } else { // All other (large) arguments. int e0 = (int) (Double.doubleToLongBits(x) >> 52) - 1046; z = scale(x, -e0); // e0 = ilogb(z) - 23. double[] tx = new double[3]; for (int i = 0; i < 2; i++) { tx[i] = (int) z; z = (z - tx[i]) * TWO_24; } tx[2] = z; int nx = 2; while (tx[nx] == 0) nx--; n = remPiOver2(tx, y, e0, nx); } if (negative) { y[0] = -y[0]; y[1] = -y[1]; return -n; } return n; } | 1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/b2ed890086e708f00d163f3e8514bfa8b353f662/StrictMath.java/buggy/core/src/classpath/java/java/lang/StrictMath.java |
if (negative) { | if (negative) { | private static int remPiOver2(double x, double[] y) { boolean negative = x < 0; x = abs(x); double z; int n; if (x < 3 * PI / 4) // If |x| is small. { z = x - PIO2_1; if ((float) x != (float) (PI / 2)) // 33+53 bit pi is good enough. { y[0] = z - PIO2_1L; y[1] = z - y[0] - PIO2_1L; } else // Near pi/2, use 33+33+53 bit pi. { z -= PIO2_2; y[0] = z - PIO2_2L; y[1] = z - y[0] - PIO2_2L; } n = 1; } else if (x <= TWO_20 * PI / 2) // Medium size. { n = (int) (2 / PI * x + 0.5); z = x - n * PIO2_1; double w = n * PIO2_1L; // First round good to 85 bits. y[0] = z - w; if (n >= 32 || (float) x == (float) (w)) { if (x / y[0] >= TWO_16) // Second iteration, good to 118 bits. { double t = z; w = n * PIO2_2; z = t - w; w = n * PIO2_2L - (t - z - w); y[0] = z - w; if (x / y[0] >= TWO_49) // Third iteration, 151 bits accuracy. { t = z; w = n * PIO2_3; z = t - w; w = n * PIO2_3L - (t - z - w); y[0] = z - w; } } } y[1] = z - y[0] - w; } else { // All other (large) arguments. int e0 = (int) (Double.doubleToLongBits(x) >> 52) - 1046; z = scale(x, -e0); // e0 = ilogb(z) - 23. double[] tx = new double[3]; for (int i = 0; i < 2; i++) { tx[i] = (int) z; z = (z - tx[i]) * TWO_24; } tx[2] = z; int nx = 2; while (tx[nx] == 0) nx--; n = remPiOver2(tx, y, e0, nx); } if (negative) { y[0] = -y[0]; y[1] = -y[1]; return -n; } return n; } | 1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/b2ed890086e708f00d163f3e8514bfa8b353f662/StrictMath.java/buggy/core/src/classpath/java/java/lang/StrictMath.java |
public static double rint(double a) { | public static double rint(double a) { | public static double rint(double a) { double x = abs(a); if (!(x < TWO_52)) return a; // No fraction bits; includes NaN and infinity. if (x <= 0.5) return 0 * a; // Worry about signed zero. if (x % 2 <= 0.5) return (long) a; // Catch round down to even. return (long) (a + (a < 0 ? -0.5 : 0.5)); // Cast to long truncates. } | 1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/b2ed890086e708f00d163f3e8514bfa8b353f662/StrictMath.java/buggy/core/src/classpath/java/java/lang/StrictMath.java |
if (!(x < TWO_52)) | if (! (x < TWO_52)) | public static double rint(double a) { double x = abs(a); if (!(x < TWO_52)) return a; // No fraction bits; includes NaN and infinity. if (x <= 0.5) return 0 * a; // Worry about signed zero. if (x % 2 <= 0.5) return (long) a; // Catch round down to even. return (long) (a + (a < 0 ? -0.5 : 0.5)); // Cast to long truncates. } | 1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/b2ed890086e708f00d163f3e8514bfa8b353f662/StrictMath.java/buggy/core/src/classpath/java/java/lang/StrictMath.java |
public static int round(float f) { | public static int round(float f) { | public static int round(float f) { return (int) floor(f + 0.5f); } | 1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/b2ed890086e708f00d163f3e8514bfa8b353f662/StrictMath.java/buggy/core/src/classpath/java/java/lang/StrictMath.java |
private static double scale(double x, int n) { if (x == 0 || x == Double.NEGATIVE_INFINITY || !(x < Double.POSITIVE_INFINITY) || n == 0) | private static double scale(double x, int n) { if (Configuration.DEBUG && abs(n) >= 2048) throw new InternalError("Assertion failure"); if (x == 0 || x == Double.NEGATIVE_INFINITY || ! (x < Double.POSITIVE_INFINITY) || n == 0) | private static double scale(double x, int n) { if (x == 0 || x == Double.NEGATIVE_INFINITY || !(x < Double.POSITIVE_INFINITY) || n == 0) return x; long bits = Double.doubleToLongBits(x); int exp = (int) (bits >> 52) & 0x7ff; if (exp == 0) // Subnormal x. { x *= TWO_54; exp = ((int) (Double.doubleToLongBits(x) >> 52) & 0x7ff) - 54; } exp += n; if (exp > 0x7fe) // Overflow. return Double.POSITIVE_INFINITY * x; if (exp > 0) // Normal. return Double.longBitsToDouble((bits & 0x800fffffffffffffL) | ((long) exp << 52)); if (exp <= -54) return 0 * x; // Underflow. exp += 54; // Subnormal result. x = Double.longBitsToDouble((bits & 0x800fffffffffffffL) | ((long) exp << 52)); return x * (1 / TWO_54); } | 1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/b2ed890086e708f00d163f3e8514bfa8b353f662/StrictMath.java/buggy/core/src/classpath/java/java/lang/StrictMath.java |
return Double.longBitsToDouble((bits & 0x800fffffffffffffL) | ((long) exp << 52)); | return Double.longBitsToDouble((bits & 0x800fffffffffffffL) | ((long) exp << 52)); | private static double scale(double x, int n) { if (x == 0 || x == Double.NEGATIVE_INFINITY || !(x < Double.POSITIVE_INFINITY) || n == 0) return x; long bits = Double.doubleToLongBits(x); int exp = (int) (bits >> 52) & 0x7ff; if (exp == 0) // Subnormal x. { x *= TWO_54; exp = ((int) (Double.doubleToLongBits(x) >> 52) & 0x7ff) - 54; } exp += n; if (exp > 0x7fe) // Overflow. return Double.POSITIVE_INFINITY * x; if (exp > 0) // Normal. return Double.longBitsToDouble((bits & 0x800fffffffffffffL) | ((long) exp << 52)); if (exp <= -54) return 0 * x; // Underflow. exp += 54; // Subnormal result. x = Double.longBitsToDouble((bits & 0x800fffffffffffffL) | ((long) exp << 52)); return x * (1 / TWO_54); } | 1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/b2ed890086e708f00d163f3e8514bfa8b353f662/StrictMath.java/buggy/core/src/classpath/java/java/lang/StrictMath.java |
x = Double.longBitsToDouble((bits & 0x800fffffffffffffL) | ((long) exp << 52)); | x = Double.longBitsToDouble((bits & 0x800fffffffffffffL) | ((long) exp << 52)); | private static double scale(double x, int n) { if (x == 0 || x == Double.NEGATIVE_INFINITY || !(x < Double.POSITIVE_INFINITY) || n == 0) return x; long bits = Double.doubleToLongBits(x); int exp = (int) (bits >> 52) & 0x7ff; if (exp == 0) // Subnormal x. { x *= TWO_54; exp = ((int) (Double.doubleToLongBits(x) >> 52) & 0x7ff) - 54; } exp += n; if (exp > 0x7fe) // Overflow. return Double.POSITIVE_INFINITY * x; if (exp > 0) // Normal. return Double.longBitsToDouble((bits & 0x800fffffffffffffL) | ((long) exp << 52)); if (exp <= -54) return 0 * x; // Underflow. exp += 54; // Subnormal result. x = Double.longBitsToDouble((bits & 0x800fffffffffffffL) | ((long) exp << 52)); return x * (1 / TWO_54); } | 1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/b2ed890086e708f00d163f3e8514bfa8b353f662/StrictMath.java/buggy/core/src/classpath/java/java/lang/StrictMath.java |
public static double sin(double a) { if (a == Double.NEGATIVE_INFINITY || !(a < Double.POSITIVE_INFINITY)) | public static double sin(double a) { if (a == Double.NEGATIVE_INFINITY || ! (a < Double.POSITIVE_INFINITY)) | public static double sin(double a) { if (a == Double.NEGATIVE_INFINITY || !(a < Double.POSITIVE_INFINITY)) return Double.NaN; if (abs(a) <= PI / 4) return sin(a, 0); // Argument reduction needed. double[] y = new double[2]; int n = remPiOver2(a, y); switch (n & 3) { case 0 : return sin(y[0], y[1]); case 1 : return cos(y[0], y[1]); case 2 : return -sin(y[0], y[1]); default : return -cos(y[0], y[1]); } } | 1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/b2ed890086e708f00d163f3e8514bfa8b353f662/StrictMath.java/buggy/core/src/classpath/java/java/lang/StrictMath.java |
switch (n & 3) { case 0 : | switch (n & 3) { case 0: | public static double sin(double a) { if (a == Double.NEGATIVE_INFINITY || !(a < Double.POSITIVE_INFINITY)) return Double.NaN; if (abs(a) <= PI / 4) return sin(a, 0); // Argument reduction needed. double[] y = new double[2]; int n = remPiOver2(a, y); switch (n & 3) { case 0 : return sin(y[0], y[1]); case 1 : return cos(y[0], y[1]); case 2 : return -sin(y[0], y[1]); default : return -cos(y[0], y[1]); } } | 1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/b2ed890086e708f00d163f3e8514bfa8b353f662/StrictMath.java/buggy/core/src/classpath/java/java/lang/StrictMath.java |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.