Math Functions

## Functions

int | Qore::abs (int i)
| Returns the absolute value of the argument passed. More...
number | Qore::abs (number n)
| Returns the absolute value of the argument passed. More...
float | Qore::abs (softfloat f)
| Returns the absolute value of the argument passed. More...
float | Qore::abs ()
| This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments. More...
number | Qore::acos (number n)
| Returns the value in radians of the arc cosine of the given value. More...
float | Qore::acos (softfloat f)
| Returns the value in radians of the arc cosine of the given value. More...
number | Qore::asin (number n)
| Returns the value in radians of the arc sine of the given value. More...
float | Qore::asin (softfloat f)
| Returns the value in radians of the arc sine of the given value. More...
float | Qore::asin ()
| This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments. More...
number | Qore::atan (number n)
| Returns the value in radians of the arc tangent of the given value. More...
float | Qore::atan (softfloat f)
| Returns the value in radians of the arc tangent of the given value. More...
float | Qore::atan ()
| This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments. More...
number | Qore::atan2 (number y, number x)
| Returns the principal value of the arc tangent of y/x, using the signs of the two arguments to determine the quadrant of the result. More...
float | Qore::atan2 (softfloat y, softfloat x)
| Returns the principal value of the arc tangent of y/x, using the signs of the two arguments to determine the quadrant of the result. More...
float | Qore::atan2 ()
| This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments. More...
number | Qore::cbrt (number n)
| Returns the cube root of the number passed. More...
float | Qore::cbrt (softfloat f)
| Returns the cube root of the number passed. More...
float | Qore::cbrt ()
| This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments. More...
int | Qore::ceil (int num, int prec=0)
| Returns the smallest multiple of -prec-th power of 10 that is greater than or equal to num. (Thus, for non-negative prec just returns num). More...
float | Qore::ceil (softfloat num, int prec=0)
| Returns the smallest multiple of -prec-th power of 10 that is greater than or equal to num. More...
number | Qore::ceil (number num, int prec=0)
| Returns the smallest multiple of -prec-th power of 10 that is greater than or equal to num. More...
float | Qore::ceil ()
| This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments. More...
int | Qore::compare (number n1, number n2, number epsilon)
| Compares numbers with a given epsilon. More...
int | Qore::compare (float n1, float n2, float epsilon)
| Compares numbers with a given epsilon. More...
number | Qore::cos (number n)
| Returns the cosine of the number in radians passed. More...
float | Qore::cos (float f)
| Returns the cosine of the number in radians passed. More...
float | Qore::cos ()
| This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments. More...
number | Qore::cosh (number n)
| Returns the hyperbolic cosine of the given value. More...
float | Qore::cosh (softfloat f)
| Returns the hyperbolic cosine of the given value. More...
float | Qore::cosh ()
| This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments. More...
number | Qore::exp (number n)
| Returns the value of e (the base of natural logarithms) raised to the power of the given number. More...
float | Qore::exp (softfloat f)
| Returns the value of e (the base of natural logarithms) raised to the power of the given number. More...
float | Qore::exp ()
| This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments. More...
number | Qore::exp2 (number n)
| Returns the value of 2 raised to the power of the given number. More...
float | Qore::exp2 (softfloat f)
| Returns the value of 2 raised to the power of the given number. More...
float | Qore::exp2 ()
| This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments. More...
number | Qore::expm1 (number n)
| Returns the value of e (the base of natural logarithms) raised to the power of the given number - 1. More...
float | Qore::expm1 (softfloat f)
| Returns the value of e (the base of natural logarithms) raised to the power of the given number - 1. More...
float | Qore::expm1 ()
| This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments. More...
int | Qore::floor (int num, int prec=0)
| Returns the largest multiple of -prec-th power of 10 that is less than or equal to num. (Thus, for non-negative prec just returns num). More...
float | Qore::floor (softfloat f, int prec=0)
| Returns the largest multiple of -prec-th power of 10 that is less than or equal to num. More...
number | Qore::floor (number num, int prec=0)
| Returns the largest multiple of -prec-th power of 10 that is less than or equal to num. More...
float | Qore::floor ()
| This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments. More...
number | Qore::hypot (number x, number y)
| Returns the length of the hypotenuse of a right-angle triangle with sides given as the two arguments. More...
float | Qore::hypot (softfloat x, softfloat y)
| Returns the length of the hypotenuse of a right-angle triangle with sides given as the two arguments. More...
float | Qore::hypot ()
| This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments. More...
number | Qore::log10 (number n)
| Returns the base 10 logarithm of the given number. More...
float | Qore::log10 (softfloat f)
| Returns the base 10 logarithm of the given number. More...
float | Qore::log10 ()
| This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments. More...
number | Qore::log1p (number n)
| Returns the natural logarithm of 1 + the given number. More...
float | Qore::log1p (softfloat f)
| Returns the natural logarithm of 1 + the given number. More...
float | Qore::log1p ()
| This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments. More...
float | Qore::logb (softfloat f)
| Returns the exponent of the given number. More...
float | Qore::logb ()
| This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments. More...
number | Qore::nlog (number n)
| Returns the natural logarithm of the given value. More...
float | Qore::nlog (softfloat f)
| Returns the natural logarithm of the given value. More...
float | Qore::nlog ()
| This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments. More...
number | Qore::pow (number x, number y)
| Returns a number raised to the power of another number. More...
float | Qore::pow (softfloat x=0.0, softfloat y=0.0)
| Returns a number raised to the power of another number. More...
int | Qore::round (softint num, int prec=0)
| Returns the multiple of -prec-th power of 10 that is closest to num (numbers halfway between two such powers of 10 are rounded away from zero). (So, for non-negative prec just returns num). More...
float | Qore::round (softfloat num, int prec=0)
| Returns the multiple of -prec-th power of 10 that is closest to num (numbers halfway between two such powers of 10 are rounded away from zero). More...
number | Qore::round (number num, int prec=0)
| Returns the multiple of -prec-th power of 10 that is closest to num (numbers halfway between two such powers of 10 are rounded away from zero). More...
float | Qore::round ()
| This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments. More...
number | Qore::sin (number n)
| Returns the sine of the number in radians passed. More...
float | Qore::sin (softfloat f)
| Returns the sine of the number in radians passed. More...
float | Qore::sin ()
| This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments. More...
number | Qore::sinh (number n)
| Returns the hyperbolic sine of the given value. More...
float | Qore::sinh (softfloat f)
| Returns the hyperbolic sine of the given value. More...
float | Qore::sinh ()
| This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments. More...
number | Qore::sqrt (number n)
| Returns the square root of the number passed. More...
float | Qore::sqrt (softfloat f)
| Returns the square root of the number passed. More...
float | Qore::sqrt ()
| This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments. More...
number | Qore::tan (number n)
| Returns the tangent of the number in radians passed. More...
float | Qore::tan (softfloat f)
| Returns the tangent of the number in radians passed. More...
float | Qore::tan ()
| This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments. More...
number | Qore::tanh (number n)
| Returns the hyperbolic tangent of the given value. More...
float | Qore::tanh (softfloat f)
| Returns the hyperbolic tangent of the given value. More...
float | Qore::tanh ()
| This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments. More...

