Flint2-0.1.0.5: Haskell bindings for the flint library for number theory
Safe HaskellSafe-Inferred
LanguageHaskell2010

Data.Number.Flint.Support.D.Interval

Description

This module provides helper functions for computing fast enclosures using double arithmetic.

Synopsis

Double-precision interval arithmetic and helpers

data Di Source #

Constructors

Di !(ForeignPtr CDi) 

data CDi Source #

Constructors

CDi CDouble CDouble 

Instances

Instances details
Storable CDi Source # 
Instance details

Defined in Data.Number.Flint.Support.D.Interval.FFI

Methods

sizeOf :: CDi -> Int #

alignment :: CDi -> Int #

peekElemOff :: Ptr CDi -> Int -> IO CDi #

pokeElemOff :: Ptr CDi -> Int -> CDi -> IO () #

peekByteOff :: Ptr b -> Int -> IO CDi #

pokeByteOff :: Ptr b -> Int -> CDi -> IO () #

peek :: Ptr CDi -> IO CDi #

poke :: Ptr CDi -> CDi -> IO () #

Show CDi Source # 
Instance details

Defined in Data.Number.Flint.Support.D.Interval.FFI

Methods

showsPrec :: Int -> CDi -> ShowS #

show :: CDi -> String #

showList :: [CDi] -> ShowS #

Basic manipulation

di_interval :: CDouble -> CDouble -> CDi Source #

di_interval a b

Returns the interval \([a, b]\). We require that the endpoints are ordered and not NaN.

arb_get_di :: Ptr CArb -> IO CDi Source #

arb_get_di x

Returns the ball x converted to a double-precision interval.

arb_set_di :: Ptr CArb -> CDi -> CLong -> IO () Source #

arb_set_di res x prec

Sets the ball res to the double-precision interval x, rounded to prec bits.

di_print :: CDi -> IO () Source #

di_print x

Prints x to standard output. This simply prints decimal representations of the floating-point endpoints; the decimals are not guaranteed to be rounded outward.

di_randtest2 :: Ptr CFRandState -> IO CDouble Source #

d_randtest2 state

Returns a random non-NaN double with any exponent. The value can be infinite or subnormal.

di_randtest :: Ptr CFRandState -> IO CDi Source #

di_randtest state

Returns an interval with random endpoints.

Arithmetic

di_neg :: CDi -> CDi Source #

di_neg x

Returns the exact negation of x.

Fast arithmetic

di_fast_add :: CDi -> CDi -> CDi Source #

di_fast_add x y

di_fast_sub :: CDi -> CDi -> CDi Source #

di_fast_sub x y

di_fast_mul :: CDi -> CDi -> CDi Source #

di_fast_mul x y

di_fast_div :: CDi -> CDi -> CDi Source #

di_fast_div x y

Returns the sum, difference, product or quotient of x and y. Division by zero is currently defined to return \([-\infty, +\infty]\).

di_fast_sqr :: CDi -> CDi Source #

di_fast_sqr x

Returns the square of x. The output is clamped to be nonnegative.

di_fast_add_d :: CDi -> CDouble -> CDi Source #

di_fast_add_d x y

di_fast_mul_d :: CDi -> CDouble -> CDi Source #

di_fast_mul_d x y

di_fast_div_d :: CDi -> CDouble -> CDi Source #

di_fast_div_d x y Arithmetic with an exact double operand.

di_fast_log_nonnegative :: CDi -> CDi Source #

di_fast_log_nonnegative x

Returns an enclosure of \(\log(x)\). The lower endpoint of x is rounded up to 0 if it is negative.

di_fast_mid :: CDi -> CDi Source #

di_fast_mid x

Returns an enclosure of the midpoint of x.

di_fast_ubound_radius :: CDi -> CDouble Source #

di_fast_ubound_radius x

Returns an upper bound for the radius of x.