You are here

exponent.inc in Units of Measurement 7.2

File

plugins/operator/exponent.inc
View source
<?php

/**
 * @file
 * Declaration of exponentiation cTools "operator" plugin.
 */
$plugin = array(
  'title' => t('Exponentiation'),
  'description' => t('Raise base value to power.'),
  'sign' => '^',
  'transparent operand1' => 1,
  'transparent operand2' => 0,
  'precedence' => 3,
  'dimension check' => FALSE,
  'evaluate callback' => 'units_operator_exponent_evaluate',
  'dimension callback' => 'units_operator_exponent_dimension',
  'isolate operand callback' => NULL,
  'sql evaluate fragment' => 'SET result = POW(token1, token2);',
  'operator class' => 'UnitsMathematicalOperatorLinear',
);
function units_operator_exponent_evaluate($operand1, $operand2) {
  return pow($operand1, $operand2);
}
function units_operator_exponent_dimension($dimension1, $dimension2, $operator1, $operator2) {
  return units_dimension_multiply($dimension1, $operator2);
}