## Detailed Description

Math functions

## Function Documentation

## abs() [1/4]

int Qore::abs | ( | int | i | ) |

Returns the absolute value of the argument passed.

Code Flags:
  CONSTANT

Parameters

  i | the value to process

Returns
  the absolute value of the argument passed

Example:
  int i = abs(-20); # returns 20

Note
  equivalent to <int>::abs()

## abs() [2/4]

number Qore::abs | ( | number | n | ) |

Returns the absolute value of the argument passed.

Code Flags:
  CONSTANT

Parameters

  n | the value to process

Returns
  the absolute value of the argument passed

Example:
  number n = abs(-20n); # returns 20n

Note
  equivalent to <number>::abs()

## abs() [3/4]

float Qore::abs | ( | softfloat | f | ) |

Returns the absolute value of the argument passed.

Code Flags:
  CONSTANT

Parameters

  f | the value to process

Returns
  the absolute value of the argument passed

Example:
  float f = abs(-20.2); # returns 20.2

Note
  equivalent to <float>::abs()

## abs() [4/4]

float Qore::abs | ( |  | ) |

This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.

Code Flags:
  RUNTIME_NOOP

## acos() [1/2]

number Qore::acos | ( | number | n | ) |

Returns the value in radians of the arc cosine of the given value.

