You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Gilles Sadowski <gi...@gmail.com> on 2022/02/16 14:06:32 UTC
Re: [commons-numbers] 03/04: Use Double.MIN_VALUE for the SAFE_MIN constant.
Hello.
Le mer. 16 févr. 2022 à 14:47, <ah...@apache.org> a écrit :
>
> This is an automated email from the ASF dual-hosted git repository.
>
> aherbert pushed a commit to branch master
> in repository https://gitbox.apache.org/repos/asf/commons-numbers.git
>
> commit 3be4da9c24b0bde0ffc8e68387d2b03c966365cd
> Author: aherbert <ah...@apache.org>
> AuthorDate: Wed Feb 16 12:33:14 2022 +0000
>
> Use Double.MIN_VALUE for the SAFE_MIN constant.
Nit-pick: s/VALUE/NORMAL/ ?
Regards,
Gilles
> ---
> .../main/java/org/apache/commons/numbers/core/Precision.java | 11 +++--------
> 1 file changed, 3 insertions(+), 8 deletions(-)
>
> diff --git a/commons-numbers-core/src/main/java/org/apache/commons/numbers/core/Precision.java b/commons-numbers-core/src/main/java/org/apache/commons/numbers/core/Precision.java
> index 323c338..0d1ccb0 100644
> --- a/commons-numbers-core/src/main/java/org/apache/commons/numbers/core/Precision.java
> +++ b/commons-numbers-core/src/main/java/org/apache/commons/numbers/core/Precision.java
> @@ -43,8 +43,10 @@ public final class Precision {
> * Safe minimum, such that {@code 1 / SAFE_MIN} does not overflow.
> * In IEEE 754 arithmetic, this is also the smallest normalized
> * number 2<sup>-1022</sup>.
> + *
> + * @see Double#MIN_NORMAL
> */
> - public static final double SAFE_MIN;
> + public static final double SAFE_MIN = Double.MIN_NORMAL;
>
> /** Exponent offset in IEEE754 representation. */
> private static final long EXPONENT_OFFSET = 1023L;
> @@ -59,13 +61,6 @@ public final class Precision {
> * constants: MATH-721
> */
> EPSILON = Double.longBitsToDouble((EXPONENT_OFFSET - 53L) << 52);
> -
> - /*
> - * This was previously expressed as = 0x1.0p-1022
> - * However, OpenJDK (Sparc Solaris) cannot handle such small
> - * constants: MATH-721
> - */
> - SAFE_MIN = Double.longBitsToDouble((EXPONENT_OFFSET - 1022L) << 52);
> }
>
> /**
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org
Re: [commons-numbers] 03/04: Use Double.MIN_VALUE for the SAFE_MIN constant.
Posted by Gilles Sadowski <gi...@gmail.com>.
Hello.
Le mer. 16 févr. 2022 à 16:01, Alex Herbert <al...@gmail.com> a écrit :
>
> On Wed, 16 Feb 2022 at 14:07, Gilles Sadowski <gi...@gmail.com> wrote:
>
> > >
> > > Use Double.MIN_VALUE for the SAFE_MIN constant.
> >
> > Nit-pick: s/VALUE/NORMAL/ ?
>
> Oops. However the value is correct (the existing unit test for it was
> unchanged). The commit log is wrong which I cannot change now without
> some variant of force push.
Oh, yes; maybe with "revert" (?). But don't bother, actually. ;-)
Gilles
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org
Re: [commons-numbers] 03/04: Use Double.MIN_VALUE for the SAFE_MIN constant.
Posted by Alex Herbert <al...@gmail.com>.
On Wed, 16 Feb 2022 at 14:07, Gilles Sadowski <gi...@gmail.com> wrote:
> >
> > Use Double.MIN_VALUE for the SAFE_MIN constant.
>
> Nit-pick: s/VALUE/NORMAL/ ?
Oops. However the value is correct (the existing unit test for it was
unchanged). The commit log is wrong which I cannot change now without
some variant of force push.
Alex
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org