NumTrait
+ Inheritance diagram for NumTrait:

Description

Numeric expression manipulation.

This trait does not include NumCastFloatTrait, because the expression is either already a float or an integer.

Public Methods

Num abs ()
 ABS($this) More...
 
Num acos ()
 ACOS($this) More...
 
Num add ($arg,... $args)
 ($this + $arg + ... More...
 
Num asin ()
 ASIN($this) More...
 
Num atan ()
 ATAN($this) More...
 
Num bAnd ($value)
 Bitwise AND More...
 
Num bNot ($value)
 Bitwise NOT More...
 
Num bOr ($value)
 Bitwise OR More...
 
Num bSL (int $bits=1)
 Bitwise shift left. More...
 
Num bSR (int $bits=1)
 Bitwise shift right. More...
 
Num ceil ()
 CEIL($this) More...
 
Num cos ()
 COS($this) More...
 
Num degrees ()
 Radians to degrees. More...
 
Num div ($arg,... $args)
 ($this / $arg / ...) More...
 
Num exp ()
 Euler's constant raised to the power of the expression. More...
 
Num floor ()
 FLOOR($this) More...
 
Predicate isEven ()
 ($this % 2) = 0 More...
 
Predicate isNegative ()
 $this < 0 More...
 
Predicate isOdd ()
 ($this % 2) <> 0 More...
 
Predicate isPositive ()
 $this > 0 More...
 
Predicate isZero ()
 $this = 0 More...
 
Num ln ()
 LN($this) More...
 
Num log (float $base)
 LOG($base,$this) More...
 
Num log10 ()
 LOG10($this) More...
 
Num log2 ()
 LOG2($this) More...
 
Num mod (float $divisor)
 ($this % $divisor) More...
 
Num mul ($arg,... $args)
 ($this * $arg * ...) More...
 
Num pow (float $exponent)
 POW($this,$exponent) More...
 
Num radians ()
 Degrees to radians. More...
 
Num root (int $radix)
 POW($this,1/$radix) More...
 
Num round (int $decimals=0)
 ROUND($this,$decimals) More...
 
Num sign ()
 SIGN($this) More...
 
Num sin ()
 SIN($this) More...
 
Num sqrt ()
 SQRT($this) More...
 
Num sub ($arg,... $args)
 ($this - $arg - ...) More...
 
Num tan ()
 TAN($this) More...
 
- Public Methods inherited from ValueTrait
Value coalesce (array $values)
 COALESCE($this, ...$values) More...
 
- Public Methods inherited from AggregateTrait
Num avg ()
 AVG($this) More...
 
Num avgDistinct ()
 AVG(DISTINCT $this) More...
 
Num count ()
 COUNT($this) More...
 
Num countDistinct ()
 COUNT(DISTINCT $this) More...
 
Str groupConcat (string $delimiter=',')
 GROUP_CONCAT($this) using a delimiter. More...
 
Num max ()
 MAX($this) More...
 
Num min ()
 MIN($this) More...
 
Num sum ()
 SUM($this) More...
 
Num sumDistinct ()
 SUM(DISTINCT $this) More...
 
- Public Methods inherited from ComparisonTrait
Predicate is ($arg)
 Null-safe type-strict equality. More...
 
Predicate isBetween ($min, $max)
 $this BETWEEN $min AND $max (inclusive) More...
 
Predicate isEqual ($arg)
 See Predicate::match(). More...
 
Predicate isFalse ()
 $this IS FALSE More...
 
Predicate isGt ($arg)
 $this > $arg, or driver-appropriate $this > ALL (SELECT ...) More...
 
Predicate isGtAny (Select $select)
 Driver-appropriate $this > ANY (SELECT ...) More...
 
Predicate isGte ($arg)
 $this >= $arg, or driver-appropriate $this >= ALL (SELECT ...) More...
 
Predicate isGteAny (Select $select)
 Driver-appropriate $this >= ANY (SELECT ...) More...
 
Predicate isLike (string $pattern)
 $this LIKE $pattern More...
 
Predicate isLt ($arg)
 $this < $arg, or driver-appropriate $this < ALL (SELECT ...) More...
 
Predicate isLtAny (Select $select)
 Driver-appropriate $this < ANY (SELECT ...) More...
 
Predicate isLte ($arg)
 $this <= $arg, or driver-appropriate $this <= ALL (SELECT ...) More...
 
Predicate isLteAny (Select $select)
 Driver-appropriate $this <= ANY (SELECT ...) More...
 
Predicate isNot ($arg)
 Null-safe type-strict inequality. More...
 
Predicate isNotBetween ($min, $max)
 $this NOT BETWEEN $min AND $max (inclusive) More...
 
Predicate isNotEqual ($arg)
 $this <> $arg or $this NOT IN ($arg) More...
 
Predicate isNotLike (string $pattern)
 $this NOT LIKE $pattern More...
 
Predicate isNotNull ()
 $this IS NOT NULL More...
 
Predicate isNotRegExp (string $pattern)
 $this NOT REGEXP $pattern More...
 
Predicate isNull ()
 $this IS NULL More...
 
Predicate isRegExp (string $pattern)
 $this REGEXP $pattern More...
 
Branch switch (array $values=[])
 CASE $this ... More...
 
- Public Methods inherited from BaseConversionTrait
Str toBase (int $from, int $to)
 Convert between arbitrary bases. More...
 
Str toBase16 (int $from=10)
 Convert from an arbitrary base to base 16. More...
 
Str toBase2 (int $from=10)
 Convert from an arbitrary base to base 2. More...
 
Str toBase8 (int $from=10)
 Convert from an arbitrary base to base 8. More...
 
- Public Methods inherited from NumCastIntTrait
Num toInt ()
 Casts the expression as a signed integer. More...
 

Methods

◆ abs()

Num abs ( )

ABS($this)

Returns
Num

◆ acos()

Num acos ( )

ACOS($this)

Returns
Num

◆ add()

Num add (   $arg,
  $args 
)

($this + $arg + ...

)

Parameters
number | ValueInterface$arg
number|ValueInterface...$args
Returns
Num

◆ asin()

Num asin ( )

ASIN($this)

Returns
Num

◆ atan()

Num atan ( )

ATAN($this)

Returns
Num

◆ bAnd()

Num bAnd (   $value)

Bitwise AND

($this & $value)

Parameters
int | ValueInterface$value
Returns
Num

◆ bNot()

Num bNot (   $value)

Bitwise NOT

($this ~ $value)

Parameters
int | ValueInterface$value
Returns
Num

◆ bOr()

Num bOr (   $value)

Bitwise OR

($this | $value)

Parameters
int | ValueInterface$value
Returns
Num

◆ bSL()

Num bSL ( int  $bits = 1)

Bitwise shift left.

($this << $bits)

Parameters
int$bits
Returns
Num

◆ bSR()

Num bSR ( int  $bits = 1)

Bitwise shift right.

($this >> $bits)

Parameters
int$bits
Returns
Num

◆ ceil()

Num ceil ( )

CEIL($this)

Returns
Num

◆ cos()

Num cos ( )

COS($this)

Returns
Num

◆ degrees()

Num degrees ( )

Radians to degrees.

DEGREES($this)

Returns
Num

◆ div()

Num div (   $arg,
  $args 
)

($this / $arg / ...)

Parameters
number | ValueInterface$arg
number|ValueInterface...$args
Returns
Num

◆ exp()

Num exp ( )

Euler's constant raised to the power of the expression.

EXP($this)

Returns
Num

◆ floor()

Num floor ( )

FLOOR($this)

Returns
Num

◆ isEven()

Predicate isEven ( )

($this % 2) = 0

Returns
Predicate

◆ isNegative()

Predicate isNegative ( )

$this < 0

Returns
Predicate

◆ isOdd()

Predicate isOdd ( )

($this % 2) <> 0

Returns
Predicate

◆ isPositive()

Predicate isPositive ( )

$this > 0

Returns
Predicate

◆ isZero()

Predicate isZero ( )

$this = 0

Returns
Predicate

◆ ln()

Num ln ( )

LN($this)

Returns
Num

◆ log()

Num log ( float  $base)

LOG($base,$this)

Note: This is the cross-DBMS signature. PHP's built-in function has the reverse.

Parameters
float$base
Returns
Num

◆ log10()

Num log10 ( )

LOG10($this)

Returns
Num

◆ log2()

Num log2 ( )

LOG2($this)

Returns
Num

◆ mod()

Num mod ( float  $divisor)

($this % $divisor)

Parameters
float$divisor
Returns
Num

◆ mul()

Num mul (   $arg,
  $args 
)

($this * $arg * ...)

Parameters
number | ValueInterface$arg
number|ValueInterface...$args
Returns
Num

◆ pow()

Num pow ( float  $exponent)

POW($this,$exponent)

Parameters
float$exponent
Returns
Num

◆ radians()

Num radians ( )

Degrees to radians.

RADIANS($this)

Returns
Num

◆ root()

Num root ( int  $radix)

POW($this,1/$radix)

Parameters
int$radixNon-zero.
Returns
Num

◆ round()

Num round ( int  $decimals = 0)

ROUND($this,$decimals)

Parameters
int$decimals
Returns
Num

◆ sign()

Num sign ( )

SIGN($this)

Returns
Num -1, 0, 1

◆ sin()

Num sin ( )

SIN($this)

Returns
Num

◆ sqrt()

Num sqrt ( )

SQRT($this)

Returns
Num

◆ sub()

Num sub (   $arg,
  $args 
)

($this - $arg - ...)

Parameters
number | ValueInterface$arg
number|ValueInterface...$args
Returns
Num

◆ tan()

Num tan ( )

TAN($this)

Returns
Num