Code Flags:
  CONSTANT

Parameters

  n | the cosine value to process

Returns
  the value in radians of the arc cosine of the given value

Example:
  number x = acos(y);

## acos() [2/2]

float Qore::acos | ( | softfloat | f | ) |

Returns the value in radians of the arc cosine of the given value.

Code Flags:
  CONSTANT

Parameters

  f | the cosine value to process

Returns
  the value in radians of the arc cosine of the given value

Example:
  float x = acos(y);

## asin() [1/3]

number Qore::asin | ( | number | n | ) |

Returns the value in radians of the arc sine of the given value.

Code Flags:
  CONSTANT

Parameters

  n | the sine value to process

Returns
  the value in radians of the arc sine of the given value

Example:
  number x = asin(y);

## asin() [2/3]

float Qore::asin | ( | softfloat | f | ) |

Returns the value in radians of the arc sine of the given value.

Code Flags:
  CONSTANT

Parameters

  f | the sine value to process

Returns
  the value in radians of the arc sine of the given value

Example:
  float x = asin(y);

## asin() [3/3]

float Qore::asin | ( |  | ) |

This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.

Code Flags:
  RUNTIME_NOOP

## atan() [1/3]

number Qore::atan | ( | number | n | ) |

Returns the value in radians of the arc tangent of the given value.

Code Flags:
  CONSTANT

Parameters

  n | the tangent value to process

Returns
  the value in radians of the arc tangent of the given value

Example:
  number x = atan(y);

## atan() [2/3]

float Qore::atan | ( | softfloat | f | ) |

Returns the value in radians of the arc tangent of the given value.

Code Flags:
  CONSTANT

Parameters

  f | the tangent value to process

Returns
  the value in radians of the arc tangent of the given value

Example:
  float x = atan(y);

## atan() [3/3]

float Qore::atan | ( |  | ) |

This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.

Code Flags:
  RUNTIME_NOOP

## atan2() [1/3]

number Qore::atan2 | ( | number | y,
|  | number | x
| ) |  |

Returns the principal value of the arc tangent of y/x, using the signs of the two arguments to determine the quadrant of the result.

Code Flags:
  CONSTANT

Parameters

  y | the y value for the function
  x | the x value for the function

Returns
  the principal value of the arc tangent of y/x, using the signs of the two arguments to determine the quadrant of the result

Example:
  number f = atan2(y, x);

## atan2() [2/3]

float Qore::atan2 | ( | softfloat | y,
|  | softfloat | x
| ) |  |

Returns the principal value of the arc tangent of y/x, using the signs of the two arguments to determine the quadrant of the result.

Code Flags:
  CONSTANT

Parameters

  y | the y value for the function
  x | the x value for the function

Returns
  the principal value of the arc tangent of y/x, using the signs of the two arguments to determine the quadrant of the result

Example:
  float f = atan2(y, x);

## atan2() [3/3]

float Qore::atan2 | ( |  | ) |

This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.

Code Flags:
  RUNTIME_NOOP

## cbrt() [1/3]

number Qore::cbrt | ( | number | n | ) |

Returns the cube root of the number passed.

Code Flags:
  CONSTANT

Parameters

  n | the value to process

Returns
  the cube root of the number passed

Example:
  number x = cbrt(y);

## cbrt() [2/3]

float Qore::cbrt | ( | softfloat | f | ) |

Returns the cube root of the number passed.

Code Flags:
  CONSTANT

Parameters

  f | the value to process

