...
Code Block |
---|
#include<stdio.h>
float x = 0x1p-125;
double y = 0x1p-1020;
printf("normalized float with %%e : %e\n", x);
printf("normalized float with %%a : %a\n", x);
x = 0x1p-140;
printf("denormalized float with %%e : %e\n", x);
printf("denormalized float with %%a : %a\n", x);
printf("normalized double with %%e : %e\n", y);
printf("normalized double with %%a : %a\n", y);
y = 0x1p-1050;
printf("denormalized double with %%e : %e\n", y);
printf("denormalized double with %%a : %a\n", y);
|
...
Wiki Markup |
---|
\[[IEEE 754|AA. Bibliography#IEEE 754 2006]\] \[[Bryant 2003|AA. Bibliography#Bryant 03]\] Computer Systems: A Programmer's Perspective. Section 2.4 Floating Point |
...
FLP04FLP05-C. Check floating point inputs for exceptional values 05. Floating Point (FLP) FLP30-C. Do not use floating point variables as loop countersDon't use denormalized numbers FLP05-C. Don't use denormalized numbers FLP06-C. Understand that floating-point arithmetic in C is inexact