Move from github, collapse gltk and strictmath, add candle
[clnl] / resources / strictmath / java / GenerateToRadiansData.java
1 import java.io.*;
2
3 /*
4  * toRadiansInput was generated with the following CL:
5  *
6  * (with-open-file (out "toRadiansInput" :direction :output :if-does-not-exist :create :if-exists :supersede)
7  *  (loop :for n :from 0 :to 361 :do (format out "~A~%" n))
8  *  (loop :repeat 100000
9  *        :do (format out "~A~%" (random 360d0))))
10  */
11
12 public class GenerateToRadiansData {
13   public static void main(String[] args) {
14     try {
15       BufferedReader in = new BufferedReader(new FileReader(new File("toRadiansInput")));
16       String line = null;
17       System.out.println("(");
18       while((line = in.readLine()) != null) {
19         double deg = Double.parseDouble(line.replace("d0", ""));
20         String degString = new Double(deg).toString();
21         String radString = new Double(StrictMath.toRadians(deg)).toString();
22         System.out.println(" (" +
23             (degString.contains("E") ? degString.replace("E", "d") : (degString + "d0")) + " " +
24             (radString.contains("E") ? radString.replace("E", "d") : (radString + "d0")) + ")");
25       }
26       System.out.println(")");
27     } catch (Exception e) {
28       System.err.println("Odd problem: " + e);
29     }
30   }
31 }