Returns
  the cube root of the number passed

Example:
  float x = cbrt(y);

## cbrt() [3/3]

float Qore::cbrt | ( |  | ) |

This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.

Code Flags:
  RUNTIME_NOOP

## ceil() [1/4]

int Qore::ceil | ( | int | num,
|  | int | prec = `0`
| ) |  |

Returns the smallest multiple of -prec-th power of 10 that is greater than or equal to num. (Thus, for non-negative prec just returns num).

Code Flags:
  CONSTANT

Parameters

  num | an integer number to process (to round upwards)
  prec | precision

Example:
  ceil( 64501, -2); // returns 64600
  ceil(-64999, -3); // returns -64000
  ceil( 34500, -8); // returns 100000000
  ceil(-34500, -8); // returns 0

See also
  floor(softint num, int prec = 0)

Since
  Qore 0.8.13 this function accepts the prec argument to specify the rounding precision

## ceil() [2/4]

float Qore::ceil | ( | softfloat | num,
|  | int | prec = `0`
| ) |  |

Returns the smallest multiple of -prec-th power of 10 that is greater than or equal to num.

Code Flags:
  CONSTANT

Parameters

  num | the number to process (to round upwards)
  prec | precision

Example:
  ceil( 357.271, 2); // returns 357.28
  ceil( -357.271, 1); // returns -357.2
  ceil(-64599.28, -2); // returns -64500.0
  ceil( 14500.28, -4); // returns 20000.0
  ceil( 34500.28, -7); // returns 10000000.0
  ceil(-34500.28, -7); // returns 0.0

See also
  floor(softfloat num, int prec = 0)

Since
  Qore 0.8.13 this function accepts the prec argument to specify the rounding precision

## ceil() [3/4]

number Qore::ceil | ( | number | num,
|  | int | prec = `0`
| ) |  |

Returns the smallest multiple of -prec-th power of 10 that is greater than or equal to num.

Code Flags:
  CONSTANT

Parameters

  num | the number to process (to round upwards)
  prec | precision

Example:
  ceil( 357.271n, 2); // returns 357.28n
  ceil( -357.271n, 1); // returns -357.2n
  ceil(-64599.28n, -2); // returns -64500n
  ceil( 14500n, -4); // returns 20000n
  ceil( 34500.28n, -7); // returns 10000000n
  ceil(-34500.28n, -7); // returns 0n

See also
  floor(number num, int prec = 0)

Since
  Qore 0.8.13 this function accepts the prec argument to specify the rounding precision

## ceil() [4/4]

float Qore::ceil | ( |  | ) |

This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.

Code Flags:
  RUNTIME_NOOP

## compare() [1/2]

int Qore::compare | ( | number | n1,
|  | number | n2,
|  | number | epsilon
| ) |  |

Compares numbers with a given epsilon.

Code Flags:
  CONSTANT

Parameters

  n1 | the first number
  n2 | the second number
  epsilon | the maximum difference in the numbers under which they are considered equal

Returns
  -1 if n1 is less then n2, 0 if the difference between the numbers is less than epsilon, 1 if n1 is greater than n2

Since
  Qore 0.9.5

## compare() [2/2]

int Qore::compare | ( | float | n1,
|  | float | n2,
|  | float | epsilon
| ) |  |

Compares numbers with a given epsilon.

Code Flags:
  CONSTANT

Parameters

  n1 | the first number
  n2 | the second number
  epsilon | the maximum difference in the numbers under which they are considered equal

Returns
  -1 if n1 is less then n2, 0 if the difference between the numbers is less than epsilon, 1 if n1 is greater than n2

Since
  Qore 0.9.5

## cos() [1/3]

number Qore::cos | ( | number | n | ) |

Returns the cosine of the number in radians passed.

Code Flags:
  CONSTANT

Parameters

  n | the angle in radians

Returns
  the cosine of the number in radians passed

Example:
  number x = cos(y);

## cos() [2/3]

float Qore::cos | ( | float | f | ) |

Returns the cosine of the number in radians passed.

