Package erjang

Examples of erjang.EDouble


    throw ERT.badarg(obj);
  }

  @BIF 
  static public EBinary float_to_binary(EObject obj) {
    EDouble value;
    if ((value = obj.testFloat()) != null) {
      return new EBinary(value.format(ERT.NIL).getBytes(IO.ISO_LATIN_1));
    }
    throw ERT.badarg(obj);
  }
View Full Code Here


    throw ERT.badarg(obj);
  }

  @BIF 
  static public EBinary float_to_binary(EObject obj, EObject options) {
    EDouble value;
    if ((value = obj.testFloat()) != null) {
      return new EBinary(value.format(options).getBytes(IO.ISO_LATIN_1));
    }
    throw ERT.badarg(obj, options);
  }
View Full Code Here

    throw ERT.badarg(obj, options);
  }

  @BIF 
  static public EString float_to_list(EObject obj) {
    EDouble value;
    if ((value = obj.testFloat()) != null) {
      return new EString(value.format(ERT.NIL));
    }
    throw ERT.badarg(obj);
  }
View Full Code Here

    throw ERT.badarg(obj);
  }

  @BIF
  static public EString float_to_list(EObject obj, EObject options) {
    EDouble value;
    if ((value = obj.testFloat()) != null) {
      return new EString(value.format(options));
    }
    throw ERT.badarg(obj, options);
  }
View Full Code Here

  public static EDouble binary_to_float(EObject obj) {
    EBinary bin = obj.testBinary();
    if (bin != null) {
      try {
        double d = Double.parseDouble( new String(bin.getByteArray(), IO.ISO_LATIN_1) );
        return new EDouble(d);
      } catch (NumberFormatException e) {
        // ignore //
      }
    }
    throw ERT.badarg(obj);
View Full Code Here

  static public EInteger trunc(EObject v1) {
    EInteger i1;
    if ((i1 = v1.testInteger()) != null) {
      return i1;
    }
    EDouble n1;
    if ((n1 = v1.testFloat()) != null) {
      return trunc(n1.value);
    }
    throw ERT.badarg(v1);
  }
View Full Code Here

    return ERT.box(Math.round(d.value));
  }

  @BIF(name = "round")
  static public EInteger round(EObject o) {
    EDouble d;
    if ((d = o.testFloat()) != null)
      return ERT.box(Math.round(d.value));

    EInteger i;
    if ((i = o.testInteger()) != null)
View Full Code Here

    return ERT.box(Math.round(d.value));
  }

  @BIF(name = "round", type = Type.GUARD)
  static public EInteger round$g(EObject o) {
    EDouble d = o.testFloat();
    if (d == null) return null;
    return ERT.box(Math.round(d.value));
  }
View Full Code Here

TOP

Related Classes of erjang.EDouble

Copyright © 2018 www.massapicom. 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.