Package com.ericsson.otp.erlang

Examples of com.ericsson.otp.erlang.OtpErlangDouble.doubleValue()


  @Test
  public void testParse6b()
  {
    String text = " 458888.5e0 ";
    OtpErlangDouble number = (OtpErlangDouble)ErlangLabel.parseText(text);
    Assert.assertEquals(458888.5,number.doubleValue(),Configuration.fpAccuracy);
    Assert.assertEquals("458888.5",ErlangLabel.dumpErlangObject(ErlangRunner.getRunner().evaluateString(text)));
  }
 
  @Test
  public void testParse6c()
View Full Code Here


  @Test
  public void testParse6c()
  {
    String text = " 458888.5e-5 ";
    OtpErlangDouble number = (OtpErlangDouble)ErlangLabel.parseText(text);
    Assert.assertEquals(4.588885,number.doubleValue(),Configuration.fpAccuracy);
    Assert.assertEquals("4.588885",ErlangLabel.dumpErlangObject(ErlangRunner.getRunner().evaluateString(text)));
  }
 
  @Test
  public void testParse6d()
View Full Code Here

  @Test
  public void testParse6d()
  {
    String text = " 458888.5e5 ";
    OtpErlangDouble number = (OtpErlangDouble)ErlangLabel.parseText(text);
    Assert.assertEquals(4.588885e10,number.doubleValue(),Configuration.fpAccuracy);
    Assert.assertEquals("4.588885E10",ErlangLabel.dumpErlangObject(ErlangRunner.getRunner().evaluateString(text)));
  }
 
  @Test
  public void testParse6e()
View Full Code Here

  @Test
  public void testParse6e()
  {
    String text = " 4588.456e34 ";
    OtpErlangDouble number = (OtpErlangDouble)ErlangLabel.parseText(text);
    Assert.assertEquals(4.588456e37,number.doubleValue(),Configuration.fpAccuracy);
    Assert.assertEquals("4.588456E37",ErlangLabel.dumpErlangObject(ErlangRunner.getRunner().evaluateString(text)));
  }
 
  @Test
  public void testParse6f()
View Full Code Here

  @Test
  public void testParse6f()
  {
    String text = " 4588888888888888.456e244 ";
    OtpErlangDouble number = (OtpErlangDouble)ErlangLabel.parseText(text);
    Assert.assertEquals(4.588888888888889E259,number.doubleValue(),Configuration.fpAccuracy);
    Assert.assertEquals("4.588888888888889E259",ErlangLabel.dumpErlangObject(ErlangRunner.getRunner().evaluateString(text)));
  }
 
  @Test
  public void testParse6g()
View Full Code Here

  @Test
  public void testParse6g()
  {
    String text = " 4588888888888888.456e-244 ";
    OtpErlangDouble number = (OtpErlangDouble)ErlangLabel.parseText(text);
    Assert.assertEquals(4.588888888888888E-229,number.doubleValue(),Configuration.fpAccuracy);
    Assert.assertEquals("4.588888888888888E-229",ErlangLabel.dumpErlangObject(ErlangRunner.getRunner().evaluateString(text)));
  }
 
  /** When offered the value exactly on the boundary of the lower exponent, the answer given by
   * Erlang is completely wrong, hence we do not test this case.
View Full Code Here

  @Test
  public void testParse6ha()
  {
    final String text = " 4.0E"+(-ErlangLabel.ErlangLong.minExponent+1)+" ";
    OtpErlangDouble number = (OtpErlangDouble)ErlangLabel.parseText(text);
    Assert.assertEquals(4d*Math.pow(10, -ErlangLabel.ErlangLong.minExponent+1),number.doubleValue(),Configuration.fpAccuracy);
    Assert.assertEquals(text.trim(),ErlangLabel.dumpErlangObject(ErlangRunner.getRunner().evaluateString(text)));
  }
 
  @Test
  public void testParse6hb()
View Full Code Here

  @Test
  public void testParse6ia()
  {
    final String text = " 4.0E"+(ErlangLabel.ErlangLong.maxExponent)+" ";
    OtpErlangDouble number = (OtpErlangDouble)ErlangLabel.parseText(text);
    Assert.assertEquals(4d*Math.pow(10, ErlangLabel.ErlangLong.maxExponent),number.doubleValue(),Configuration.fpAccuracy);
    Assert.assertEquals(text.trim(),ErlangLabel.dumpErlangObject(ErlangRunner.getRunner().evaluateString(text)));
  }
 
  @Test
  public void testParse6ib()
View Full Code Here

  @Test
  public void testParse6a()
  {
    String text = " 458888.5";
    OtpErlangDouble number = (OtpErlangDouble)ErlangLabel.parseText(text);
    Assert.assertEquals(458888.5,number.doubleValue(),Configuration.fpAccuracy);
    Assert.assertEquals("458888.5",ErlangLabel.dumpErlangObject(ErlangRunner.getRunner().evaluateString(text)));
  }
 
  @Test
  public void testParse6b()
View Full Code Here

  @Test
  public void testParse6j()
  {
    final String text = " 4e10 ";
    OtpErlangDouble number = (OtpErlangDouble)ErlangLabel.parseText(text);
    Assert.assertEquals(4e10,number.doubleValue(),Configuration.fpAccuracy);
    checkForCorrectException(new whatToRun() { public @Override void run() {
      ErlangRunner.getRunner().evaluateString(text);
    }},RuntimeException.class,"badmatch");
  }
 
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.