Ticket #23613: 23613.patch

File 23613.patch, 1.0 KB (added by GerdP, 21 months ago)

possible fix

  • src/main/java/org/openstreetmap/josm/plugins/fit/lib/global/HeartRateCadenceDistanceSpeed.java

     
    9999        // Assume that the equation doesn't have fractions and no additions (0, 0)
    100100        // 56.7421794 = 676960569 / 180 * x => x = 56.7421794 * 180 / 676960569 = 1.5087e-5 (inverse -> 66280.359)
    101101        // 56.7421794 = 676960569 * 180 * x => x = 56.7421794 / (180 * 676960569) = 3.56e-8 (inverse -> 2.1474836E9, or Integer.MAX_VALUE)
    102         return original * 180d / Integer.MAX_VALUE;
     102        var raw = original * 180d / Integer.MAX_VALUE;
     103        while (raw >= 180d) {
     104            raw -= 360d;
     105        }
     106        return raw;
    103107    }
    104108
    105109    private static double decodeElevation(long original) {