🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.bug
Article #6045

x87 infinity problem

#6045
From: Fred J. Tydeman
Date: Tue, 10 Dec 1996 00:00
66 lines
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
Technical Details
Message-ID: <m0vXTvm-000K9hC@hq.seicom.de>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 113d02,be26012716b9e1ba,start
X-Google-Attributes: gid113d02,public
From: "Fred J. Tydeman" <tydeman@tybor.com>
Subject: x87 infinity problem
Date: 1996/12/10
Message-ID: <m0vXTvm-000K9hC@hq.seicom.de>
X-Deja-AN: 203441882
sender: bug-gcc-request@prep.ai.mit.edu
priority: Normal
content-type: text/plain; charset="iso-8859-1"
x-gateway: relay2.UU.NET from bug-gcc to gnu.gcc.bug; Tue, 10 Dec 1996 23:49:00 EST
mime-version: 1.0
reply-to: "Fred J. Tydeman" <tydeman@tybor.com>
newsgroups: gnu.gcc.bug
x-mailer: Fred J. Tydeman's Registered PMMail 1.53 For OS/2