[comp.os.vms] fixes to module FLOAT in VAXCDEF.TLB

LLACROIX@carleton.EDU (Les LaCroix) (06/21/88)

A couple weeks ago I posted a note stating that the values in module FLOAT
in VAXCDEF.TLB were wrong, and I said I'd post a corrected (or at least
more correct) version soon.  I just received an SPR response from DEC,
which states: 

"Thank you for bringing the problem with the values in FLOAT.H to our
attention.  Most of the entries in the file were incorrect.

FLOAT.H will be updated in the next release of VAX C after V2.4.

While investigating your SPR, a related problem arose: FLOAT.H describes
the properties of d-floating double precision.  If a program is compiled
with /G_FLOAT, the values in FLOAT.H are of little use.  A future release
of VAX C will fix this problem.

For your information, the correct values for FLOAT.H are:

[long listing deleted]"

Please find enclosed a VMS_SHAR version of FLOAT.H.  This one has the new
values as supplied in the SPR, along with conditionals which should supply
the correct values if the code is compiled with either /G_FLOAT or
/NOG_FLOAT.  I checked this with a small test program using /NOG_FLOAT and
it appeared to generate correct code.  I have NOT verified any of the code
to support /G_FLOAT -- I'm not even 100% confident that I typed everything
in correctly, let alone that it won't be trashed in transit! 

I checked with Digital Customer Support in Colorado and they said it was
o.k. to send this file out.  They did ask me to remind everyone, though,
that THIS VERSION OF FLOAT.H IS NOT SUPPORTED BY DEC.  The old FLOAT.H
(with wrong values, as distributed with VAX C V2.3 and V2.4) is currently
the supported header. 

Les LaCroix
SPSS Inc., 402 Washington, Northfield MN USA 55057-2027 tel 507/663-1205
lacroix%spssnf@carleton.edu (CSnet)
lacroix%spssnf.carleton.edu@relay.cs.net (BITNET)

....................... Cut between dotted lines and save ......................
$!..............................................................................
$! VAX/VMS archive file created by VMS_SHAR V-4.04 15-Sep-1987
$! which was written by Michael Bednarek (U3369429@ucsvc.dn.mu.oz.au)
$! To unpack, simply save and execute (@) this file.
$!
$! This archive was created by LACROIX
$!      on Monday 20-JUN-1988 14:46:06.14
$!
$! It contains the following 1 file:
$! FLOAT.H
$!==============================================================================
$ Set Symbol/Scope=(NoLocal,NoGlobal)
$ Version=F$GetSYI("VERSION") ! See what VMS version we have here:
$ If Version.ges."V4.4" then goto Version_OK
$ Write SYS$Output "Sorry, you are running VMS ",Version, -
                ", but this procedure requires V4.4 or higher."
$ Exit 44
$Version_OK: CR[0,8]=13
$ Pass_or_Failed="failed!,passed."
$ Goto Start
$Convert_File:
$ Read/Time_Out=0/Error=No_Error1/Prompt="creating ''File_is'" SYS$Command ddd
$No_Error1: Define/User_Mode SYS$Output NL:
$ Edit/TPU/NoSection/NoDisplay/Command=SYS$Input/Output='File_is' -
        VMS_SHAR_DUMMY.DUMMY