Code Flags:
  CONSTANT

Parameters

  f | the angle in radians

Returns
  the cosine of the number in radians passed

Example:
  float x = cos(y);

## cos() [3/3]

float Qore::cos | ( |  | ) |

This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.

Code Flags:
  RUNTIME_NOOP

## cosh() [1/3]

number Qore::cosh | ( | number | n | ) |

Returns the hyperbolic cosine of the given value.

Code Flags:
  CONSTANT

Parameters

  n | the value to process

Returns
  the hyperbolic cosine of the given value

Example:
  number x = cosh(y);

## cosh() [2/3]

float Qore::cosh | ( | softfloat | f | ) |

Returns the hyperbolic cosine of the given value.

Code Flags:
  CONSTANT

Parameters

  f | the value to process

Returns
  the hyperbolic cosine of the given value

Example:
  float x = cosh(y);

## cosh() [3/3]

float Qore::cosh | ( |  | ) |

This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.

Code Flags:
  RUNTIME_NOOP

## exp() [1/3]

number Qore::exp | ( | number | n | ) |

Returns the value of e (the base of natural logarithms) raised to the power of the given number.

Code Flags:
  CONSTANT

Parameters

  n | the value to process

Returns
  the value of e (the base of natural logarithms) raised to the power of the given number

Example:
  number x = exp(y);

## exp() [2/3]

float Qore::exp | ( | softfloat | f | ) |

Returns the value of e (the base of natural logarithms) raised to the power of the given number.

Code Flags:
  CONSTANT

Parameters

  f | the value to process

Returns
  the value of e (the base of natural logarithms) raised to the power of the given number

Example:
  float x = exp(y);

## exp() [3/3]

float Qore::exp | ( |  | ) |

This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.

Code Flags:
  RUNTIME_NOOP

## exp2() [1/3]

number Qore::exp2 | ( | number | n | ) |

Returns the value of 2 raised to the power of the given number.

Code Flags:
  CONSTANT

Parameters

  n | the value to process

Returns
  the value of 2 raised to the power of the given number

Example:
  number x = exp2(y);

## exp2() [2/3]

float Qore::exp2 | ( | softfloat | f | ) |

Returns the value of 2 raised to the power of the given number.

Code Flags:
  CONSTANT

Parameters

  f | the value to process

Returns
  the value of 2 raised to the power of the given number

Example:
  float x = exp2(y);

## exp2() [3/3]

float Qore::exp2 | ( |  | ) |

This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.

Code Flags:
  RUNTIME_NOOP

## expm1() [1/3]

number Qore::expm1 | ( | number | n | ) |

Returns the value of e (the base of natural logarithms) raised to the power of the given number - 1.

Code Flags:
  CONSTANT

Parameters

  n | the value to process

Returns
  the value of e (the base of natural logarithms) raised to the power of the given number - 1

Example:
  number x = exp1m(y);

## expm1() [2/3]

float Qore::expm1 | ( | softfloat | f | ) |

Returns the value of e (the base of natural logarithms) raised to the power of the given number - 1.

Code Flags:
  CONSTANT

Parameters

  f | the value to process

Returns
  the value of e (the base of natural logarithms) raised to the power of the given number - 1

Example:
  float x = exp1m(y);

## expm1() [3/3]

float Qore::expm1 | ( |  | ) |

This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.

Code Flags:
  RUNTIME_NOOP

## floor() [1/4]

int Qore::floor | ( | int | num,
|  | int | prec = `0`
| ) |  |

Returns the largest multiple of -prec-th power of 10 that is less than or equal to num. (Thus, for non-negative prec just returns num).

Code Flags:
  CONSTANT

Parameters

  num | an integer number to process (to round downwards)
  prec | precision

Example:
  floor(-64501, -2); // returns -64600
  floor( 64999, -3); // returns 64000
  floor(-34500, -8); // returns -100000000
  floor( 34500, -8); // returns 0

See also
  ceil(softint num, int prec = 0)

Since
  Qore 0.8.13 this function accepts the prec argument to specify the rounding precision

