MathUtils bug

This is the forum for JIDE Common Layer which is open sourced at https://github.com/jidesoft/jide-oss. Please note, JIDE technical support doesn't monitor this forum as often as other forums. Please consider subscribe for technical support for JIDE Common Layer so that you can use customer only forum to get a timely response.

Moderator: JIDE Support

Forum rules
Community driven forum for open source JIDE Common Layer. JIDE technical support doesn't monitor this forum as often as other forums. If you only use JIDE Common Layer, please consider subscribing for technical support for JIDE Common Layer so that you can use customer only forum to get a timely response.

MathUtils bug

Postby eugcomax » Sat Mar 17, 2018 2:33 am

max() method in MathUtils has bug that if passed numbers list contains only negative numbers then 0 will be returned.

Code: Select all
public static double max(List<Number> numbers) {
        double max = MIN_VALUE;
        for (Number value : numbers) {
            double v = value.doubleValue();
            if (v > max) {
                max = v;
            }
        }
        return max;
    }


Double MIN_VALUE is the smallest positive nonzero value. It should be changed to be -Double.MAX_VALUE. range() method should be fixed as well.
eugcomax
 
Posts: 2
Joined: Mon Dec 26, 2016 7:28 am

Re: MathUtils bug

Postby JIDE Support » Tue Mar 20, 2018 4:17 pm

Thank for the bug report. I just fixed both and pushed the fix to JIDE Common Layer.
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 37219
Joined: Sun Sep 14, 2003 10:49 am


Return to JIDE Common Layer Open Source Project Discussion (Community Driven)

Who is online

Users browsing this forum: No registered users and 12 guests

cron