You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@stdcxx.apache.org by Farid Zaripov <Fa...@epam.com> on 2008/02/21 16:49:33 UTC

[PATCH] etc/config/src/INFINITY.cpp

  I see that the in ldbl_denorm_min() used DBL_MIN constant.
Is this by design, or a bug?

  Below is a patch to make ldbl_denorm_min() consistent with
dbl_denorm_min() and flt_denorm_min().

Index: etc/config/src/INFINITY.cpp
===================================================================
--- etc/config/src/INFINITY.cpp	(revision 629828)
+++ etc/config/src/INFINITY.cpp	(working copy)
@@ -720,8 +720,8 @@
     for (volatile long double tmp = 1.0L; tmp; tmp /= 2.0L)
         val.val = tmp;
 
-    if (DBL_MIN < val.val)
-        val.val = DBL_MIN;
+    if (LDBL_MIN <= val.val)
+        val.val = 0.0L;
 
 #else
 

Farid.

Re: [PATCH] etc/config/src/INFINITY.cpp

Posted by Martin Sebor <se...@roguewave.com>.
Farid Zaripov wrote:
>   I see that the in ldbl_denorm_min() used DBL_MIN constant.
> Is this by design, or a bug?

I suspect it's a benign bug (copy and paste typo).

> 
>   Below is a patch to make ldbl_denorm_min() consistent with
> dbl_denorm_min() and flt_denorm_min().

Shouldn't the value be set to LDBL_MIN instead of 0? And has_denorm
to the result of denorm_min() < min() instead of denorm_min() != 0?

Martin

> 
> Index: etc/config/src/INFINITY.cpp
> ===================================================================
> --- etc/config/src/INFINITY.cpp	(revision 629828)
> +++ etc/config/src/INFINITY.cpp	(working copy)
> @@ -720,8 +720,8 @@
>      for (volatile long double tmp = 1.0L; tmp; tmp /= 2.0L)
>          val.val = tmp;
>  
> -    if (DBL_MIN < val.val)
> -        val.val = DBL_MIN;
> +    if (LDBL_MIN <= val.val)
> +        val.val = 0.0L;
>  
>  #else
>  
> 
> Farid.
>