MathInstruction

Enum MathInstruction 

Source
pub enum MathInstruction {
Show 16 variants 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, }, F64Pow { base: f64, exponent: f64, }, U128Multiply { multiplicand: u128, multiplier: u128, }, U128Divide { dividend: u128, divisor: u128, }, F64Multiply { multiplicand: f64, multiplier: f64, }, F64Divide { dividend: f64, divisor: f64, }, Noop,
}
Expand description

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

Variants§

§

PreciseSquareRoot

Calculate the square root of the given u64 with decimals

No accounts required for this instruction

Fields

§radicand: u64

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

§

SquareRootU64

Calculate the integer square root of the given u64

No accounts required for this instruction

Fields

§radicand: u64

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

§

SquareRootU128

Calculate the integer square root of the given u128

No accounts required for this instruction

Fields

§radicand: u128

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

§

U64Multiply

Multiply two u64 values

No accounts required for this instruction

Fields

§multiplicand: u64

The multiplicand

§multiplier: u64

The multipier

§

U64Divide

Divide two u64 values

No accounts required for this instruction

Fields

§dividend: u64

The dividend

§divisor: u64

The divisor

§

F32Multiply

Multiply two float values

No accounts required for this instruction

Fields

§multiplicand: f32

The multiplicand

§multiplier: f32

The multipier

§

F32Divide

Divide two float values

No accounts required for this instruction

Fields

§dividend: f32

The dividend

§divisor: f32

The divisor

§

F32Exponentiate

Exponentiate a float base by a power

No accounts required for this instruction

Fields

§base: f32

The base

§exponent: f32

The exponent

§

F32NaturalLog

Natural Log of a float

No accounts required for this instruction

Fields

§argument: f32

The argument

§

F32NormalCDF

The Normal CDF of a float

No accounts required for this instruction

Fields

§argument: f32

The argument

§

F64Pow

Pow two float values

No accounts required for this instruction

Fields

§base: f64

The base

§exponent: f64

The exponent

§

U128Multiply

Multiply two u128 values

No accounts required for this instruction

Fields

§multiplicand: u128

The multiplicand

§multiplier: u128

The multipier

§

U128Divide

Divide two u128 values

No accounts required for this instruction

Fields

§dividend: u128

The dividend

§divisor: u128

The divisor

§

F64Multiply

Multiply two f64 values

No accounts required for this instruction

Fields

§multiplicand: f64

The multiplicand

§multiplier: f64

The multipier

§

F64Divide

Divide two f64 values

No accounts required for this instruction

Fields

§dividend: f64

The dividend

§divisor: f64

The divisor

§

Noop

Don’t do anything for comparison

No accounts required for this instruction

Trait Implementations§

Source§

impl BorshDeserialize for MathInstruction

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 MathInstruction

Source§

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

Source§

impl Clone for MathInstruction

Source§

fn clone(&self) -> MathInstruction

Returns a duplicate of the value. Read more
1.0.0§

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 MathInstruction

Source§

fn deserialize_variant<__R: Read>( reader: &mut __R, variant_tag: 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

Tests for self and other values to be equal, and is used by ==.
1.0.0§

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

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> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
§

impl<T> CloneToUninit for T
where T: Clone,

§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
§

fn to_owned(&self) -> T

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

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

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

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

§

type Error = Infallible

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

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

Performs the conversion.
§

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

§

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

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

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

Performs the conversion.
Source§

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

Source§

fn vzip(self) -> V