Boost logo

Boost :

From: Antony Searle (antony.searle_at_[hidden])
Date: 2004-05-19 05:05:26

Thanks for the detailed answer. I'll investigate my options re external


Antony Searle

-----Original Message-----
From: boost-bounces_at_[hidden] [mailto:boost-bounces_at_[hidden]]
On Behalf Of Guillaume Melquiond
Sent: Wednesday, 19 May 2004 6:00 PM
To: Boost
Subject: [boost] Re: Safe to combine boost asinh and boost interval?

Le mar 18/05/2004 à 03:52, Antony Searle a écrit :
> Hi,
> >From what I can make out of their respective implementations, the
> library assumes that asinh (when it exists) produces values consistent
> the floating point rounding mode (i.e. rounding up or down as requested).
> The boost implementation of asinh doesn't seem to take account of the
> rounding mode like this [for x < 0 it returns -asinh(-x), which will be
> rounded the wrong way]. Does this mean that the inclusion guarantee is
> violated when combining boost interval and boost asinh?
> Thanks,
> Antony Searle
> antony.searle_at_[hidden]

The interval library relies on a "rounding" policy in order to do all
the computations on the base type ("float", "double", and "long double"
for the case you seem to be interested in). There is a version of this
policy that assumes the asinh function for interval can be computed by
simply setting the rounding policy and then calling the asinh function
on the base type. So, you are right, the computed values must be
consistent with the rounding mode for the interval library to work

Unfortunately, it is almost never true in real life. It is the reason
why the interval library will not use this policy by default; the user
has to explicitly set this policy in the interval type definition. As
you pointed it out, the boost asinh function does not allow to guarantee
the inclusion property: there is an obvious problem with negative
numbers, but even for positive numbers there is no guarantee the log
function will behave sanely for example.

The examples/transc.cpp file explains how to use an external library in
order to correctly compute all these strange functions. In this example
it is the MPFR library that is used, but other mathematical libraries
could be used instead.

Best regards,


Unsubscribe & other changes:

Boost list run by bdawes at, gregod at, cpdaniel at, john at