PHP Class Cassandra\Decimal

The actual value of a decimal is $value * pow(10, $scale * -1)
Inheritance: implements cassandra\Value, implements cassandra\Numeric
Show file Open project: datastax/php-driver

Public Methods

Method Description
__construct ( string $value ) Creates a decimal from a given decimal string:
__toString ( ) : string String representation of this decimal.
abs ( ) : cassandra\Numeric
add ( cassandra\Numeric $addend ) : cassandra\Numeric
div ( cassandra\Numeric $divisor ) : cassandra\Numeric
mod ( cassandra\Numeric $divisor ) : cassandra\Numeric
mul ( cassandra\Numeric $multiplier ) : cassandra\Numeric
neg ( ) : cassandra\Numeric
scale ( ) : integer Scale of this decimal as int.
sqrt ( ) : cassandra\Numeric
sub ( cassandra\Numeric $subtrahend ) : cassandra\Numeric
toDouble ( ) : float
toInt ( ) : integer
type ( ) : cassandra\Type The type of this decimal.
value ( ) : string Numeric value of this decimal as string.

Method Details

__construct() public method

~~~{.php} assertEquals(21, $decimal->scale()); $this->assertEquals("1313123123234234234234234234123", $decimal->value()); ~~~
public __construct ( string $value )
$value string Any decimal string

__toString() public method

String representation of this decimal.
public __toString ( ) : string
return string Decimal value

abs() public method

public abs ( ) : cassandra\Numeric
return cassandra\Numeric absolute value

add() public method

public add ( cassandra\Numeric $addend ) : cassandra\Numeric
$addend cassandra\Numeric a number to add to this one
return cassandra\Numeric sum

div() public method

public div ( cassandra\Numeric $divisor ) : cassandra\Numeric
$divisor cassandra\Numeric a number to divide this one by
return cassandra\Numeric quotient

mod() public method

public mod ( cassandra\Numeric $divisor ) : cassandra\Numeric
$divisor cassandra\Numeric a number to divide this one by
return cassandra\Numeric remainder

mul() public method

public mul ( cassandra\Numeric $multiplier ) : cassandra\Numeric
$multiplier cassandra\Numeric a number to multiply this one by
return cassandra\Numeric product

neg() public method

public neg ( ) : cassandra\Numeric
return cassandra\Numeric negative value

scale() public method

Scale of this decimal as int.
public scale ( ) : integer
return integer Scale

sqrt() public method

public sqrt ( ) : cassandra\Numeric
return cassandra\Numeric square root

sub() public method

public sub ( cassandra\Numeric $subtrahend ) : cassandra\Numeric
$subtrahend cassandra\Numeric a number to subtract from this one
return cassandra\Numeric difference

toDouble() public method

public toDouble ( ) : float
return float this number as float

toInt() public method

public toInt ( ) : integer
return integer this number as int

type() public method

The type of this decimal.
public type ( ) : cassandra\Type
return cassandra\Type

value() public method

Numeric value of this decimal as string.
public value ( ) : string
return string Numeric value