Float

Top  Previous  Next

Float

 

Represents double-precision floating-point numbers. Float maps to JavaScript Number object.

Floats can be represented in normal notation (3.1415) or in exponential notation (1.23e45).

 

Methods

Trigonometry and Hyperbolic functions

Sin () : Float

Cos () : Float

Tan () : Float

ArcSin () : Float

ArcCos () : Float

ArcTan () : Float

Cotan () : Float

RadToDeg () : Float

DegToRad () : Float

ArcSinh () : Float

ArcCosh () : Float

ArcTanh () : Float

Cosh () : Float

Sinh () : Float

Tanh () : Float

 

Transcendental

Exp () : Float

Ln () : Float

Log10 () : Float

Log2 () : Float

LogN (x : Float) : Float

Max (v2 : Float) : Float

Min (v2 : Float) : Float

Power (exponent : Integer) : Float

Sqr () : Float

Sqrt () : Float

 

Rounding

Int () : Float

Fraction () : Float

Floor () : Integer

Ceiling () : Integer

Round () : Integer

Truncate () : Integer

 

 

Information

Sign () : Integer

IsFinite () : Boolean

IsInfinite () : Boolean

IsNaN () : Boolean

ToString (p : Integer) : String

Clamp (min : Float; max : Float) : Float

 

Internal Maths functions

·Odd(i : Integer) : returns True if i is odd
·Cos(a : Float) : returns the cosine of an angle in radians
·Sin(a : Float) : returns the sine of an angle in radians
·Tan(a : Float) : returns the tangent of an angle in radians
·Cotan(a : Float) : returns the cotangent of an angle in radians
·Cosh(a : Float) : returns the hyperbolic cosine of a
·Sinh(a : Float) : returns the hyperbolic sine of a
·Tanh(a : Float) : returns the hyperbolic tangent of a
·ArcSin(v : Float) : returns the arc-sine in radians
·ArcCos(v : Float) : returns the arc-cosine in radians
·ArcTan(v : Float) : returns the arc-tangent in radians
·ArcTan2(y, x : Float) : returns the arc-tangent in radians of the angle between y and x
·ArcSinh(v : Float) : returns the inverse hyperbolic sine of v
·ArcCosh(v : Float) : returns the inverse hyperbolic cosine of v
·ArcTanh(v : Float) : returns the inverse hyperbolic tangent of v
·Hypot(x, y : Float) : returns the length of the hypotenuse of a right triangle with sides of lengths x and y
·Factorial(v : integer) : returns the factorial of v
·Exp(v : Float) : returns the mathematical constant e, raised to the power of the argument v
·Ln(v : Float) : returns the natural logarithm of v
·Log2(v : Float) : returns the base 2 logarithm of v
·Log10(v : Float) : returns the base 10 logarithm of v
·LogN(v : Float) : returns the base n logarithm of x
·Power(base, exponent : Float) : returns the base value raised to the power of the exponent argument
·IntPower(base : Float; exponent : integer) : returns the base value raised to the power of the exponent argument, where exponent is an integer
·Sqrt(v : Float) : returns the square root of v
·Int(v : Float) : returns the integer part of v
·Frac(v : Float) : returns the fractional part of v
·Floor(v : Float) : returns the next integer less than or equal to v
·Ceil(v : Float) : returns the next integer greater than or equal to v
·Trunc(v : Float) : returns the integer part of v
·Round(v : Float) : rounds v to the nearest integer
·DegToRad(a : Float) : converts the angle a from degrees to radians
·RadToDeg(a : Float) : converts the angle a from radians to degrees
·Sign(v : Float) : returns the sign of v: -1 for negative values, 0 for zero, or 1 for positive values
·Sign(v : Integer) : returns the sign of v: -1 for negative values, 0 for zero, or 1 for positive values
·Max(v1, v2 : Float) : returns v1 or v2, whichever is greater
·Max(v1, v2 : Integer) : returns v1 or v2, whichever is greater
·MaxInt(v1, v2 : Integer) : Same as the integer version of Max, above
·Min(v1, v2 : Float) : returns v1 or v2, whichever is less
·Min(v1, v2 : Integer) : returns v1 or v2, whichever is less
·MinInt(v1, v2 : Integer) : Same as the integer version of Min, above
·Clamp(v, min, max : Float) : returns v if it is within the range defined by min and max, or either min or max, depending on whether v was less than min or greater than max
·ClampInt(v, min, max : Integer) : returns v if it is within the range defined by min and max, or either min or max, depending on whether v was less than min or greater than max
·Pi : returns the mathematical constant Pi
·Gcd(a, b : Integer) : returns the greatest common denominator of a and b
·Lcm(a, b : Integer) : returns the least common multiple of a and b
·IsPrime(n : Integer) : returns true if n is prime, or false otherwise
·LeastFactor(n : Integer) : returns the smallest prime factor of n
·Random : returns a random float in the range <= result < 1
·RandomInt(range : Integer) : returns a random integer in the range <= result < range
·Randomize : Initializes the random number generator
·RandG(mean, stdDev : Float) : returns a random value from the distribution curve described by the mean and standard deviation arguments
·RandSeed : Returns the current seed of the random number generator. Deprecated
·SetRandSeed(seed : Integer) : Sets a new seed for the random number generator.

 

Internal Date/Time functions

These functions use a Float to represent a date time, similar to TDateTime (1 unit per day, same time origin as in Delphi).

·Now() : returns the current date time
·Date() : returns the current date
·Time() : returns the current time
·UTCDateTime() : returns the current UTC date time
·DateTimeToStr(dt : Float) : converts a date time to a string representation
·StrToDateTime(str : String) : parses a string representing a date time
·StrToDateTimeDef(str : String; def : Float) : parses a string representing a date time, returns def if the string isn't a valid date time
·DateToStr(dt : Float)
·StrToDate(str : String)
·StrToDateDef(str : String; def : Float)
·DateToISO8601(dt : Float) : converts a date to its ISO8601 string representation
·DateTimeToISO8601(dt : Float) : converts a date time to its ISO8601 string representation
·TimeToStr(dt : Float)
·StrToTime(str : String)
·StrToTimeDef(str : String; def : Float)
·DayOfWeek(dt : Float) : returns the day of the week between 1 and 7 with Sunday as the first day
·DayOfTheWeek(dt : Float) : returns the day of the week between 1 and 7 with Monday as the first day
·FormatDateTime(frm: String; dt: Float)
·IsLeapYear(year : Integer) : indicates if a year is a leap year
·IncMonth(dt : Float; nb : Integer) : returns a date time offset by nb months (nb can be negative or positive)
·DecodeDate(dt : Float; var y, m, d : Integer)
·EncodeDate(y, m, d) : Integer
·DecodeTime(dt : Float; var h, m, s, ms : Integer)
·EncodeTime(h, m, s, ms : Integer)
·FirstDayOfYear(dt : Float)
·FirstDayOfNextYear(dt : Float)
·FirstDayOfMonth(dt : Float)
·FirstDayOfNextMonth(dt : Float)
·FirstDayOfWeek(dt : Float)
·DayOfYear(dt : Float)
·MonthOfYear(dt : Float)
·DayOfMonth(dt : Float)
·DateToWeekNumber(dt : Float)
·WeekNumber(dt : Float)
·DateToYearOfWeek(dt : Float)
·YearOfWeek(dt : Float)

 

Go to Date object JS reference.

 

Go to Math object JS reference.