[
https://issues.apache.org/jira/browse/NUMBERS-197?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Dimitrios Efthymiou closed NUMBERS-197.
---------------------------------------
Resolution: Abandoned
> New function - get the integer closest to a given number
> --------------------------------------------------------
>
> Key: NUMBERS-197
> URL: https://issues.apache.org/jira/browse/NUMBERS-197
> 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 a number and it
> returns the integer closest to it. Some use cases are:
> # {*}Rounding Numbers{*}: The most common use case is to perform rounding on
> numbers, where you would want to find the closest integer value to a given
> number. This is often required when dealing with mathematical or scientific
> computations where you want to reduce the precision for simplicity or due to
> some limitation.
> # {*}Graphics Programming{*}: In computer graphics, you often deal with
> pixel values that must be integers. If you're doing any kind of
> transformation or computation that results in non-integer values, you might
> use a function like this to find the closest integer that can represent a
> pixel value.
> # {*}Discretization{*}: In some fields, it's necessary to transform
> continuous data into discrete counterparts for specific algorithms. For
> instance, in machine learning or statistical analysis, some algorithms
> perform better or can only work with discrete values.
> # {*}Data Type Limitations{*}: Sometimes, you're working with a system or
> library that only accepts integers. In such cases, a function like this would
> be necessary to convert your numbers into a format that the system can
> understand.
> # {*}Resource Allocation{*}: In resource allocation scenarios, such as
> assigning tasks to workers, distributing goods, or scheduling, you often need
> to work with whole units. So, you might need to round up or down to the
> nearest integer.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)