blob: 0c5b32747acfc731918546f92c43387f64be54c3 [file] [log] [blame]
/*******************************************************************************
* Copyright © 2012, 2013 IBM Corporation and others.
* 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:
* IBM Corporation - initial API and implementation
*
*******************************************************************************/
package eglx.lang;
import egl.lang.reflect.ClassType;
import egl.lang.reflect.Operation;
externalType EFloat extends ENumber type ClassType
/**
* Constructs a float with a default value of 0.
*/
constructor();
/**
* {@Operation +} A unary plus (has no effect on the numeric value).
*/
static function $Plus(value EFloat in) returns (EFloat) {@Operation{"+"}};
/**
* {@Operation +} Adds two numbers.
*/
static function $Plus(lvalue EFloat in, rvalue EFloat in) returns (EFloat) {@Operation{"+"}};
/**
* {@Operation -} Negates the value.
*/
static function $Minus(value EFloat in) returns (EFloat) {@Operation{"-"}};
/**
* {@Operation -} Subtracts one number from another.
*/
static function $Minus(lvalue EFloat in, rvalue EFloat in) returns (EFloat) {@Operation{"-"}};
/**
* {@Operation *} Multiplies two numbers.
*/
static function $Multiply(value EFloat in, rvalue EFloat in) returns (EFloat) {@Operation{"*"}};
/**
* {@Operation /} Divides one number by another.
*/
static function $Divide(value EFloat in, rvalue EFloat in) returns (EFloat) {@Operation{"/"}};
/**
* {@Operation %} Computes the remainder of dividing one number by another.
*/
static function $Modulo(lvalue EFloat in, rvalue EFloat in) returns (EFloat) {@Operation{"%"}};
/**
* {@Operation **} Computes lvalue to the power of rvalue.
*/
static function $PowerOf(value EFloat in, rvalue EFloat in) returns (EFloat) {@Operation{"**"}};
/**
* {@Operation <} Compares two numbers.
*/
static function $LT(lvalue EFloat in, rvalue EFloat in) returns (EBoolean) {@Operation{"<"}};
/**
* {@Operation >} Compares two numbers.
*/
static function $GT(lvalue EFloat in, rvalue EFloat in) returns (EBoolean) {@Operation{">"}};
/**
* {@Operation <=} Compares two numbers.
*/
static function $LTE(lvalue EFloat in, rvalue EFloat in) returns (EBoolean) {@Operation{"<="}};
/**
* {@Operation >=} Compares two numbers.
*/
static function $GTE(lvalue EFloat in, rvalue EFloat in) returns (EBoolean) {@Operation{">="}};
/**
* {@Operation ==} Compares two numbers.
*/
static function $EQ(lvalue EFloat? in, rvalue EFloat? in) returns(EBoolean) {@Operation{"=="}};
/**
* {@Operation !=} Compares two numbers.
*/
static function $NEQ(lvalue EFloat? in, rvalue EFloat? in) returns(EBoolean) {@Operation{"!="}};
/**
* {@Operation narrow} Converts a string to a float. The string is parsed
* as follows: It may begin with an optional + or - sign. After the sign there
* must be a sequence of one or more digit characters. They may be followed by
* a decimal point (a period) and one or more digit characters. It may end with
* an exponent, which is the letter e or E, followed by an optional negative sign,
* followed by one or more digit characters.
*
* @throws TypeCastException if the string can't be parsed into a float.
*/
static function asFloat(value EString? in) returns(EFloat?) {@Operation{"narrow"}};
static function asFloat(value ESmallint? in) returns(EFloat?) {@Operation{"widen"}};
static function asFloat(value ESmallfloat? in) returns(EFloat?) {@Operation{"widen"}};
static function asFloat(value EDecimal? in) returns(EFloat?) {@Operation{"widen"}};
static function asFloat(value EInt? in) returns(EFloat?) {@Operation{"widen"}};
static function asFloat(value EBigint? in) returns(EFloat?) {@Operation{"widen"}};
static function asFloat(value ENumber? in) returns(EFloat?) {@Operation{"narrow"}};
/**
* {@Operation narrow} Converts bytes to a float.
*
* @throws TypeCastException if the bytes are not valid format for a float.
*/
static function asFloat(value EBytes? in) returns(EFloat?) {@Operation{"narrow"}};
static function asNumber(value EFloat? in) returns(ENumber?) {@Operation{"widen"}};
/**
* A constant with the value Infinity.
*/
static const Infinity float = 0x7ff0000000000000;
/**
* A constant with the value -Infinity.
*/
static const NegativeInfinity float = 0xfff0000000000000;
/**
* A constant with the value NaN (not a number).
*/
static const NaN float = 0x7ff8000000000000;
/**
* A constant with the value -0. It may not be distinguishable
* from zero in some implementations.
*/
static const NegativeZero float = 0x8000000000000000;
end