sopr

Functions

int main(int argc, char *argv[])

sopr [ option ] [ infile ]

  • -a double

    • addition

  • -s double

    • subtraction

  • -m double

    • multiplication

  • -d double

    • division

  • -r double

    • modulo

  • -p double

    • power

  • -l double

    • lower bounding

  • -u double

    • upper bounding

  • -ABS

    • absolute

  • -INV

    • inverse

  • -SQR

    • square

  • -SQRT

    • square root

  • -LN

    • natural logarithm

  • -LOG2

    • base 2 logarithm

  • -LOG10

    • base 10 logarithm

  • -LOGX double

    • base \(X\) logarithm

  • -EXP

    • exponential

  • -POW2

    • power of 2

  • -POW10

    • power of 10

  • -POWX double

    • power of \(X\)

  • -FLOOR

    • flooring

  • -CEIL

    • ceiling

  • -ROUND

    • roudning

  • -ROUNDUP

    • roudning up

  • -ROUNDDOWN

    • roudning down

  • -UNIT

    • unit step

  • -RAMP

    • rectifier

  • -SIGN

    • sign

  • -SIN

    • sine

  • -COS

    • cosine

  • -TAN

    • tangent

  • -ATAN

    • arctangent

  • -TANH

    • hyperbolic tangent

  • -ATANH

    • hyperbolic arctangent

  • -magic double

    • remove magic number

  • -MAGIC double

    • replace magic number

  • infile str

    • double-type data sequence

  • stdout

    • double-type data sequence after operations

# 0, 1, 2, 3
ramp -l 4 | sopr -m 2 -a 1 | x2x +da
# 1, 3, 5, 7
Parameters:
  • argc[in] Number of arguments.

  • argv[in] Argument vector.

Returns:

0 on success, 1 on failure.

See also

vopr

class ScalarOperation

Perform a sequence of scalar operations.

Public Functions

bool AddAdditionOperation(double addend)

\(x + a\)

Parameters:

addend[in] Addend, \(a\).

Returns:

True on success, false on failure.

bool AddSubtractionOperation(double subtrahend)

\(x - s\)

Parameters:

subtrahend[in] Subtrahend, \(s\).

Returns:

True on success, false on failure.

bool AddMultiplicationOperation(double multiplier)

\(x * m\)

Parameters:

multiplier[in] Multiplier, \(m\).

Returns:

True on success, false on failure.

bool AddDivisionOperation(double divisor)

\(x / d\)

Parameters:

divisor[in] Divisor, \(d\).

Returns:

True on success, false on failure.

bool AddModuloOperation(double divisor)

\(x \bmod n\)

Parameters:

divisor[in] Divisor, \(n\).

Returns:

True on success, false on failure.

bool AddPowerOperation(double exponent)

\(x^n\)

Parameters:

exponent[in] Exponent, \(n\).

Returns:

True on success, false on failure.

bool AddLowerBoundingOperation(double lower_bound)

\(\max(x, l)\)

Parameters:

lower_bound[in] Lower bound, \(l\).

Returns:

True on success, false on failure.

bool AddUpperBoundingOperation(double upper_bound)

\(\min(x, u)\)

Parameters:

upper_bound[in] Upper bound, \(u\).

Returns:

True on success, false on failure.

bool AddAbsoluteOperation()

\(|x|\)

Returns:

True on success, false on failure.

bool AddReciprocalOperation()

\(1/x\)

Returns:

True on success, false on failure.

bool AddSquareOperation()

\(x^2\)

Returns:

True on success, false on failure.

bool AddSquareRootOperation()

\(\sqrt{x}\)

Returns:

True on success, false on failure.

bool AddNaturalLogarithmOperation()

\(\ln{x}\)

Returns:

True on success, false on failure.

bool AddLogarithmOperation(double base)

\(\log_b{x}\)

Parameters:

base[in] Base of logarithm function, \(b\).

Returns:

True on success, false on failure.

bool AddNaturalExponentialOperation()

\(\exp{x}\)

Returns:

True on success, false on failure.

bool AddExponentialOperation(double base)

\(b^x\)

Parameters:

base[in] Base of exponential function, \(b\).

Returns:

True on success, false on failure.

bool AddFlooringOperation()

\(\lfloor x \rfloor\)

Returns:

True on success, false on failure.

bool AddCeilingOperation()

\(\lceil x \rceil\)

Returns:

True on success, false on failure.

bool AddRoundingOperation()

\(\mathrm{nint}(x)\)

Returns:

True on success, false on failure.

bool AddRoundingUpOperation()

\(\mathrm{sgn}(x) \lceil |x| \rceil\)

Returns:

True on success, false on failure.

bool AddRoundingDownOperation()

\(\mathrm{sgn}(x) \lfloor |x| \rfloor\)

Returns:

True on success, false on failure.

bool AddUnitStepOperation()

\(u(x)\)

Returns:

True on success, false on failure.

bool AddSignOperation()

\(\mathrm{sgn}(x)\)

Returns:

True on success, false on failure.

bool AddSineOperation()

\(\sin x\)

Returns:

True on success, false on failure.

bool AddCosineOperation()

\(\cos x\)

Returns:

True on success, false on failure.

bool AddTangentOperation()

\(\tan x\)

Returns:

True on success, false on failure.

bool AddArctangentOperation()

\(\tan^{-1} x\)

Returns:

True on success, false on failure.

bool AddHyperbolicTangentOperation()

\(\tanh x\)

Returns:

True on success, false on failure.

bool AddHyperbolicArctangentOperation()

\(\tanh^{-1} x\)

Returns:

True on success, false on failure.

bool AddMagicNumberRemover(double magic_number)

Remove magic number.

Parameters:

magic_number[in] A magic number.

Returns:

True on success, false on failure.

bool AddMagicNumberReplacer(double replacement_number)

Replace magic number.

Parameters:

replacement_number[in] A replacement for magic number.

Returns:

True on success, false on failure.

bool Run(double *number, bool *is_magic_number) const
Parameters:
  • number[inout] Input/output number.

  • is_magic_number[out] True if output is magic number.

Returns:

True on success, false on failure.

class ModuleInterface

Interface of scalar operation.

Public Functions

virtual bool Run(double *number, bool *is_magic_number) const = 0
Parameters:
  • number[inout] Input/output number.

  • is_magic_number[inout] True if output is magic number.