## floor() [2/4]

float Qore::floor | ( | softfloat | f,
|  | int | prec = `0`
| ) |  |

Returns the largest multiple of -prec-th power of 10 that is less than or equal to num.

Code Flags:
  CONSTANT

Parameters

  f | the number to process (to round downwards)
  prec | precision

Example:
  floor( 357.271, 2); // returns 357.27
  floor( -357.271, 1); // returns -357.3
  floor( 64599.28, -2); // returns 64500.0
  floor( 17500.28, -4); // returns 10000.0
  floor( 34500.28, -7); // returns 0.0
  floor(-34500.28, -7); // returns -10000000.0

See also
  ceil(softfloat num, int prec = 0)

Since
  Qore 0.8.13 this function accepts the prec argument to specify the rounding precision

## floor() [3/4]

number Qore::floor | ( | number | num,
|  | int | prec = `0`
| ) |  |

Returns the largest multiple of -prec-th power of 10 that is less than or equal to num.

Code Flags:
  CONSTANT

Parameters

  num | the number to process (to round downwards)
  prec | precision

Example:
  floor( 357.271n, 2); // returns 357.27n
  floor( -357.271n, 1); // returns -357.3n
  floor( 64599.28n, -2); // returns 64500n
  floor( 17500.28n, -4); // returns 10000n
  floor( 34500.28n, -7); // returns 0n
  floor(-34500.28n, -7); // returns -10000000n

See also
  ceil(number num, int prec = 0)

Since
  Qore 0.8.13 this function accepts the prec argument to specify the rounding precision

## floor() [4/4]

float Qore::floor | ( |  | ) |

This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.

Code Flags:
  RUNTIME_NOOP

## hypot() [1/3]

number Qore::hypot | ( | number | x,
|  | number | y
| ) |  |

Returns the length of the hypotenuse of a right-angle triangle with sides given as the two arguments.

Code Flags:
  CONSTANT

Parameters

  x | the length of side x of the right-angle triangle
  y | the length of side y of the right-angle triangle

Returns
  the length of the hypotenuse of a right-angle triangle with sides given as the two arguments

Example:
  number z = hypot(x, y);

## hypot() [2/3]

float Qore::hypot | ( | softfloat | x,
|  | softfloat | y
| ) |  |

Returns the length of the hypotenuse of a right-angle triangle with sides given as the two arguments.

Code Flags:
  CONSTANT

Parameters

  x | the length of side x of the right-angle triangle
  y | the length of side y of the right-angle triangle

Returns
  the length of the hypotenuse of a right-angle triangle with sides given as the two arguments

Example:
  float z = hypot(x, y);

## hypot() [3/3]

float Qore::hypot | ( |  | ) |

This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.

Code Flags:
  RUNTIME_NOOP

## log10() [1/3]

number Qore::log10 | ( | number | n | ) |

Returns the base 10 logarithm of the given number.

Code Flags:
  CONSTANT

Parameters

  n | the value to process

Returns
  the base 10 logarithm of the given value

Example:
  number x = log10(y);

## log10() [2/3]

float Qore::log10 | ( | softfloat | f | ) |

Returns the base 10 logarithm of the given number.

Code Flags:
  CONSTANT

Parameters

  f | the value to process

Returns
  the base 10 logarithm of the given value

Example:
  float x = log10(y);

## log10() [3/3]

float Qore::log10 | ( |  | ) |

This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.

Code Flags:
  RUNTIME_NOOP

## log1p() [1/3]

number Qore::log1p | ( | number | n | ) |

Returns the natural logarithm of 1 + the given number.

Code Flags:
  CONSTANT

Parameters

  n | the value to process

Returns
  the natural logarithm of 1 + the given number

Example:
  number x = log1p(y);

## log1p() [2/3]

float Qore::log1p | ( | softfloat | f | ) |

Returns the natural logarithm of 1 + the given number.

Code Flags:
  CONSTANT

Parameters

  f | the value to process

Returns
  the natural logarithm of 1 + the given number

Example:
  float x = log1p(y);

