* DU4.0 cxx|cc MINFLOAT and MINDOUBLE wrong?
@ 1997-02-11 5:00 Armin Wittmann
1997-02-11 5:00 ` Lawrence Kirby
1997-02-11 5:00 ` Daniel S. Riley
0 siblings, 2 replies; 3+ messages in thread
From: Armin Wittmann @ 1997-02-11 5:00 UTC (permalink / raw)
Machine: DEC alpha 3000 300/300L AXP
OS: Digital Unix 4.0
In the headerfile /usr/include/values.h
are all the max-min-values defined!
I was surprised to see that the values of
MINFLOAT and MINDOUBLE
are defined less then the compiler can work with!
First I thought that it is a problem with the parser
but it is not.
Then I compared the cxx and cc and it is with both the same!
float f1 = 1.4e-38; // is ok
float f2 = f1/10; // is NOT ok!
float f3 = f2*10; // is still NOT ok!
cout and printf gave the same results for f1,f2,f3:
float f1: 1.4013e-38
float f2: 0
float f3: 0
MINFLOAT is defined as 1.40129846432481707e-45!!!
This is the real minimun with the denormalized form.
Is it true that DEC does not support this but the
minimum is defined as this?
It is pretty amazing.
With MAXFLOAT and MAXDOUBLE everything is ok.
Does somebody have work-arounds or patches?
Remark: On a Sun UltraSparc with Solaris 2.5 everything is
ok with CC and cc!
Armin
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: DU4.0 cxx|cc MINFLOAT and MINDOUBLE wrong?
1997-02-11 5:00 DU4.0 cxx|cc MINFLOAT and MINDOUBLE wrong? Armin Wittmann
@ 1997-02-11 5:00 ` Lawrence Kirby
1997-02-11 5:00 ` Daniel S. Riley
1 sibling, 0 replies; 3+ messages in thread
From: Lawrence Kirby @ 1997-02-11 5:00 UTC (permalink / raw)
In article <33005FC7.41C6@ife.ee.ethz.ch>
witt@ife.ee.ethz.ch "Armin Wittmann" writes:
>Machine: DEC alpha 3000 300/300L AXP
>OS: Digital Unix 4.0
>
>In the headerfile /usr/include/values.h
>are all the max-min-values defined!
values.h is not a standard C language header. The headers that define
type limits are limits.h for integral types and float.h for floating
point types.
>I was surprised to see that the values of
>
>MINFLOAT and MINDOUBLE
The macros you want are called FLT_MIN and DBL_MIN in float.h. values.h is
obsolete and not portable.
>are defined less then the compiler can work with!
>First I thought that it is a problem with the parser
>but it is not.
>Then I compared the cxx and cc and it is with both the same!
>
>float f1 = 1.4e-38; // is ok
>float f2 = f1/10; // is NOT ok!
>float f3 = f2*10; // is still NOT ok!
>
>cout and printf gave the same results for f1,f2,f3:
>float f1: 1.4013e-38
>float f2: 0
>float f3: 0
>
>MINFLOAT is defined as 1.40129846432481707e-45!!!
>This is the real minimun with the denormalized form.
Do you have the same problem with FLT_MIN and DBL_MIN?
--
-----------------------------------------
Lawrence Kirby | fred@genesis.demon.co.uk
Wilts, England | 70734.126@compuserve.com
-----------------------------------------
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: DU4.0 cxx|cc MINFLOAT and MINDOUBLE wrong?
1997-02-11 5:00 DU4.0 cxx|cc MINFLOAT and MINDOUBLE wrong? Armin Wittmann
1997-02-11 5:00 ` Lawrence Kirby
@ 1997-02-11 5:00 ` Daniel S. Riley
1 sibling, 0 replies; 3+ messages in thread
From: Daniel S. Riley @ 1997-02-11 5:00 UTC (permalink / raw)
To: Armin Wittmann
[mailed and posted, followup-to set]
Armin Wittmann <witt@ife.ee.ethz.ch> writes:
> Machine: DEC alpha 3000 300/300L AXP
> OS: Digital Unix 4.0
[...]
> I was surprised to see that the values of
> MINFLOAT and MINDOUBLE
> are defined less then the compiler can work with!
Try 'cxx -ieee'. The default compiler settings produce code that is
not IEEE conformant, since getting all the fiddly bits right creates a
lot of extra work for the processor which slows down benchmarks. The
'-ieee' flag should fix it under 4.0--for earlier versions you need
some different set of flags, and I'm not even sure you can get the
right behavior out of cxx under older OS versions. (Tested under DUX
4.0B with cxx 5.4-006.)
--
Dan Riley dsr@mail.lns.cornell.edu
Wilson Lab, Cornell University HEPNET/SPAN: lns598::dsr (44630::dsr)
http://www.lns.cornell.edu/~dsr/ "Distance means nothing/To me" -Kate Bush
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~1997-02-11 5:00 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1997-02-11 5:00 DU4.0 cxx|cc MINFLOAT and MINDOUBLE wrong? Armin Wittmann
1997-02-11 5:00 ` Lawrence Kirby
1997-02-11 5:00 ` Daniel S. Riley
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox