Loading...
Searching...
No Matches
float Interface Reference

Public Member Functions

proto external string ToString (int len=-1, int lenDec=-1)
 Float to string with fixed length, padded with zeroes.
 
proto external int Sign ()
 Returns an integer that indicates the sign of a number.
 

Static Public Member Functions

static proto bool AlmostEqual (float a, float b, float epsilon=0.0001)
 Return true when difference of two given float values is less or equal then epsilon.
 

Static Public Attributes

Constants

Populated by the engine.

static const float MAX
 
static const float INFINITY
 

Member Function Documentation

◆ AlmostEqual()

static proto bool float.AlmostEqual ( float a,
float b,
float epsilon = 0.0001 )
static

Return true when difference of two given float values is less or equal then epsilon.

float a = 1.0;
float b = 1.001;
if (float.AlmostEqual(a,b))
Print("are almost equal");
>> 'are almost equal'
proto void Print(void var, LogLevel level=LogLevel.NORMAL)
Prints content of variable to console/log.
static proto bool AlmostEqual(float a, float b, float epsilon=0.0001)
Return true when difference of two given float values is less or equal then epsilon.

◆ Sign()

proto external int float.Sign ( )

Returns an integer that indicates the sign of a number.

  • For floatNumber.Sign() < 0 result is -1.
  • For floatNumber.Sign() == 0 result is 0.
  • For floatNumber.Sign() > 0 result is 1.

◆ ToString()

proto external string float.ToString ( int len = -1,
int lenDec = -1 )

Float to string with fixed length, padded with zeroes.

Parameters
lenint fixed length (overall including decimal part and floating point mark)
lenDecint fixed length of decimal part
float num = 123.456;
string s1 = num.ToString(10, 4);
string s2 = num.ToString();
Print(s1);
Print(s2);
>> s1 = '00123.4560'
>> s2 = '123.456'
proto external string ToString(int len=-1, int lenDec=-1)
Float to string with fixed length, padded with zeroes.

Member Data Documentation

◆ INFINITY

const float float.INFINITY
static

◆ MAX

const float float.MAX
static

The documentation for this interface was generated from the following file: