[Math] MATH-1256

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[Math] MATH-1256

Gilles Sadowski
Hi.

Cf. issue reported in
   https://issues.apache.org/jira/browse/MATH-1256

Quoting the OP:
---
In class Interval, which is in the package
org.apache.commons.math4.geometry.euclidean.oned
it is possible to pass the value for variable upper less than the value
of variable lower,
which is logically incorrect and also causes the method getSize() to
return negative value
---

Is it ever necessary to allow negative intervals (e.g. wrt to
"tolerance")?

If not, I propose to add a check in the constructor:
---CUT---
    if (upper < lower) {
        throw new
NumberIsTooSmallException(LocalizedFormats.ENDPOINTS_NOT_AN_INTERVAL,
                                            upper, lower, true);
    }
---CUT---

OK?

Regards,
Gilles


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [Math] MATH-1256

Luc Maisonobe-2
Le 2015-08-17 12:06, Gilles a écrit :

> Hi.
>
> Cf. issue reported in
>   https://issues.apache.org/jira/browse/MATH-1256
>
> Quoting the OP:
> ---
> In class Interval, which is in the package
> org.apache.commons.math4.geometry.euclidean.oned
> it is possible to pass the value for variable upper less than the
> value of variable lower,
> which is logically incorrect and also causes the method getSize() to
> return negative value
> ---
>
> Is it ever necessary to allow negative intervals (e.g. wrt to
> "tolerance")?
>
> If not, I propose to add a check in the constructor:
> ---CUT---
>    if (upper < lower) {
>        throw new
> NumberIsTooSmallException(LocalizedFormats.ENDPOINTS_NOT_AN_INTERVAL,
>                                            upper, lower, true);
>    }
> ---CUT---
>
> OK?

Sure!

Luc

>
> Regards,
> Gilles
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]