Package com.ericsson.otp.erlang

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


  @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(runner.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(runner.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(runner.evaluateString(text)));
  }
 
  @Test
  public void testParse6ib()
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() {
      runner.evaluateString(text);
    }},IllegalArgumentException.class,"badmatch");
  }
 
View Full Code Here

  @Test
  public void testParse6k()
  {
    final String text = " 4.e10 ";
    OtpErlangDouble number = (OtpErlangDouble)ErlangLabel.parseText(text);
    Assert.assertEquals(4e10,number.doubleValue(),Configuration.fpAccuracy);
    try
    {
      runner.evaluateString(text);
    }
    catch(Exception ex)
View Full Code Here

    public void dump(OtpErlangObject arg, StringBuffer resultHolder) {
      assert (arg instanceof OtpErlangDouble)
          || (arg instanceof OtpErlangFloat);
      if (arg instanceof OtpErlangDouble) {
        OtpErlangDouble doubleValue = (OtpErlangDouble) arg;
        resultHolder.append(doubleValue.doubleValue());
      } else if (arg instanceof OtpErlangFloat) {
        OtpErlangDouble doubleValue = (OtpErlangDouble) arg;
        resultHolder.append(doubleValue.doubleValue());
      }
    }
View Full Code Here

      if (arg instanceof OtpErlangDouble) {
        OtpErlangDouble doubleValue = (OtpErlangDouble) arg;
        resultHolder.append(doubleValue.doubleValue());
      } else if (arg instanceof OtpErlangFloat) {
        OtpErlangDouble doubleValue = (OtpErlangDouble) arg;
        resultHolder.append(doubleValue.doubleValue());
      }
    }

    @Override
    public OtpErlangObject parseObject(
View Full Code Here

    public void dump(OtpErlangObject arg, StringBuffer resultHolder) {
      assert (arg instanceof OtpErlangDouble)
          || (arg instanceof OtpErlangFloat);
      if (arg instanceof OtpErlangDouble) {
        OtpErlangDouble doubleValue = (OtpErlangDouble) arg;
        resultHolder.append(doubleValue.doubleValue());
      } else if (arg instanceof OtpErlangFloat) {
        OtpErlangDouble doubleValue = (OtpErlangDouble) arg;
        resultHolder.append(doubleValue.doubleValue());
      }
    }
View Full Code Here

      if (arg instanceof OtpErlangDouble) {
        OtpErlangDouble doubleValue = (OtpErlangDouble) arg;
        resultHolder.append(doubleValue.doubleValue());
      } else if (arg instanceof OtpErlangFloat) {
        OtpErlangDouble doubleValue = (OtpErlangDouble) arg;
        resultHolder.append(doubleValue.doubleValue());
      }
    }

    @Override
    public OtpErlangObject parseObject(
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

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.