Skip to main content

Ball

Struct Ball 

Source
pub struct Ball { /* private fields */ }
Expand description

Enclosure mid ± rad used to certify that a rounded midpoint is unique.

Implementations§

Source§

impl Ball

Source

pub fn new(mid: ExactNum, rad: ExactNum) -> Self

mid ± rad. The radius is taken in absolute value.

Source

pub fn mid(&self) -> &ExactNum

Midpoint of the enclosure.

Source

pub fn rad(&self) -> &ExactNum

Non-negative radius.

Source

pub fn add(&self, other: &Self, p: usize, rm: RoundingMode) -> Self

Sum of two balls: midpoint add at precision p, radius r1+r2 plus a rounding ulp.

Source

pub fn mul(&self, other: &Self, p: usize, rm: RoundingMode) -> Self

Product of two balls with a first-order radius bound plus a rounding ulp.

Source

pub fn exp(&self, p: usize, rm: RoundingMode, cc: &mut Consts) -> Self

Exponential of a ball. exp is increasing; the radius uses (\lvert\exp(m)\rvert(e^{r}-1)) plus a rounding ulp (same Up convention as add/mul).

Source

pub fn sin(&self, p: usize, rm: RoundingMode, cc: &mut Consts) -> Self

Sine of a ball. (\lvert\sin’\rvert\le 1), so the image radius is at most rad plus a rounding ulp.

Source

pub fn cos(&self, p: usize, rm: RoundingMode, cc: &mut Consts) -> Self

Cosine of a ball. (\lvert\cos’\rvert\le 1).

Source

pub fn ln(&self, p: usize, rm: RoundingMode, cc: &mut Consts) -> Self

Natural log of a ball. Domain: the ball must lie in ((0,+\infty)). Lipschitz (\lvert\ln’\rvert=1/x\le 1/(m-r)).

Source

pub fn sqrt(&self, p: usize, rm: RoundingMode) -> Self

Square root of a ball. Domain: the ball must lie in ((0,+\infty)). Lipschitz (1/(2\sqrt{x})\le 1/(2\sqrt{m-r})).

Source

pub fn erf(&self, p: usize, rm: RoundingMode, cc: &mut Consts) -> Self

Error function of a ball. (\lvert\mathrm{erf}’\rvert\le 2/\sqrt{\pi}).

Source

pub fn bessel_j0(&self, p: usize, rm: RoundingMode, cc: &mut Consts) -> Self

(J_0) of a ball. (\lvert J_0’\rvert=\lvert J_1\rvert\le 1).

Source

pub fn bessel_j1(&self, p: usize, rm: RoundingMode, cc: &mut Consts) -> Self

(J_1) of a ball. (\lvert J_1’\rvert=\lvert J_0-J_1/x\rvert\le 1+1/(\lvert m\rvert-r)) when the ball excludes (0).

Source

pub fn contains(&self, x: &ExactNum, p: usize) -> bool

True when x lies in [mid − rad, mid + rad] (NaN / Inf never contained).

Trait Implementations§

Source§

impl Clone for Ball

Source§

fn clone(&self) -> Ball

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Ball

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for Ball

§

impl RefUnwindSafe for Ball

§

impl Send for Ball

§

impl Sync for Ball

§

impl Unpin for Ball

§

impl UnsafeUnpin for Ball

§

impl UnwindSafe for Ball

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

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

Source§

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
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where 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.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

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

Source§

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 T
where U: Into<T>,

Source§

type Error = !

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 T
where U: TryFrom<T>,

Source§

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.