## log1p() [3/3]

float Qore::log1p | ( |  | ) |

This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.

Code Flags:
  RUNTIME_NOOP

## logb() [1/2]

float Qore::logb | ( | softfloat | f | ) |

Returns the exponent of the given number.

Code Flags:
  CONSTANT

Parameters

  f | the value to process

Returns
  the exponent of the given number

Example:
  float x = logb(y);

## logb() [2/2]

float Qore::logb | ( |  | ) |

This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.

Code Flags:
  RUNTIME_NOOP

## nlog() [1/3]

number Qore::nlog | ( | number | n | ) |

Returns the natural logarithm of the given value.

Code Flags:
  CONSTANT

Parameters

  n | the value to process

Returns
  the natural logarithm of the given value

Example:
  float x = nlog(y);

## nlog() [2/3]

float Qore::nlog | ( | softfloat | f | ) |

Returns the natural logarithm of the given value.

Code Flags:
  CONSTANT

Parameters

  f | the value to process

Returns
  the natural logarithm of the given value

Example:
  float x = nlog(y);

## nlog() [3/3]

float Qore::nlog | ( |  | ) |

This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.

Code Flags:
  RUNTIME_NOOP

## pow() [1/2]

number Qore::pow | ( | number | x,
|  | number | y
| ) |  |

Returns a number raised to the power of another number.

Code Flags:
  RET_VALUE_ONLY

Parameters

  x | the number to raise to the power of y
  y | the power to raise x to

Returns
  a number raised to the power of another number

Example:
  number z = pow(x, y);

Exceptions

  DIVISION-BY-ZERO | in pow(x, y), if x = 0 then y must be a non-negative value

## pow() [2/2]

float Qore::pow | ( | softfloat | x = `0.0`,
|  | softfloat | y = `0.0`
| ) |  |

Returns a number raised to the power of another number.

Code Flags:
  RET_VALUE_ONLY

Parameters

  x | the number to raise to the power of y
  y | the power to raise x to

Returns
  a number raised to the power of another number

Example:
  float z = pow(x, y);

Exceptions

  DIVISION-BY-ZERO | in pow(x, y), if x = 0 then y must be a non-negative value
  INVALID-POW-ARGUMENTS | in pow(x, y), x cannot be negative when y is not an integer value

## round() [1/4]

int Qore::round | ( | softint | num,
|  | int | prec = `0`
| ) |  |

Returns the multiple of -prec-th power of 10 that is closest to num (numbers halfway between two such powers of 10 are rounded away from zero). (So, for non-negative prec just returns num).

Code Flags:
  CONSTANT

Parameters

  num | an integer number to round
  prec | precision

Example:
  round(-6450, -2); // returns -6500
  round( 6450, -3); // returns 6000
  round(-6450, -4); // returns -10000
  round( 6450, -5); // returns 0

Since
  Qore 0.8.13 this function accepts the prec argument to specify the rounding precision

## round() [2/4]

float Qore::round | ( | softfloat | num,
|  | int | prec = `0`
| ) |  |

Returns the multiple of -prec-th power of 10 that is closest to num (numbers halfway between two such powers of 10 are rounded away from zero).

Platform Availability
  Qore::Option::HAVE_ROUND

Code Flags:
  CONSTANT

Parameters

  num | a number to round
  prec | precision

Example:
  round( 6450.36481, 3); // returns 6450.365
  round(-6450.36481, 2); // returns -6450.36
  round( 6450.36481, -2); // returns 6500.0
  round(-6450.36481, -3); // returns -6000.0
  round( 6450.36481, -4); // returns 10000.0
  round(-6450.36481, -5); // returns 0.0

Since
  Qore 0.8.13 this function accepts the prec argument to specify the rounding precision

## round() [3/4]

number Qore::round | ( | number | num,
|  | int | prec = `0`
| ) |  |

Returns the multiple of -prec-th power of 10 that is closest to num (numbers halfway between two such powers of 10 are rounded away from zero).

Code Flags:
  CONSTANT

Parameters

  num | a number to round
  prec | precision

