@Test public void test() { CompareNumTypes.main(null); }
public static void main(String args[]) { BaseBarSeriesBuilder barSeriesBuilder = new BaseBarSeriesBuilder(); BarSeries seriesD = barSeriesBuilder.withName("Sample Series Double ").withNumTypeOf(DoubleNum::valueOf) .build(); BarSeries seriesP = barSeriesBuilder.withName("Sample Series PrecisionNum 32") .withNumTypeOf(PrecisionNum::valueOf).build(); BarSeries seriesPH = barSeriesBuilder.withName("Sample Series PrecisionNum 256") .withNumTypeOf(number -> PrecisionNum.valueOf(number.toString(), 256)).build(); int[] randoms = new Random().ints(NUMBARS, 80, 100).toArray(); for (int i = 0; i < randoms.length; i++) { ZonedDateTime date = ZonedDateTime.now().minusSeconds(NUMBARS - i); seriesD.addBar(date, randoms[i], randoms[i] + 21, randoms[i] - 21, randoms[i] - 5); seriesP.addBar(date, randoms[i], randoms[i] + 21, randoms[i] - 21, randoms[i] - 5); seriesPH.addBar(date, randoms[i], randoms[i] + 21, randoms[i] - 21, randoms[i] - 5); } Num D = PrecisionNum.valueOf(test(seriesD).toString(), 256); Num P = PrecisionNum.valueOf(test(seriesP).toString(), 256); Num standard = PrecisionNum.valueOf(test(seriesPH).toString(), 256); System.out.println(seriesD.getName() + " error: " + D.minus(standard).dividedBy(standard).multipliedBy(PrecisionNum.valueOf(100))); System.out.println(seriesP.getName() + " error: " + P.minus(standard).dividedBy(standard).multipliedBy(PrecisionNum.valueOf(100))); }
CompareNumTypes { public static void main(String args[]) { BaseBarSeriesBuilder barSeriesBuilder = new BaseBarSeriesBuilder(); BarSeries seriesD = barSeriesBuilder.withName("Sample Series Double ").withNumTypeOf(DoubleNum::valueOf) .build(); BarSeries seriesP = barSeriesBuilder.withName("Sample Series PrecisionNum 32") .withNumTypeOf(PrecisionNum::valueOf).build(); BarSeries seriesPH = barSeriesBuilder.withName("Sample Series PrecisionNum 256") .withNumTypeOf(number -> PrecisionNum.valueOf(number.toString(), 256)).build(); int[] randoms = new Random().ints(NUMBARS, 80, 100).toArray(); for (int i = 0; i < randoms.length; i++) { ZonedDateTime date = ZonedDateTime.now().minusSeconds(NUMBARS - i); seriesD.addBar(date, randoms[i], randoms[i] + 21, randoms[i] - 21, randoms[i] - 5); seriesP.addBar(date, randoms[i], randoms[i] + 21, randoms[i] - 21, randoms[i] - 5); seriesPH.addBar(date, randoms[i], randoms[i] + 21, randoms[i] - 21, randoms[i] - 5); } Num D = PrecisionNum.valueOf(test(seriesD).toString(), 256); Num P = PrecisionNum.valueOf(test(seriesP).toString(), 256); Num standard = PrecisionNum.valueOf(test(seriesPH).toString(), 256); System.out.println(seriesD.getName() + " error: " + D.minus(standard).dividedBy(standard).multipliedBy(PrecisionNum.valueOf(100))); System.out.println(seriesP.getName() + " error: " + P.minus(standard).dividedBy(standard).multipliedBy(PrecisionNum.valueOf(100))); } }
CompareNumTypes { public static void main(String args[]) { BaseBarSeriesBuilder barSeriesBuilder = new BaseBarSeriesBuilder(); BarSeries seriesD = barSeriesBuilder.withName("Sample Series Double ").withNumTypeOf(DoubleNum::valueOf) .build(); BarSeries seriesP = barSeriesBuilder.withName("Sample Series PrecisionNum 32") .withNumTypeOf(PrecisionNum::valueOf).build(); BarSeries seriesPH = barSeriesBuilder.withName("Sample Series PrecisionNum 256") .withNumTypeOf(number -> PrecisionNum.valueOf(number.toString(), 256)).build(); int[] randoms = new Random().ints(NUMBARS, 80, 100).toArray(); for (int i = 0; i < randoms.length; i++) { ZonedDateTime date = ZonedDateTime.now().minusSeconds(NUMBARS - i); seriesD.addBar(date, randoms[i], randoms[i] + 21, randoms[i] - 21, randoms[i] - 5); seriesP.addBar(date, randoms[i], randoms[i] + 21, randoms[i] - 21, randoms[i] - 5); seriesPH.addBar(date, randoms[i], randoms[i] + 21, randoms[i] - 21, randoms[i] - 5); } Num D = PrecisionNum.valueOf(test(seriesD).toString(), 256); Num P = PrecisionNum.valueOf(test(seriesP).toString(), 256); Num standard = PrecisionNum.valueOf(test(seriesPH).toString(), 256); System.out.println(seriesD.getName() + " error: " + D.minus(standard).dividedBy(standard).multipliedBy(PrecisionNum.valueOf(100))); System.out.println(seriesP.getName() + " error: " + P.minus(standard).dividedBy(standard).multipliedBy(PrecisionNum.valueOf(100))); }  }
CompareNumTypes { public static void main(String args[]) { BaseBarSeriesBuilder barSeriesBuilder = new BaseBarSeriesBuilder(); BarSeries seriesD = barSeriesBuilder.withName("Sample Series Double ").withNumTypeOf(DoubleNum::valueOf) .build(); BarSeries seriesP = barSeriesBuilder.withName("Sample Series PrecisionNum 32") .withNumTypeOf(PrecisionNum::valueOf).build(); BarSeries seriesPH = barSeriesBuilder.withName("Sample Series PrecisionNum 256") .withNumTypeOf(number -> PrecisionNum.valueOf(number.toString(), 256)).build(); int[] randoms = new Random().ints(NUMBARS, 80, 100).toArray(); for (int i = 0; i < randoms.length; i++) { ZonedDateTime date = ZonedDateTime.now().minusSeconds(NUMBARS - i); seriesD.addBar(date, randoms[i], randoms[i] + 21, randoms[i] - 21, randoms[i] - 5); seriesP.addBar(date, randoms[i], randoms[i] + 21, randoms[i] - 21, randoms[i] - 5); seriesPH.addBar(date, randoms[i], randoms[i] + 21, randoms[i] - 21, randoms[i] - 5); } Num D = PrecisionNum.valueOf(test(seriesD).toString(), 256); Num P = PrecisionNum.valueOf(test(seriesP).toString(), 256); Num standard = PrecisionNum.valueOf(test(seriesPH).toString(), 256); System.out.println(seriesD.getName() + " error: " + D.minus(standard).dividedBy(standard).multipliedBy(PrecisionNum.valueOf(100))); System.out.println(seriesP.getName() + " error: " + P.minus(standard).dividedBy(standard).multipliedBy(PrecisionNum.valueOf(100))); }  static void main(String args[]); static Num test(BarSeries series); }
CompareNumTypes { public static void main(String args[]) { BaseBarSeriesBuilder barSeriesBuilder = new BaseBarSeriesBuilder(); BarSeries seriesD = barSeriesBuilder.withName("Sample Series Double ").withNumTypeOf(DoubleNum::valueOf) .build(); BarSeries seriesP = barSeriesBuilder.withName("Sample Series PrecisionNum 32") .withNumTypeOf(PrecisionNum::valueOf).build(); BarSeries seriesPH = barSeriesBuilder.withName("Sample Series PrecisionNum 256") .withNumTypeOf(number -> PrecisionNum.valueOf(number.toString(), 256)).build(); int[] randoms = new Random().ints(NUMBARS, 80, 100).toArray(); for (int i = 0; i < randoms.length; i++) { ZonedDateTime date = ZonedDateTime.now().minusSeconds(NUMBARS - i); seriesD.addBar(date, randoms[i], randoms[i] + 21, randoms[i] - 21, randoms[i] - 5); seriesP.addBar(date, randoms[i], randoms[i] + 21, randoms[i] - 21, randoms[i] - 5); seriesPH.addBar(date, randoms[i], randoms[i] + 21, randoms[i] - 21, randoms[i] - 5); } Num D = PrecisionNum.valueOf(test(seriesD).toString(), 256); Num P = PrecisionNum.valueOf(test(seriesP).toString(), 256); Num standard = PrecisionNum.valueOf(test(seriesPH).toString(), 256); System.out.println(seriesD.getName() + " error: " + D.minus(standard).dividedBy(standard).multipliedBy(PrecisionNum.valueOf(100))); System.out.println(seriesP.getName() + " error: " + P.minus(standard).dividedBy(standard).multipliedBy(PrecisionNum.valueOf(100))); }  static void main(String args[]); static Num test(BarSeries series);  }