public function process()
    {
        $operands = $this->getOperands();

        if ($operands->containsNull() === true) {
            return null;
        }

        if ($operands->exclusivelySingle() === false) {
            $msg = "The Divide operator only accepts operands with a single cardinality.";
            throw new OperatorProcessingException($msg, $this, OperatorProcessingException::WRONG_CARDINALITY);
        }

        if ($operands->exclusivelyNumeric() === false) {
            $msg = "The Divide operator only accepts operands with a baseType of integer or float.";
            throw new OperatorProcessingException($msg, $this, OperatorProcessingException::WRONG_BASETYPE);
        }

        $operand1 = $operands[0];
        $operand2 = $operands[1];

        if ($operand2->getValue() == 0) {
            return null;
        }

        $divide = floatval($operand1->getValue() / $operand2->getValue());

        return is_nan($divide) ? null : new QtiFloat($divide);
    }
public function process()
    {
        $operands = $this->getOperands();

        if ($operands->containsNull() === true) {
            return null;
        }

        if ($operands->exclusivelySingle() === false) {
            $msg = "The Divide operator only accepts operands with a single cardinality.";
            throw new OperatorProcessingException($msg, $this, OperatorProcessingException::WRONG_CARDINALITY);
        }

        if ($operands->exclusivelyNumeric() === false) {
            $msg = "The Divide operator only accepts operands with a baseType of integer or float.";
            throw new OperatorProcessingException($msg, $this, OperatorProcessingException::WRONG_BASETYPE);
        }

        $operand1 = $operands[0];
        $operand2 = $operands[1];

        if ($operand2->getValue() == 0) {
            return null;
        }

        $divide = floatval($operand1->getValue() / $operand2->getValue());

        return is_nan($divide) ? null : new QtiFloat($divide);
    }
public function process ( ) { $ operands = $ this -> getOperands ( ) ; if ( $ operands -> containsNull ( ) === true ) { return null ; } if ( $ operands -> exclusivelySingle ( ) === false ) { $ msg = "The Divide operator only accepts operands with a single cardinality." ; throw new OperatorProcessingException ( $ msg , $ this , OperatorProcessingException :: WRONG_CARDINALITY ) ; } if ( $ operands -> exclusivelyNumeric ( ) === false ) { $ msg = "The Divide operator only accepts operands with a baseType of integer or float." ; throw new OperatorProcessingException ( $ msg , $ this , OperatorProcessingException :: WRONG_BASETYPE ) ; } $ operand1 = $ operands [ 0 ] ; $ operand2 = $ operands [ 1 ] ; if ( $ operand2 -> getValue ( ) == 0 ) { return null ; } $ divide = floatval ( $ operand1 -> getValue ( ) / $ operand2 -> getValue ( ) ) ; return is_nan ( $ divide ) ? null : new QtiFloat ( $ divide ) ; }
Process the Divide operator.

@return float|null A float value that corresponds to the first expression divided by the second or NULL if either of the sub-expressions is NULL or the result is outside the value set defined by float.
@throws \qtism\runtime\expressions\operators\OperatorProcessingException
Process the Divide operator .