f:=Get_Info(Command_Line,"File_Name");b:=Create_Buffer("",f);
o:=Get_Info(Command_Line,"Output_File");Set (Output_File,b,o);
Position (Beginning_of(b));Loop x:=Erase_Character(1); Loop ExitIf x<>"V";
Move_Vertical(1);x:=Erase_Character(1);Append_Line;Move_Horizontal
(-Current_Offset);EndLoop;Move_Vertical(1);ExitIf Mark(None)=End_of(b)
EndLoop;Exit;
$ Delete VMS_SHAR_DUMMY.DUMMY;*
$ Checksum 'File_is
$ Success=F$Element(Check_Sum_is.eq.CHECKSUM$CHECKSUM,",",Pass_or_Failed)+CR
$ Read/Time_Out=0/Error=No_Error2/Prompt=" CHECKSUM ''Success'" SYS$Command ddd
$No_Error2: Return
$Start:
$ File_is="FLOAT.H"
$ Check_Sum_is=1261189777
$ Copy SYS$Input VMS_SHAR_DUMMY.DUMMY
X/*	FLOAT - Definitions  ANSII 2.2.4.2	 */
X#ifndef __FLOAT
X#define __FLOAT
X
X/* Rounding mode for floating point addition.
X */
X#define		FLT_ROUNDS	1		/* To nearest value */
X
X/* Radix of exponent representation
X */
X#define		FLT_RADIX	2
X
X/* Number of FLT_RADIX digits in the mantissa including the hidden bit.
X */
X#define		FLT_MANT_DIG	24
X#if CC$gfloat
X#define		DBL_MANT_DIG	53
X#define		LDBL_MANT_DIG	53
X#else
X#define		DBL_MANT_DIG	56
X#define		LDBL_MANT_DIG	56
X#endif
X
X/* Number of decimal digits of precision.
X */
X#define		FLT_DIG		6
X#if CC$gfloat
X#define 	DBL_DIG		15
X#define		LDBL_DIG	15
X#else
X#define 	DBL_DIG		16
X#define		LDBL_DIG	16
X#endif
X
X/* Minimum negative number that FLT_RADIX raised to that (power minus
X * one) is a normalized floating-point number.
X */
X#define		FLT_MIN_EXP	(-127)
X#if CC$gfloat
X#define		DBL_MIN_EXP	(-1023)
X#define		LDBL_MIN_EXP	(-1023)
X#else
X#define		DBL_MIN_EXP	(-127)
X#define		LDBL_MIN_EXP	(-127)
X#endif
X
X/* Minimum negative integer such that 10 raised to that power is in the
X * range of normalized floating-point numbers.
X */
X#define		FLT_MIN_10_EXP  (-38)
X#if CC$gfloat
X#define		DBL_MIN_10_EXP	(-308)
X#define		LDBL_MIN_10_EXP	(-308)
X#else
X#define		DBL_MIN_10_EXP	(-38)
X#define		LDBL_MIN_10_EXP	(-38)
X#endif
X
X/* Maximum integer such that FLT_RADIX raised that that (power minus one)
X * is a representable finite floating-point number.
X */
X#define		FLT_MAX_EXP	127
X#if CC$gfloat
X#define		DBL_MAX_EXP	1023
X#define		LDBL_MAX_EXP	1023
X#else
X#define		DBL_MAX_EXP	127
X#define		LDBL_MAX_EXP	127
X#endif
X
X/* Maximum integer such that 10 raised to that power is in the range of
X * representable finite floating-point numbers.
X */
X#define		FLT_MAX_10_EXP	38
X#if CC$gfloat
X#define		DBL_MAX_10_EXP	307
X#define		LDBL_MAX_10_EXP	307
X#else
X#define		DBL_MAX_10_EXP	38
X#define		LDBL_MAX_10_EXP	38
X#endif
X
X/* Maximum representable finite floating-point number. */
X#define		FLT_MAX		((float) 1.7014117e+38)
X#if CC$gfloat
X#define		DBL_MAX		8.98846567431157854e+307
X#define		LDBL_MAX	8.98846567431157854e+307
X#else
X#define		DBL_MAX		1.70141183460469229e+38
X#define		LDBL_MAX	1.70141183460469229e+38
X#endif
X
X/* Minimum positive floating-point number epsilon such that
X *   1.0 + epsilon != 1.0
X */
X#define		FLT_EPSILON	((float) (1.0 / 16777216))
X#if CC$gfloat
X#define		DBL_EPSILON	(1.0 / 1048576 / 1048576 / 8192)
X#define		LDBL_EPSILON	(1.0 / 1048576 / 1048576 / 8192)
X#else
X#define		DBL_EPSILON	(1.0 / 1048576 / 1048576 / 65536 )
X#define		LDBL_EPSILON	(1.0 / 1048576 / 1048576 / 65536 )
X#endif
X
X/* Minimum normalized positive floating-point number */
X#define		FLT_MIN		((float) 2.93873587705571877e-39)
X#if CC$gfloat
X#define		DBL_MIN		5.56268464626800346e-309
X#define		LDBL_MIN	5.56268464626800346e-309
X#else
X#define		DBL_MIN		2.93873587705571877e-39
X#define		LDBL_MIN	2.93873587705571877e-39
X#endif
X
X#endif
$ GoSub Convert_File
$ Exit