...
Code Block |
---|
strictfp public static boolean isDenormalized(float val) { if (val == 0) { return false; } if ((val > -Float.MIN_NORMAL) && (val < Float.MIN_NORMAL)) { return true; } return false; } |
Testing whether values of type double
are denormalized is analogous.
...
Code Block |
---|
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); } } |
Code Block |
---|
normalized float with %e : 2.350989e-38 normalized float with %a : 0x1.0p-125 denormalized float with %e : 7.174648e-43 denormalized float with %a : 0x1.0p-140 normalized double with %e : 8.900295e-308 normalized double with %a : 0x1.0p-1020 denormalized double with %e : 8.289046e-317 denormalized double with %a : 0x0.0000001p-1022 |
...
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="7567288a80056510-fecbc3e8-456d44c4-99a7bb19-06abe5dd6e9cfaafc1a9efa3"><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="8a77451378f53ce6-b858a304-411448b9-be18928c-facfcb9d3461fbb6da4318c9"><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="514e28bdf0c6f717-f13ab761-4f204caf-b6c89c80-a50a4dde4240ce5f1519ea57"><ac:plain-text-body><![CDATA[ | [[IEEE 754 | AA. Bibliography#IEEE 754 2006]] |
| ]]></ac:plain-text-body></ac:structured-macro> |
...