office-gobmx/nlpsolver
Todor Balabanov 763149e2f4 Double values comparison changed to compare method.
Using the Double.compare() method is often preferred over the == comparison
operator for comparing double values due to several reasons:

Handling NaN (Not-a-Number) values: The Double.compare() method correctly
handles NaN values, while the == operator does not. If either of the operands
is NaN, the == operator will always return false, regardless of the other
operand. In contrast, Double.compare() will correctly evaluate NaN values
according to the IEEE 754 floating-point standard.

Handling positive and negative zero: The == operator treats positive zero and
negative zero as equal, whereas they are distinct values in IEEE 754
floating-point representation. Double.compare() correctly distinguishes
between positive and negative zero.

Robustness against rounding errors: Floating-point arithmetic can introduce
rounding errors, causing two double values that should be equal to differ
slightly. Directly comparing them with the == operator might yield unexpected
results due to these small differences. Double.compare() allows you to define
a tolerance level if necessary, providing more control over how equality is
determined.

Consistent behavior: The behavior of Double.compare() is consistent and
predictable across different platforms and JVM implementations, as it follows
the IEEE 754 standard. On the other hand, the behavior of the == operator
might vary depending on the platform and compiler optimizations.

Suitability for sorting: Double.compare() returns an integer value that can
be directly used for sorting double values in ascending or descending order.
This makes it convenient for sorting arrays or collections of double values.

Overall, while the == operator might work in some cases, using
Double.compare() provides more robust and predictable behavior, especially
when dealing with floating-point numbers in Java.

Change-Id: I5756936a0d2b4fe11b9113ddd33b6ae691f5103f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166796
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Tested-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2024-04-29 15:40:27 +02:00
..
help/en/com.sun.star.comp.Calc.NLPSolver
src Double values comparison changed to compare method. 2024-04-29 15:40:27 +02:00
ThirdParty/EvolutionarySolver/src/net/adaptivebox
Extension_nlpsolver.mk
Jar_EvolutionarySolver.mk
Jar_nlpsolver.mk
Makefile
Module_nlpsolver.mk
README.md

Nonlinear Programming Solver (nlpsolver)

This extension integrates into LibreOffice Calc and offers new Solver engines to use for optimizing nonlinear programming models.

As there is no known upstream source for nlpsolver/ThirdParty/EvolutionarySolver, the code is considered internal and can be modified like any other internal code.