MathFunction

abstract class MathFunction: FunctionWrapper<ExecutionContext>

Base class to implement arithmetic functions

Constructors

<init>

constructor(signature: Signature)

Parameters

Name Description
signature: Signature

<init>

constructor(name: String, arity: Int, vararg: Boolean)

Parameters

Name Description
name: String
arity: Int
vararg: Boolean

Methods

throwIntOverflowError

protected fun throwIntOverflowError(context: ExecutionContext): Nothing

Utility function to throw int overflow math error

Parameters

Name Description
context: ExecutionContext

ReturnValue

Name Description
Nothing

throwFloatOverflowError

protected fun throwFloatOverflowError(context: ExecutionContext): Nothing

Utility function to throw float overflow math error

Parameters

Name Description
context: ExecutionContext

ReturnValue

Name Description
Nothing

throwUnderflowError

protected fun throwUnderflowError(context: ExecutionContext): Nothing

Utility function to throw underflow math error

Parameters

Name Description
context: ExecutionContext

ReturnValue

Name Description
Nothing

throwZeroDivisorError

protected fun throwZeroDivisorError(context: ExecutionContext): Nothing

Utility function to throw zero division math error

Parameters

Name Description
context: ExecutionContext

ReturnValue

Name Description
Nothing

throwUndefinedError

protected fun throwUndefinedError(context: ExecutionContext): Nothing

Utility function to throw undefined math error

Parameters

Name Description
context: ExecutionContext

ReturnValue

Name Description
Nothing

throwTypeErrorBecauseOnlyIntegersAccepted

protected fun throwTypeErrorBecauseOnlyIntegersAccepted(opName: String, actualValue: Term, context: ExecutionContext): Nothing

Utility function to throw a TypeError for operators requiring only integers as parameters

Parameters

Name Description
opName: String
actualValue: Term
context: ExecutionContext

ReturnValue

Name Description
Nothing