Module BCmath

Register functions for the bcmath api.

Functions

bcmath:__call () Instance is callable.
bcmath:__tostring () Instance is stringable.
bcmath:scale () Get scale from self.
bcmath:value () Get value from self.
bcmath:payload () Get payload from self.
bcmath:getInfinite () Get infinite.
bcmath:isInfinite () Is infinite.
bcmath:isFinite () Is finite.
bcmath:getZero () Get zero.
bcmath:isZero () Is zero.
bcmath:isNaN () Is a NaN.
bcmath:exists () Has a value.
bcmath:neg () Negates self.
bcmath:add () Add self with addend.
bcmath:sub () Subtract self with subtrahend.
bcmath:mul () Multiply self with multiplicator.
bcmath:div () Divide self with divisor.
bcmath:mod () Modulus self with divisor.
bcmath:pow () Power self with exponent.
bcmath:powmod () Power-modulus self with exponent and divisor.
bcmath:sqrt () Square root self.
bcmath:comp () Compare self with operand.
bcmath:round () Round self to given precision.
mw.bcmath.new () Create new instance.
mw.bcmath.getZero () Get the string zero.
mw.bcmath.isZero () Is the string zero.
mw.bcmath.getInfinity () Get the strings infinite part.
mw.bcmath.isInfinite () Is the string infinite.
mw.bcmath.isFinite () Is the string finite.
mw.bcmath.neg () Negates the string representation of the number
mw.bcmath.add () Add the addend to augend.
mw.bcmath.sub () Subtract the subtrahend from minuend.
mw.bcmath.mul () Multiply the multiplicator with multiplier.
mw.bcmath.div () Divide the divisor from dividend.
mw.bcmath.mod () Modulus the divisor from dividend.
mw.bcmath.pow () Power the base to exponent.
mw.bcmath.powmod () Power-modulus the base to exponent.
mw.bcmath.sqrt () Square root of the operand.
mw.bcmath.comp () Compare the left operand with the right operand.
mw.bcmath.eq () Check if left operand is equal to right operand.
mw.bcmath.lt () Check if left operand is less than right operand.
mw.bcmath.ge () Check if left operand is greater or equal to right operand.
mw.bcmath.le () Check if left operand is less than or equal to right operand.
mw.bcmath.gt () Check if left operand is equal to right operand.
mw.bcmath.round () Round the value to given precision.


Functions

bcmath:__call ()
Instance is callable. This will format according to given style and precision. Unless overridden style will be set to 'fix'. Available notations are at least 'fix', 'eng', and 'sci'. Unless overridden precision will not be set, and it will use the full precission.

Parameters:

  • ... vararg dispatch on type or table field name

Returns:

string
bcmath:__tostring ()
Instance is stringable. This will only create a minimal representation, suitable for further formatting.

Returns:

string
bcmath:scale ()
Get scale from self. The scale is stored in the closure.

Nicknames:

    bcmath:getScale

Returns:

number
bcmath:value ()
Get value from self. The value is stored in the closure.

Nicknames:

  • bcmath:number
  • bcmath:getNumber
  • bcmath:getValue

Returns:

string
bcmath:payload ()
Get payload from self. The payload is stored in the closure.

Nicknames:

  • bcmath:payloads
  • bcmath:hasPayload
  • bcmath:hasPayloads

Returns:

none, one or several keys
bcmath:getInfinite ()
Get infinite. The value is stored in the closure.

Nicknames:

    bcmath:getInf

Returns:

nil or string
bcmath:isInfinite ()
Is infinite. The value is stored in the closure.

Nicknames:

    bcmath:isInf

Returns:

boolean
bcmath:isFinite ()
Is finite. The value is stored in the closure.

Nicknames:

    bcmath:isFin

Returns:

boolean
bcmath:getZero ()
Get zero. The value is stored in the closure.

Nicknames:

    bcmath:getNull

Returns:

nil or string
bcmath:isZero ()
Is zero. The value is stored in the closure.

Nicknames:

    bcmath:isNull

Returns:

boolean
bcmath:isNaN ()
Is a NaN. The value is stored in the closure.

Nicknames:

    bcmath:isNan

Returns:

boolean
bcmath:exists ()
Has a value. The value is stored in the closure.

Nicknames:

  • bcmath:exist
  • bcmath:hasNumber

Returns:

boolean
bcmath:neg ()
Negates self.

Returns:

self
bcmath:add ()
Add self with addend. This method will store result in self, and then return self to facilitate chaining. See PHP: bcadd for further documentation.

Parameters:

  • addend string, number or table an operand
  • scale nil or number of decimal digits

Returns:

self
bcmath:sub ()
Subtract self with subtrahend. This method will store result in self, and then return self to facilitate chaining. See PHP: bcsub for further documentation.

Parameters:

  • subtrahend string, number or table an operand
  • scale nil or number of decimal digits

Returns:

self
bcmath:mul ()
Multiply self with multiplicator. This method will store result in self, and then return self to facilitate chaining. See PHP: bcmul for further documentation.

Parameters:

  • multiplicator string, number or table an operand
  • scale nil or number of decimal digits

Returns:

self
bcmath:div ()
Divide self with divisor. This method will store result in self, and then return self to facilitate chaining. See PHP: bcdiv for further documentation.

Parameters:

  • divisor string, number or table an operand
  • scale nil or number of decimal digits

Returns:

self
bcmath:mod ()
Modulus self with divisor. This method will store result in self, and then return self to facilitate chaining. See PHP: bcmod for further documentation.

Parameters:

  • divisor string, number or table an operand
  • scale nil or number of decimal digits

Returns:

self
bcmath:pow ()
Power self with exponent. This method will store result in self, and then return self to facilitate chaining. See PHP: bcpow for further documentation.

Parameters:

  • exponent string, number or table an operand
  • scale nil or number of decimal digits

Returns:

self
bcmath:powmod ()
Power-modulus self with exponent and divisor. This method will store result in self, and then return self to facilitate chaining. See PHP: bcpowmod for further documentation.

Parameters:

  • exponent string, number or table an operand
  • divisor string, number or table an operand
  • scale nil or number of decimal digits

Returns:

self
bcmath:sqrt ()
Square root self. This method will store result in self, and then return self to facilitate chaining. See PHP: bcsqrt for further documentation.

Parameters:

  • scale nil or number of decimal digits

Returns:

self
bcmath:comp ()
Compare self with operand. All comparisons involving a NaN will fail silently and return false. See PHP: bccomp for further documentation.

Parameters:

  • operand string, number or table
  • scale nil or number of decimal digits

Returns:

nil or number
bcmath:round ()
Round self to given precision. This returns the rounded value as a new bcmath object, it does not change self.

Parameters:

  • precision nil or number of decimal digits
  • scale nil or number of decimal digits (forwarded to bcmath object)

Returns:

self
mw.bcmath.new ()
Create new instance.

Parameters:

  • scale nil or number of decimal digits
  • scale nil or number of decimal digits

Returns:

bcmath
mw.bcmath.getZero ()
Get the string zero. Returned string is normalized, and nil if no zero is found.

Parameters:

  • value nil or string to be parsed

Returns:

nil or string
mw.bcmath.isZero ()
Is the string zero. Returns true if zero is found.

Parameters:

  • value nil or string to be parsed

Returns:

nil or boolean
mw.bcmath.getInfinity ()
Get the strings infinite part. Returned string is normalized, and nil if no infinity is found.

Parameters:

  • value nil or string to be parsed

Returns:

nil or string
mw.bcmath.isInfinite ()
Is the string infinite. Returned string is normalized.

Parameters:

  • value nil or string to be parsed

Returns:

boolean
mw.bcmath.isFinite ()
Is the string finite. Returned string is normalized.

Parameters:

  • value nil or string to be parsed

Returns:

boolean
mw.bcmath.neg ()
Negates the string representation of the number

Parameters:

Returns:

string
mw.bcmath.add ()
Add the addend to augend. This function is available as a metamethod. See PHP: bcadd for further documentation.

