]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.trend/example/org/simantics/trend/TestDecimalFormat.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.trend / example / org / simantics / trend / TestDecimalFormat.java
index e541de85bdc0448974357b0d600c785021f9dfd6..343789335658e5181e04ec75917f770465423dcc 100644 (file)
@@ -1,94 +1,94 @@
-/*******************************************************************************\r
- * Copyright (c) 2007, 2011 Association for Decentralized Information Management in\r
- * Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.trend;\r
-\r
-import java.math.BigDecimal;\r
-import java.text.Format;\r
-import java.text.NumberFormat;\r
-\r
-import org.simantics.utils.format.FormattingUtils;\r
-import org.simantics.utils.format.ValueFormat;\r
-\r
-public class TestDecimalFormat {\r
-\r
-       public static void main(String[] args) {\r
-       \r
-               \r
-               NumberFormat f = ValueFormat.Scientific.format;\r
-               double x = 0.00001234567890;            \r
-               for (int i=-10; i<10; i++) {\r
-                       System.out.println(f.format(x));\r
-                       x *= 10.;\r
-               }\r
-               \r
-               x = 6.00;\r
-               for (int i=0; i<10; i++) {\r
-                       x+= 0.0000000000001;\r
-                       System.out.println(x);\r
-               }\r
-\r
-               BigDecimal dec = new BigDecimal(0);\r
-               BigDecimal augend = new BigDecimal(String.valueOf(0.2));\r
-               System.out.println(new BigDecimal(0.2));\r
-               System.out.println(new BigDecimal(String.valueOf(0.2)));\r
-               for (int i=0; i<1000000; i++) {\r
-                       dec = dec.add(augend);\r
-                       String s1 = dec.toString();\r
-                       String s2 = Double.toString(dec.doubleValue());\r
-                       if (!s1.equals(s2)) {\r
-                               System.out.println(s1 + " vs. " + s2);\r
-                       }\r
-               }\r
-\r
-               Format format = FormattingUtils.significantDigitFormat(7);\r
-\r
-               System.out.println(format.format(123456789012345.1234));\r
-               System.out.println(format.format(12345678901.23451234));\r
-               System.out.println(format.format(1234567890.123451234));\r
-               System.out.println(format.format(123456789.0123451234));\r
-               System.out.println(format.format(12345678.90123451234));\r
-               System.out.println(format.format(10000123.4));\r
-               System.out.println(format.format(9999999.99));\r
-               System.out.println(format.format(9999999.9));\r
-               System.out.println(format.format(9999999));\r
-               System.out.println(format.format(1234567.890123451234));\r
-               System.out.println(format.format(123456.7890123451234));\r
-               System.out.println(format.format(12345.67890123451234));\r
-               System.out.println(format.format(1234.567890123451234));\r
-               System.out.println(format.format(123.4567890123451234));\r
-               System.out.println(format.format(12.34567890123451234));\r
-               System.out.println(format.format(1.234567890123451234));\r
-               System.out.println(format.format(0.1234567890123451234));\r
-               System.out.println(format.format(0.1111111));\r
-               System.out.println(format.format(0.1000001));\r
-               System.out.println(format.format(0.09999999999));\r
-               System.out.println(format.format(0.0999999999));\r
-               System.out.println(format.format(0.099999999));\r
-               System.out.println(format.format(0.09999999));\r
-               System.out.println(format.format(0.0999999));\r
-               System.out.println(format.format(0.01234567890123451234));\r
-               System.out.println(format.format(0.001234567890123451234));\r
-               System.out.println(format.format(0.0001234567890123451234));\r
-               System.out.println(format.format(0.00001234567890123451234));\r
-               System.out.println(format.format(0.000001234567890123451234));\r
-               System.out.println(format.format(0.0000001234567890123451234));\r
-               System.out.println(format.format(0.00000001234567890123451234));\r
-               System.out.println(format.format(0.000000001234567890123451234));\r
-\r
-               System.out.println(format.format(10));\r
-               System.out.println(format.format(20L));\r
-               System.out.println(format.format(-0));\r
-               System.out.println(format.format(-1L));\r
-       \r
-       }\r
-       \r
-}\r
+/*******************************************************************************
+ * Copyright (c) 2007, 2011 Association for Decentralized Information Management in
+ * Industry THTH ry.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     VTT Technical Research Centre of Finland - initial API and implementation
+ *******************************************************************************/
+package org.simantics.trend;
+
+import java.math.BigDecimal;
+import java.text.Format;
+import java.text.NumberFormat;
+
+import org.simantics.utils.format.FormattingUtils;
+import org.simantics.utils.format.ValueFormat;
+
+public class TestDecimalFormat {
+
+       public static void main(String[] args) {
+       
+               
+               NumberFormat f = ValueFormat.Scientific.format;
+               double x = 0.00001234567890;            
+               for (int i=-10; i<10; i++) {
+                       System.out.println(f.format(x));
+                       x *= 10.;
+               }
+               
+               x = 6.00;
+               for (int i=0; i<10; i++) {
+                       x+= 0.0000000000001;
+                       System.out.println(x);
+               }
+
+               BigDecimal dec = new BigDecimal(0);
+               BigDecimal augend = new BigDecimal(String.valueOf(0.2));
+               System.out.println(new BigDecimal(0.2));
+               System.out.println(new BigDecimal(String.valueOf(0.2)));
+               for (int i=0; i<1000000; i++) {
+                       dec = dec.add(augend);
+                       String s1 = dec.toString();
+                       String s2 = Double.toString(dec.doubleValue());
+                       if (!s1.equals(s2)) {
+                               System.out.println(s1 + " vs. " + s2);
+                       }
+               }
+
+               Format format = FormattingUtils.significantDigitFormat(7);
+
+               System.out.println(format.format(123456789012345.1234));
+               System.out.println(format.format(12345678901.23451234));
+               System.out.println(format.format(1234567890.123451234));
+               System.out.println(format.format(123456789.0123451234));
+               System.out.println(format.format(12345678.90123451234));
+               System.out.println(format.format(10000123.4));
+               System.out.println(format.format(9999999.99));
+               System.out.println(format.format(9999999.9));
+               System.out.println(format.format(9999999));
+               System.out.println(format.format(1234567.890123451234));
+               System.out.println(format.format(123456.7890123451234));
+               System.out.println(format.format(12345.67890123451234));
+               System.out.println(format.format(1234.567890123451234));
+               System.out.println(format.format(123.4567890123451234));
+               System.out.println(format.format(12.34567890123451234));
+               System.out.println(format.format(1.234567890123451234));
+               System.out.println(format.format(0.1234567890123451234));
+               System.out.println(format.format(0.1111111));
+               System.out.println(format.format(0.1000001));
+               System.out.println(format.format(0.09999999999));
+               System.out.println(format.format(0.0999999999));
+               System.out.println(format.format(0.099999999));
+               System.out.println(format.format(0.09999999));
+               System.out.println(format.format(0.0999999));
+               System.out.println(format.format(0.01234567890123451234));
+               System.out.println(format.format(0.001234567890123451234));
+               System.out.println(format.format(0.0001234567890123451234));
+               System.out.println(format.format(0.00001234567890123451234));
+               System.out.println(format.format(0.000001234567890123451234));
+               System.out.println(format.format(0.0000001234567890123451234));
+               System.out.println(format.format(0.00000001234567890123451234));
+               System.out.println(format.format(0.000000001234567890123451234));
+
+               System.out.println(format.format(10));
+               System.out.println(format.format(20L));
+               System.out.println(format.format(-0));
+               System.out.println(format.format(-1L));
+       
+       }
+       
+}