pub struct SymTable { /* private fields */ }Expand description
Symbol table containing constants and functions.
Implementations§
Source§impl SymTable
impl SymTable
Sourcepub fn stdlib() -> Self
pub fn stdlib() -> Self
Create a symbol table with built-in constants and functions.
§Constants
pi- π (3.14159…)e- Euler’s number (2.71828…)tau- 2π (6.28318…)ln2- Natural logarithm of 2ln10- Natural logarithm of 10sqrt2- Square root of 2
§Fixed arity functions
sin(x)- Sinecos(x)- Cosinetan(x)- Tangentasin(x)- Arcsineacos(x)- Arccosineatan(x)- Arctangentatan2(y, x)- Two-argument arctangentsinh(x)- Hyperbolic sinecosh(x)- Hyperbolic cosinetanh(x)- Hyperbolic tangentsqrt(x)- Square rootcbrt(x)- Cube rootpow(x, y)- x raised to power ylog(x)- Natural logarithmlog2(x)- Base-2 logarithmlog10(x)- Base-10 logarithmexp(x)- e raised to power xexp2(x)- 2 raised to power xabs(x)- Absolute valuesign(x)- Sign function (-1, 0, or 1)floor(x)- Floor functionceil(x)- Ceiling functionround(x)- Round to nearest integertrunc(x)- Truncate to integerfract(x)- Fractional partmod(x, y)- Remainder of x/yhypot(x, y)- Euclidean distance sqrt(x²+y²)clamp(x, min, max)- Constrain value between bounds
§Variadic functions
min(x, ...)- Minimum valuemax(x, ...)- Maximum valuesum(x, ...)- Sum of valuesavg(x, ...)- Average of values
Sourcepub fn add_const<S: Into<Cow<'static, str>>>(
&mut self,
name: S,
value: Decimal,
) -> Result<&mut Self, SymbolError>
pub fn add_const<S: Into<Cow<'static, str>>>( &mut self, name: S, value: Decimal, ) -> Result<&mut Self, SymbolError>
Add a constant to the table.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SymTable
impl RefUnwindSafe for SymTable
impl Send for SymTable
impl Sync for SymTable
impl Unpin for SymTable
impl UnwindSafe for SymTable
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more