Uploaded image for project: 'Lucene - Core'
  1. Lucene - Core
  2. LUCENE-7194

Ban Math.toRadians/toDegrees and remove all usages of it

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 7.0
    • Component/s: None
    • Labels:
      None
    • Lucene Fields:
      New

      Description

      The result of these methods is unreliable and changes across jvm versions: we cannot use these methods.

      The following program prints 0.7722082215479366 on previous versions of java but 0.7722082215479367 on java 9 because Math.toRadians is no longer doing the same thing:

      public class test {
        public static void main(String args[]) throws Exception {
          System.out.println(Math.toRadians(44.244272));
        }
      }
      

      This is because of https://bugs.openjdk.java.net/browse/JDK-4477961.

      I am not really sure its a bug, because the method says that the conversion is "generally inexact".

        Attachments

        1. LUCENE-7194.patch
          9 kB
          Karl Wright

          Activity

            People

            • Assignee:
              kwright@metacarta.com Karl Wright
              Reporter:
              rcmuir Robert Muir
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: