406 if ( count( $stack ) < 1 ) {
407 throw new ExprError(
'missing_operand', $this->names[$op] );
409 $arg = array_pop( $stack );
413 if ( count( $stack ) < 1 ) {
414 throw new ExprError(
'missing_operand', $this->names[$op] );
418 if ( count( $stack ) < 2 ) {
419 throw new ExprError(
'missing_operand', $this->names[$op] );
421 $right = array_pop( $stack );
422 $left = array_pop( $stack );
423 $stack[] = $left * $right;
426 if ( count( $stack ) < 2 ) {
427 throw new ExprError(
'missing_operand', $this->names[$op] );
429 $right = array_pop( $stack );
430 $left = array_pop( $stack );
432 throw new ExprError(
'division_by_zero', $this->names[$op] );
434 $stack[] = $left / $right;
437 if ( count( $stack ) < 2 ) {
438 throw new ExprError(
'missing_operand', $this->names[$op] );
440 $right = (int)array_pop( $stack );
441 $left = (int)array_pop( $stack );
443 throw new ExprError(
'division_by_zero', $this->names[$op] );
445 $stack[] = $left % $right;
448 if ( count( $stack ) < 2 ) {
449 throw new ExprError(
'missing_operand', $this->names[$op] );
451 $right = (double)array_pop( $stack );
452 $left = (double)array_pop( $stack );
454 throw new ExprError(
'division_by_zero', $this->names[$op] );
456 $stack[] = fmod( $left, $right );
459 if ( count( $stack ) < 2 ) {
460 throw new ExprError(
'missing_operand', $this->names[$op] );
462 $right = array_pop( $stack );
463 $left = array_pop( $stack );
464 $stack[] = $left + $right;
467 if ( count( $stack ) < 2 ) {
468 throw new ExprError(
'missing_operand', $this->names[$op] );
470 $right = array_pop( $stack );
471 $left = array_pop( $stack );
472 $stack[] = $left - $right;
475 if ( count( $stack ) < 2 ) {
476 throw new ExprError(
'missing_operand', $this->names[$op] );
478 $right = array_pop( $stack );
479 $left = array_pop( $stack );
480 $stack[] = ( $left && $right ) ? 1 : 0;
483 if ( count( $stack ) < 2 ) {
484 throw new ExprError(
'missing_operand', $this->names[$op] );
486 $right = array_pop( $stack );
487 $left = array_pop( $stack );
488 $stack[] = ( $left || $right ) ? 1 : 0;
491 if ( count( $stack ) < 2 ) {
492 throw new ExprError(
'missing_operand', $this->names[$op] );
494 $right = array_pop( $stack );
495 $left = array_pop( $stack );
496 $stack[] = ( $left == $right ) ? 1 : 0;
499 if ( count( $stack ) < 1 ) {
500 throw new ExprError(
'missing_operand', $this->names[$op] );
502 $arg = array_pop( $stack );
503 $stack[] = ( !$arg ) ? 1 : 0;
506 if ( count( $stack ) < 2 ) {
507 throw new ExprError(
'missing_operand', $this->names[$op] );
509 $digits = (int)array_pop( $stack );
510 $value = array_pop( $stack );
511 $stack[] = round(
$value, $digits );
514 if ( count( $stack ) < 2 ) {
515 throw new ExprError(
'missing_operand', $this->names[$op] );
517 $right = array_pop( $stack );
518 $left = array_pop( $stack );
519 $stack[] = ( $left < $right ) ? 1 : 0;
522 if ( count( $stack ) < 2 ) {
523 throw new ExprError(
'missing_operand', $this->names[$op] );
525 $right = array_pop( $stack );
526 $left = array_pop( $stack );
527 $stack[] = ( $left > $right ) ? 1 : 0;
530 if ( count( $stack ) < 2 ) {
531 throw new ExprError(
'missing_operand', $this->names[$op] );
533 $right = array_pop( $stack );
534 $left = array_pop( $stack );
535 $stack[] = ( $left <= $right ) ? 1 : 0;
538 if ( count( $stack ) < 2 ) {
539 throw new ExprError(
'missing_operand', $this->names[$op] );
541 $right = array_pop( $stack );
542 $left = array_pop( $stack );
543 $stack[] = ( $left >= $right ) ? 1 : 0;
546 if ( count( $stack ) < 2 ) {
547 throw new ExprError(
'missing_operand', $this->names[$op] );
549 $right = array_pop( $stack );
550 $left = array_pop( $stack );
551 $stack[] = ( $left != $right ) ? 1 : 0;
554 if ( count( $stack ) < 2 ) {
555 throw new ExprError(
'missing_operand', $this->names[$op] );
557 $right = array_pop( $stack );
558 $left = array_pop( $stack );
559 $stack[] = $left * pow( 10, $right );
562 if ( count( $stack ) < 1 ) {
563 throw new ExprError(
'missing_operand', $this->names[$op] );
565 $arg = array_pop( $stack );
566 $stack[] = sin( $arg );
569 if ( count( $stack ) < 1 ) {
570 throw new ExprError(
'missing_operand', $this->names[$op] );
572 $arg = array_pop( $stack );
573 $stack[] = cos( $arg );
576 if ( count( $stack ) < 1 ) {
577 throw new ExprError(
'missing_operand', $this->names[$op] );
579 $arg = array_pop( $stack );
580 $stack[] = tan( $arg );
583 if ( count( $stack ) < 1 ) {
584 throw new ExprError(
'missing_operand', $this->names[$op] );
586 $arg = array_pop( $stack );
587 if ( $arg < -1 || $arg > 1 ) {
588 throw new ExprError(
'invalid_argument', $this->names[$op] );
590 $stack[] = asin( $arg );
593 if ( count( $stack ) < 1 ) {
594 throw new ExprError(
'missing_operand', $this->names[$op] );
596 $arg = array_pop( $stack );
597 if ( $arg < -1 || $arg > 1 ) {
598 throw new ExprError(
'invalid_argument', $this->names[$op] );
600 $stack[] = acos( $arg );
603 if ( count( $stack ) < 1 ) {
604 throw new ExprError(
'missing_operand', $this->names[$op] );
606 $arg = array_pop( $stack );
607 $stack[] = atan( $arg );
610 if ( count( $stack ) < 1 ) {
611 throw new ExprError(
'missing_operand', $this->names[$op] );
613 $arg = array_pop( $stack );
614 $stack[] = exp( $arg );
617 if ( count( $stack ) < 1 ) {
618 throw new ExprError(
'missing_operand', $this->names[$op] );
620 $arg = array_pop( $stack );
622 throw new ExprError(
'invalid_argument_ln', $this->names[$op] );
624 $stack[] = log( $arg );
627 if ( count( $stack ) < 1 ) {
628 throw new ExprError(
'missing_operand', $this->names[$op] );
630 $arg = array_pop( $stack );
631 $stack[] = abs( $arg );
634 if ( count( $stack ) < 1 ) {
635 throw new ExprError(
'missing_operand', $this->names[$op] );
637 $arg = array_pop( $stack );
638 $stack[] = floor( $arg );
641 if ( count( $stack ) < 1 ) {
642 throw new ExprError(
'missing_operand', $this->names[$op] );
644 $arg = array_pop( $stack );
645 $stack[] = (int)$arg;
648 if ( count( $stack ) < 1 ) {
649 throw new ExprError(
'missing_operand', $this->names[$op] );
651 $arg = array_pop( $stack );
652 $stack[] = ceil( $arg );
655 if ( count( $stack ) < 2 ) {
656 throw new ExprError(
'missing_operand', $this->names[$op] );
658 $right = array_pop( $stack );
659 $left = array_pop( $stack );
660 $result = pow( $left, $right );
661 if ( $result ===
false ) {
662 throw new ExprError(
'division_by_zero', $this->names[$op] );
667 if ( count( $stack ) < 1 ) {
668 throw new ExprError(
'missing_operand', $this->names[$op] );
670 $arg = array_pop( $stack );
671 $result = sqrt( $arg );
672 if ( is_nan( $result ) ) {
673 throw new ExprError(
'not_a_number', $this->names[$op] );