[PATCH, final] Formatted output of IEEE exceptional values

Jerry DeLisle jvdelisle@verizon.net
Sat Jul 23 06:27:00 GMT 2005


The attached patch and test case reflect the additional case of a field 
width specified as zero.

F2003 says: "When w is zero, the processor selects the field width".

I have selected that width to be 4 in the case of exceptional values to 
output -Inf or +Inf

F2003 also says: "If w is less than 3, the field is filled with 
asterisks; otherwise; if w is less than 8, 'Inf' is produced".

The negative sign is not optional, so I have interpreted the case of w=3 
to  be -Inf which exceeds the field width and so asterisks are produced.

The result is as follows:

F0.0  |       -Inf|       +Inf|        NaN|        NaN|
F1.0  |          *|          *|          *|          *|
F2.0  |         **|         **|         **|         **|
F3.0  |        ***|        Inf|        NaN|        NaN|
F4.0  |       -Inf|       +Inf|        NaN|        NaN|
F5.0  |       -Inf|       +Inf|        NaN|        NaN|
F6.0  |       -Inf|       +Inf|        NaN|        NaN|
F7.0  |       -Inf|       +Inf|        NaN|        NaN|
F8.0  |       -Inf|       +Inf|        NaN|        NaN|
F9.0  |  -Infinity|  +Infinity|        NaN|        NaN|
F10.0 |  -Infinity|  +Infinity|        NaN|        NaN|

Note that in the case of F0 the four characters will be written to the 
right of the current position since there is no actual field to align with.

Bubblestrapped and reg tested.

2005-07-23  Jerry DeLisle  <jvdelisle@verizon.net>

	* io/write.c (write_float): Revise output of IEEE exceptional
	values to comply with F95 and F2003 standards.

OK for mainline and 4.0?

Regards,

Jerry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ieee.diff
Type: text/x-patch
Size: 1060 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20050723/1fdef173/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: nan-inf.diff
Type: text/x-patch
Size: 1211 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20050723/1fdef173/attachment-0001.bin>


More information about the Gcc-patches mailing list