* i370 float.h values?
@ 2002-09-02 15:08 Richard Henderson
2002-09-02 15:32 ` David Edelsohn
0 siblings, 1 reply; 6+ messages in thread
From: Richard Henderson @ 2002-09-02 15:08 UTC (permalink / raw)
To: gcc; +Cc: uweigand
I've not located a proper description of the IBM 370 floating-point
format, and based on the one thing I found:
Float name Radix Sign Exponent Fraction Bias
---------- ----- ---- -------- -------- -----
IBM 370:
* REAL*4 16 1 7 24 64 0.f * 16**(e-64)
* REAL*8 16 1 7 56 64
I came up with the fundamental constants
#define __FLT_RADIX__ 16
#define __FLT_MANT_DIG__ 6
#define __FLT_MIN_EXP__ (-63)
#define __FLT_MAX_EXP__ 63
#define __DBL_MANT_DIG__ 14
#define __DBL_MIN_EXP__ (-63)
#define __DBL_MAX_EXP__ 63
from which I derive the rest of the values:
#define __DECIMAL_DIG__ 18
#define __FLT_DIG__ 6
#define __FLT_EPSILON__ 0x1p-20F
#define __FLT_MAX_10_EXP__ 75
#define __FLT_MAX__ 0x1.fffffep251F
#define __FLT_MIN_10_EXP__ (-77)
#define __FLT_MIN__ 0x1p-67F
#define __DBL_DIG__ 15
#define __DBL_EPSILON__ 0x1p-52
#define __DBL_MAX_10_EXP__ 75
#define __DBL_MAX__ 0x1.fffffffffffffep251
#define __DBL_MIN_10_EXP__ (-77)
#define __DBL_MIN__ 0x1p-67
Can someone check these values against a proper ibm 370 float.h?
If they're wrong, I'd also appreciate a pointer to the format so
that I can understand how I messed up.
r~
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: i370 float.h values?
2002-09-02 15:08 i370 float.h values? Richard Henderson
@ 2002-09-02 15:32 ` David Edelsohn
0 siblings, 0 replies; 6+ messages in thread
From: David Edelsohn @ 2002-09-02 15:32 UTC (permalink / raw)
To: Richard Henderson; +Cc: gcc, uweigand
>>>>> Richard Henderson writes:
Richard> I've not located a proper description of the IBM 370 floating-point
Richard> format.
Are the S/390 and z/Architecture Principles of Operations (POP)
sufficient to describe this?
S/390 Chapter 9.3 Floatin-Point Data Format:
http://publibz.boulder.ibm.com:80/cgi-bin/bookmgr_OS390/BOOKS/DZ9AR001/9.3?DT=19930923083613
S/390 POP Table of Contents:
http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/DZ9AR001/CCONTENTS
Link to most recent POP (z/Architecture):
http://www-1.ibm.com/servers/s390/os390/bkserv/latest/z_arch.html
David
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: i370 float.h values?
@ 2002-09-03 6:15 Ulrich Weigand
0 siblings, 0 replies; 6+ messages in thread
From: Ulrich Weigand @ 2002-09-03 6:15 UTC (permalink / raw)
To: Richard Henderson; +Cc: gcc
Richard Henderson wrote:
>#define __DBL_MAX_EXP__ 64
>#define __DBL_MAX__ 0x0.ffffffffffffffp256 // 1.15792089237316193817e+77
>#define __FLT_MAX_EXP__ 64
>#define __FLT_MAX__ 0x0.ffffffp256F // 1.15792082335569848633e+77
These look wrong to me; they were correct the first time.
We have a 7-bit characteristic, with an exponent bias of -64.
No characteristic value is reserved for any special meaning.
This means the exponent ranges from -64 to +63.
So we should have a maximum exponent of 63, and maxmium values
in the order of 2**252. (The PoP states the maximum value is
about 7.2e+75.)
Mit freundlichen Gruessen / Best Regards
Ulrich Weigand
--
Dr. Ulrich Weigand
Linux for S/390 Design & Development
IBM Deutschland Entwicklung GmbH, Schoenaicher Str. 220, 71032 Boeblingen
Phone: +49-7031/16-3727 --- Email: Ulrich.Weigand@de.ibm.com
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: i370 float.h values?
2002-09-02 16:19 Ulrich Weigand
2002-09-02 20:12 ` Richard Henderson
@ 2002-09-03 1:20 ` Richard Henderson
1 sibling, 0 replies; 6+ messages in thread
From: Richard Henderson @ 2002-09-03 1:20 UTC (permalink / raw)
To: Ulrich Weigand; +Cc: gcc, uweigand
On Tue, Sep 03, 2002 at 01:19:19AM +0200, Ulrich Weigand wrote:
> >Can someone check these values against a proper ibm 370 float.h?
>
> I'll try to find one tomorrow ... For now, I've just looked
> at the format specification.
FYI, my current set of values for 370 is
#define __DBL_EPSILON__ 0x1p-52 // 2.22044604925031308085e-16
#define __DBL_MANT_DIG__ 14
#define __DBL_MAX_10_EXP__ 77
#define __DBL_MAX_EXP__ 64
#define __DBL_MAX__ 0x0.ffffffffffffffp256 // 1.15792089237316193817e+77
#define __DBL_MIN_10_EXP__ (-78)
#define __DBL_MIN_EXP__ (-64)
#define __DBL_MIN__ 0x1p-260 // 5.39760534693402789087e-79
#define __DECIMAL_DIG__ 18
#define __FLT_DIG__ 6
#define __FLT_EPSILON__ 0x1p-20F // 9.53674316406250000000e-07
#define __FLT_EVAL_METHOD__ 0
#define __FLT_MANT_DIG__ 6
#define __FLT_MAX_10_EXP__ 77
#define __FLT_MAX_EXP__ 64
#define __FLT_MAX__ 0x0.ffffffp256F // 1.15792082335569848633e+77
#define __FLT_MIN_10_EXP__ (-78)
#define __FLT_MIN_EXP__ (-64)
#define __FLT_MIN__ 0x1p-260F // 5.39760534693402789087e-79
#define __FLT_RADIX__ 16
Hopefully I'll get the patch cleaned up tomorrow so other folk
can lay eyes on it.
r~
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: i370 float.h values?
2002-09-02 16:19 Ulrich Weigand
@ 2002-09-02 20:12 ` Richard Henderson
2002-09-03 1:20 ` Richard Henderson
1 sibling, 0 replies; 6+ messages in thread
From: Richard Henderson @ 2002-09-02 20:12 UTC (permalink / raw)
To: Ulrich Weigand; +Cc: gcc, uweigand
On Tue, Sep 03, 2002 at 01:19:19AM +0200, Ulrich Weigand wrote:
> and instead of
> >#define __FLT_MIN__ 0x1p-67F
> >#define __DBL_MIN__ 0x1p-67
> we should have
> #define __FLT_MIN__ 0x1p-260F
> #define __DBL_MIN__ 0x1p-260
>
> (I don't quite see where the 67 comes from ...)
Oops, typo. Added log2_b instead of multiplying by it.
I'll see about the other off-by-a-couple errors in a bit.
r~
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: i370 float.h values?
@ 2002-09-02 16:19 Ulrich Weigand
2002-09-02 20:12 ` Richard Henderson
2002-09-03 1:20 ` Richard Henderson
0 siblings, 2 replies; 6+ messages in thread
From: Ulrich Weigand @ 2002-09-02 16:19 UTC (permalink / raw)
To: rth; +Cc: gcc, uweigand
Richard Henderson wrote:
>I came up with the fundamental constants
>
>#define __FLT_RADIX__ 16
>#define __FLT_MANT_DIG__ 6
>#define __FLT_MIN_EXP__ (-63)
>#define __FLT_MAX_EXP__ 63
>#define __DBL_MANT_DIG__ 14
>#define __DBL_MIN_EXP__ (-63)
>#define __DBL_MAX_EXP__ 63
Since characteristic 0 is not reserved in the
IBM ("hexadecimal") floating point format, the
minimum exponent of both formats should be -64,
not -63.
Thus, the smallest normalised number is
0x00100000
which corresponds to
0.1_(16) x 16 ** (-64) == 16 ** (-65) == 2 ** (-260),
and instead of
>#define __FLT_MIN__ 0x1p-67F
>#define __DBL_MIN__ 0x1p-67
we should have
#define __FLT_MIN__ 0x1p-260F
#define __DBL_MIN__ 0x1p-260
(I don't quite see where the 67 comes from ...)
This corresponds to
#define __FLT_MIN_10_EXP__ (-78)
#define __DBL_MIN_10_EXP__ (-78)
instead of
>#define __FLT_MIN_10_EXP__ (-77)
>#define __DBL_MIN_10_EXP__ (-77)
The rest looks OK to me.
>Can someone check these values against a proper ibm 370 float.h?
I'll try to find one tomorrow ... For now, I've just looked
at the format specification.
>If they're wrong, I'd also appreciate a pointer to the format so
>that I can understand how I messed up.
David already sent you a link to the PoP.
Bye,
Ulrich
--
Dr. Ulrich Weigand
weigand@informatik.uni-erlangen.de
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2002-09-03 13:15 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-09-02 15:08 i370 float.h values? Richard Henderson
2002-09-02 15:32 ` David Edelsohn
2002-09-02 16:19 Ulrich Weigand
2002-09-02 20:12 ` Richard Henderson
2002-09-03 1:20 ` Richard Henderson
2002-09-03 6:15 Ulrich Weigand
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).