[
https://issues.apache.org/jira/browse/NUMBERS-195?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17742891#comment-17742891
]
Gilles Sadowski commented on NUMBERS-195:
-----------------------------------------
I understand that the idea is to have a generalized check, but where would it
be used?
Within an algorithm that deals with a known type (e.g. {{double}}), why would
one use
{code}
if (ArithmeticUtils.isBetween(x, a, b)) {
// ...
}
{code}
instead of
{code}
if (x >= a &&
x <= b) {
// ...
}
{code}
?
The performance hit of
* 3 autoboxing
* 3 conversions to string
* 3 creations of {{BigDecimal}}
* 2 method calls
* 3 boolean operations
would be a no-go.
> New function - is number between 2 others
> -----------------------------------------
>
> Key: NUMBERS-195
> URL: https://issues.apache.org/jira/browse/NUMBERS-195
> Project: Commons Numbers
> Issue Type: New Feature
> Components: core
> Reporter: Dimitrios Efthymiou
> Priority: Minor
> Labels: features
> Original Estimate: 1h
> Remaining Estimate: 1h
>
> I propose a new function for ArithmeticUtils that takes 3 numbers and it
> checks if the first argument is numerically between the other 2
--
This message was sent by Atlassian Jira
(v8.20.10#820010)