Parameters:

  • augend string, number or table an operand
  • addend string, number or table an operand
  • scale nil or number of decimal digits

Returns:

bcmath
mw.bcmath.sub ()
Subtract the subtrahend from minuend. This function is available as a metamethod. See PHP: bcsub for further documentation.

Parameters:

  • minuend string, number or table an operand
  • subtrahend string, number or table an operand
  • scale nil or number of decimal digits

Returns:

bcmath
mw.bcmath.mul ()
Multiply the multiplicator with multiplier. This function is available as a metamethod. See PHP: bcmul for further documentation.

Parameters:

  • multiplier string, number or table an operand
  • multiplicator string, number or table an operand
  • scale nil or number of decimal digits

Returns:

bcmath
mw.bcmath.div ()
Divide the divisor from dividend. This function is available as a metamethod. See PHP: bcdiv for further documentation.

Parameters:

  • dividend string, number or table an operand
  • divisor string, number or table an operand
  • scale nil or number of decimal digits

Returns:

bcmath
mw.bcmath.mod ()
Modulus the divisor from dividend. This function is available as a metamethod. See PHP: bcmod for further documentation.

Parameters:

  • dividend string, number or table an operand
  • divisor string, number or table an operand
  • scale nil or number of decimal digits

Returns:

bcmath
mw.bcmath.pow ()
Power the base to exponent. This function is available as a metamethod. See PHP: bcpow for further documentation.

Parameters:

  • base string, number or table an operand
  • exponent string, number or table an operand
  • scale nil or number of decimal digits

Returns:

bcmath
mw.bcmath.powmod ()
Power-modulus the base to exponent. This function is not available as a metamethod. See PHP: bcpowmod for further documentation.

Parameters:

  • base string, number or table an operand
  • exponent string, number or table an operand
  • divisor string, number or table an operand
  • scale nil or number of decimal digits

Returns:

bcmath
mw.bcmath.sqrt ()
Square root of the operand. This function is not available as a metamethod. See PHP: bcsqrt for further documentation.

Parameters:

  • an string, number or table operand
  • scale nil or number of decimal digits

Returns:

bcmath
mw.bcmath.comp ()
Compare the left operand with the right operand. This function is not available as a metamethod. All comparisons involving a NaN will fail silently and return false. See PHP: bccomp for further documentation.

Parameters:

  • left string, number or table an operand
  • right string, number or table an operand
  • scale nil or number of decimal digits

Returns:

nil or number
mw.bcmath.eq ()
Check if left operand is equal to right operand. This function is available as a metamethod. See PHP: bccomp for further documentation.

Parameters:

  • left string, number or table an operand
  • right string, number or table an operand
  • scale nil or number of decimal digits

Returns:

boolean
mw.bcmath.lt ()
Check if left operand is less than right operand. This function is available as a metamethod. See PHP: bccomp for further documentation.

Parameters:

  • left string, number or table an operand
  • right string, number or table an operand
  • scale nil or number of decimal digits

Returns:

boolean
mw.bcmath.ge ()
Check if left operand is greater or equal to right operand. This function is not available as a metamethod. See PHP: bccomp for further documentation.

Parameters:

  • left string, number or table an operand
  • right string, number or table an operand
  • scale nil or number of decimal digits

Returns:

boolean
mw.bcmath.le ()
Check if left operand is less than or equal to right operand. This function is available as a metamethod. See PHP: bccomp for further documentation.

Parameters:

  • left string, number or table an operand
  • right string, number or table an operand
  • scale nil or number of decimal digits

Returns:

boolean
mw.bcmath.gt ()
Check if left operand is equal to right operand. This function is not available as a metamethod. See PHP: bccomp for further documentation.

Parameters:

  • left string, number or table an operand
  • right string, number or table an operand
  • scale nil or number of decimal digits

Returns:

boolean
mw.bcmath.round ()
Round the value to given precision.

Parameters:

  • value string, number or table
  • precision nil or number of decimal digits
  • scale nil or number of decimal digits (forwarded to bcmath object)

Returns:

bcmath
generated by LDoc TESTING