pub enum MathInstruction {
    PreciseSquareRoot {
        radicand: u64,
    },
    SquareRootU64 {
        radicand: u64,
    },
    SquareRootU128 {
        radicand: u128,
    },
    U64Multiply {
        multiplicand: u64,
        multiplier: u64,
    },
    U64Divide {
        dividend: u64,
        divisor: u64,
    },
    F32Multiply {
        multiplicand: f32,
        multiplier: f32,
    },
    F32Divide {
        dividend: f32,
        divisor: f32,
    },
    F32Exponentiate {
        base: f32,
        exponent: f32,
    },
    F32NaturalLog {
        argument: f32,
    },
    F32NormalCDF {
        argument: f32,
    },
    Noop,
}
Expand description

Instructions supported by the math program, used for testing instruction counts

Variants§

§

PreciseSquareRoot

Fields

§radicand: u64

Number underneath the square root sign, whose square root will be calculated

Calculate the square root of the given u64 with decimals

No accounts required for this instruction

§

SquareRootU64

Fields

§radicand: u64

Number underneath the square root sign, whose square root will be calculated

Calculate the integer square root of the given u64

No accounts required for this instruction

§

SquareRootU128

Fields

§radicand: u128

Number underneath the square root sign, whose square root will be calculated

Calculate the integer square root of the given u128

No accounts required for this instruction

§

U64Multiply

Fields

§multiplicand: u64

The multiplicand

§multiplier: u64

The multipier

Multiply two u64 values

No accounts required for this instruction

§

U64Divide

Fields

§dividend: u64

The dividend

§divisor: u64

The divisor

Divide two u64 values

No accounts required for this instruction

§

F32Multiply

Fields

§multiplicand: f32

The multiplicand

§multiplier: f32

The multipier

Multiply two float values

No accounts required for this instruction

§

F32Divide

Fields

§dividend: f32

The dividend

§divisor: f32

The divisor

Divide two float values

No accounts required for this instruction

§

F32Exponentiate

Fields

§base: f32

The base

§exponent: f32

The exponent

Exponentiate a float base by a power

No accounts required for this instruction

§

F32NaturalLog

Fields

§argument: f32

The argument

Natural Log of a float

No accounts required for this instruction

§

F32NormalCDF

Fields

§argument: f32

The argument

The Normal CDF of a float

No accounts required for this instruction

§

Noop

Don’t do anything for comparison

No accounts required for this instruction

Trait Implementations§

source§

impl BorshDeserialize for MathInstructionwhere u64: BorshDeserialize, u128: BorshDeserialize, f32: BorshDeserialize,

source§

fn deserialize_reader<R: Read>(reader: &mut R) -> Result<Self, Error>

source§

fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>

Deserializes this instance from a given slice of bytes. Updates the buffer to point at the remaining bytes.
source§

fn try_from_slice(v: &[u8]) -> Result<Self, Error>

Deserialize this instance from a slice of bytes.
source§

fn try_from_reader<R>(reader: &mut R) -> Result<Self, Error>where R: Read,

source§

impl BorshSerialize for MathInstructionwhere u64: BorshSerialize, u128: BorshSerialize, f32: BorshSerialize,

source§

fn serialize<W: Write>(&self, writer: &mut W) -> Result<(), Error>

source§

fn try_to_vec(&self) -> Result<Vec<u8>, Error>

Serialize this instance into a vector of bytes.
source§

impl Clone for MathInstruction

source§

fn clone(&self) -> MathInstruction

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for MathInstruction

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl EnumExt for MathInstructionwhere u64: BorshDeserialize, u128: BorshDeserialize, f32: BorshDeserialize,

source§

fn deserialize_variant<R: Read>( reader: &mut R, variant_idx: u8 ) -> Result<Self, Error>

Deserialises given variant of an enum from the reader. Read more
source§

impl PartialEq for MathInstruction

source§

fn eq(&self, other: &MathInstruction) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl StructuralPartialEq for MathInstruction

Auto Trait Implementations§

Blanket Implementations§

§

impl<T> AbiExample for T

§

default fn example() -> T

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V