Full Library / Math Operator / Math and Trig / MathFunction
Block Name: MathFunction
Code File Location: VisualSim/actor/lib/MathFunction
Block Overview
- Produce an output token on each firing with a value that is equal to the specified math function of the input. The input and output types are DoubleToken. The functions are a subset of those in the java.lang.Math class. They are:
- exp: The exponential function. This is the default function for this actor If the argument is NaN, then the result is NaN.
- log: The natural logarithm function. If the argument is NaN, then the result is NaN.
- modulo: The modulo after division. If the second operand is zero, then the result is NaN.
- sign: If the argument is greater than 0, return 1.0, if it is less than 0, return -1.0, otherwise return 0.0.
- square: The square function If the argument is NaN, then the result is NaN.
- sqrt: The square root function. If the argument is NaN, then the result is NaN.
NOTES: 1. Some functions like exp, log, square, and sqrt act on a single operand only. Other functions like modulo act on two operands. The actor acquires a second input when the function is changed to modulo, and loses the input when the function is changed back. 2. There is an alternative to using the MathFunction.modulo() method If you want to use the IEEE remainder standard, use the Remainder actor.
function
public StringAttribute function
- The function to compute. This is a string-valued attribute that defaults to "exp".
firstOperand
public TypedIOPort firstOperand
- The port for the first operand. The port has type BaseType.DOUBLE.
secondOperand
public TypedIOPort secondOperand
- The port for the second operand, if it is needed. The port has type BaseType.DOUBLE.
output
public TypedIOPort output
- Output port The port has type BaseType.DOUBLE.
Created with the Personal Edition of HelpNDoc: Free CHM Help documentation generator