...
The following code tests whether a float
value is denormalized in strictfp FP-strict mode or for platforms that lack extended range support. Testing for denormalized numbers in the presence of extended range support is platform-dependent; see rule NUM06-J for additional information.
...
Here is a small program, along with its output, that demonstrates the print representation of denormalized numbers.
Code Block |
---|
strictfp class FloatingPointFormats {
public static void main(String[] args) {
float x = 0x1p-125f;
double y = 0x1p-1020;
System.out.format("normalized float with %%e : %e\n", x);
System.out.format("normalized float with %%a : %a\n", x);
x = 0x1p-140f;
System.out.format("denormalized float with %%e : %e\n", x);
System.out.format("denormalized float with %%a : %a\n", x);
System.out.format("normalized double with %%e : %e\n", y);
System.out.format("normalized double with %%a : %a\n", y);
y = 0x1p-1050;
System.out.format("denormalized double with %%e : %e\n", y);
System.out.format("denormalized double with %%a : %a\n", y);
}
}
|
...
Because this operation is imprecise, this code produces the following output when run in FP-strict mode:
Code Block |
---|
Original : 0.33333334 Denormalized : 2.8E-45 Restored : 0.4 |
...
This code produces the following output in FP-strict mode:
Code Block |
---|
Original : 0.3333333333333333 Denormalized : 2.333333333333333E-45 Restored : 0.3333333333333333 |
...
CVE-2010-4476 [CVE 2008 ] reports a vulnerability in the Double.parseDouble()
method in Java 1.6 update 23 and earlier, Java 1.5 update 27 and earlier, and 1.4.2_29 and earlier. This vulnerability causes a DoS denial of service when this method is passed a crafted string argument. The value 2.2250738585072012e-308 is close to the minimum normalized, positiv,e double-precision floating-point number, and when encoded as a string, it triggers an infinite loop of estimations during conversion to a normalized or denormalized double
.
...
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="0c893a1b03aa7c68-f7c0c975-484e44a0-ad41b797-f7901c63ccb1fdf56580fe83"><ac:plain-text-body><![CDATA[ | [[Bryant 2003 | AA. Bibliography#Bryant 03]] | Computer Systems: A Programmer's Perspective, Section 2.4, Floating Point | ]]></ac:plain-text-body></ac:structured-macro> | |
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="8d0dfc4363e78a49-b185623b-41ef40d9-bf5d85aa-5c2eee94dd5ac8a2633912ce"><ac:plain-text-body><![CDATA[ | [[CVE 2008 | AA. Bibliography#CVE 08]] | [CVE-2010-4476 | http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2010-4476] | ]]></ac:plain-text-body></ac:structured-macro> |
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="b52ce93d15326771-689128cf-4e724c82-bd86ad16-4617173c29cf81e256eee250"><ac:plain-text-body><![CDATA[ | [[IEEE 754 | AA. Bibliography#IEEE 754 2006]] |
| ]]></ac:plain-text-body></ac:structured-macro> |
...