Example:
  round( 645084.36481772n, 5); // returns 645084.36482n
  round(-645084.36481772n, 3); // returns -645084.365n
  round( 645084.36481772n, -4); // returns 650000n
  round(-645084.36481772n, -5); // returns -600000n
  round( 645084.36481772n, -6); // returns 1000000n
  round(-645084.36481772n, -7); // returns 0n

Since
  Qore 0.8.13 this function accepts the prec argument to specify the rounding precision

## round() [4/4]

float Qore::round | ( |  | ) |

This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.

Code Flags:
  RUNTIME_NOOP

## sin() [1/3]

number Qore::sin | ( | number | n | ) |

Returns the sine of the number in radians passed.

Code Flags:
  CONSTANT

Parameters

  n | the angle in radians

Returns
  the sine of the number in radians passed

Example:
  number x = sin(y);

## sin() [2/3]

float Qore::sin | ( | softfloat | f | ) |

Returns the sine of the number in radians passed.

Code Flags:
  CONSTANT

Parameters

  f | the angle in radians

Returns
  the sine of the number in radians passed

Example:
  float x = sin(y);

## sin() [3/3]

float Qore::sin | ( |  | ) |

This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.

Code Flags:
  RUNTIME_NOOP

## sinh() [1/3]

number Qore::sinh | ( | number | n | ) |

Returns the hyperbolic sine of the given value.

Code Flags:
  CONSTANT

Parameters

  n | the value to process

Returns
  the hyperbolic sine of the given value

Example:
  number x = sinh(y);

## sinh() [2/3]

float Qore::sinh | ( | softfloat | f | ) |

Returns the hyperbolic sine of the given value.

Code Flags:
  CONSTANT

Parameters

  f | the value to process

Returns
  the hyperbolic sine of the given value

Example:
  float x = sinh(y);

## sinh() [3/3]

float Qore::sinh | ( |  | ) |

This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.

Code Flags:
  RUNTIME_NOOP

## sqrt() [1/3]

number Qore::sqrt | ( | number | n | ) |

Returns the square root of the number passed.

Code Flags:
  CONSTANT

Parameters

  n | the value to process

Returns
  the square root of the number passed

Example:
  number x = sqrt(y);

## sqrt() [2/3]

float Qore::sqrt | ( | softfloat | f | ) |

Returns the square root of the number passed.

Code Flags:
  CONSTANT

Parameters

  f | the value to process

Returns
  the square root of the number passed

Example:
  float x = sqrt(y);

## sqrt() [3/3]

float Qore::sqrt | ( |  | ) |

This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.

Code Flags:
  RUNTIME_NOOP

## tan() [1/3]

number Qore::tan | ( | number | n | ) |

Returns the tangent of the number in radians passed.

Code Flags:
  CONSTANT

Parameters

  n | the angle in radians

Returns
  the tangent of the number in radians passed

Example:
  number x = tan(y);

## tan() [2/3]

float Qore::tan | ( | softfloat | f | ) |

Returns the tangent of the number in radians passed.

Code Flags:
  CONSTANT

Parameters

  f | the angle in radians

Returns
  the tangent of the number in radians passed

Example:
  float x = tan(y);

## tan() [3/3]

float Qore::tan | ( |  | ) |

This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.

Code Flags:
  RUNTIME_NOOP

## tanh() [1/3]

number Qore::tanh | ( | number | n | ) |

Returns the hyperbolic tangent of the given value.

Code Flags:
  CONSTANT

Parameters

  n | the value to process

Returns
  the hyperbolic tangent of the given value

Example:
  number x = tanh(y);

## tanh() [2/3]

float Qore::tanh | ( | softfloat | f | ) |

Returns the hyperbolic tangent of the given value.

Code Flags:
  CONSTANT

Parameters

  f | the value to process

Returns
  the hyperbolic tangent of the given value

Example:
  float x = tanh(y);

## tanh() [3/3]

float Qore::tanh | ( |  | ) |

This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.

Code Flags:
  RUNTIME_NOOP