Thread View: gnu.gcc.bug
1 messages
1 total messages
Started by Fred J. Tydeman
Tue, 10 Dec 1996 00:00
x87 infinity problem
Author: Fred J. Tydeman
Date: Tue, 10 Dec 1996 00:00
Date: Tue, 10 Dec 1996 00:00
66 lines
3262 bytes
3262 bytes
/* Program: gccemx02.c from tydeman @ tybor.com */
/* */
/* Problem: On Intel x87 systems, long double infinity has one of two */
/* problems (either turns an infinity into a NaN(Not a Number)): */
/* missing a bit 7fff000000000000 */
/* an extra bit set 7fffc00000000000 */
/* (correct is 7fff800000000000) */
/* */
/* You may need to look at the generated assembler code to see them. */
/* */
/* */
/* Hardware: Intel 80486DX/33 */
/* Operating system: OS/2 2.3 (Warp) */
/* Compiler: gcc 2.7.2.1 + emx 0.9c */
/* Compiler: gcc 2.7.2 + emx 0.9b + fix 05 */
/* Compiler: gcc 2.5.7 + emx 0.8h */
/* gcc options: */
/* "-ansi", */
/* "-pedantic-errors", */
/* "-W", */
/* "-Wall", */
/* "-Wtraditional", */
/* "-Wshadow", */
/* "-Wpointer-arith", */
/* "-Wcast-qual", */
/* "-Wcast-align", */
/* "-Wstrict-prototypes", */
/* "-Wmissing-prototypes", */
/* "-Wredundant-decls", */
/* "-Wno-unused", */
/* "-mieee-fp", */
/* "-fno-fast-math", */
/* "-ffloat-store", */
/* "-fno-builtin", */
/* "-Wconversion" */
#define MAX_LDBL 1.1897314953572317650e+4932L /* max finite number */
#include <stdio.h> /* printf() */
int main( void ){
(void)printf("These should all be + or - infinity (not NaN)\n");
/* 2.7.2.1 2.7.2 2.5.7 */
(void)printf("%Lg\n", MAX_LDBL * MAX_LDBL ); /* inf inf small */
(void)printf("%Lg\n", MAX_LDBL + MAX_LDBL ); /* nan nan nan */
(void)printf("%Lg\n", 1.e4932L * 1.e4932L ); /* inf inf small */
(void)printf("%Lg\n", 1.e4932L + 1.e4932L ); /* nan nan nan */
(void)printf("%Lg\n", 1.0L/0.0L ); /* inf inf small */
(void)printf("%Lg\n", 1.0e99999L ); /* inf inf small */
(void)printf("%Lg\n",-(MAX_LDBL * MAX_LDBL) );/* -inf -inf small */
(void)printf("%Lg\n",-(MAX_LDBL + MAX_LDBL) );/* nan nan nan */
(void)printf("%Lg\n",-(1.e4932L * 1.e4932L) );/* -inf -inf small */
(void)printf("%Lg\n",-(1.e4932L + 1.e4932L) );/* nan nan nan */
(void)printf("%Lg\n",-1.0L/0.0L ); /* -inf nan small */
(void)printf("%Lg\n",-1.0e99999L ); /* -inf -inf small */
return 0;
}
---
Fred J. Tydeman +49 (7031) 288-964 Tydeman Consulting
Meisenweg 20 tydeman@tybor.com Programming, testing, C/C++ training
D-71032 Boeblingen Voting member of X3J11 (ANSI "C")
Germany Sample FPCE tests: ftp://ftp.netcom.com/pub/ty/tydeman
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads