Board index » cppbuilder » Re: math.h error popup window

Re: math.h error popup window


2006-01-25 04:56:48 AM
cppbuilder28
Richard Kaiser wrote:
Quote
After calling a math.h function with invalid arguments like

sqrt(-1)

a window with a message like

sqrt: Domain error

pops up. Is there a way to prevent this window to pop up?

Richard Kaiser

Was it a LMS algorithm?
If so, please see...
'Factorization Methods for Discrete Sequential Estimation'
- Gerry Bierman
- 1975
Bill
 
 

Re:Re: math.h error popup window

Russell Hind wrote:
Quote
Richard Kaiser wrote:

>
>sqrt: Domain error
>

We get this a lot from acos. Currently doing some 3D work which
involves matrix manipulations and then calculations to yaw/pitch/rolls.
Floating point inaccuracies can lead to vectors who's length is>1
only in a very insignificant digit which can lead to domain errors when
doing dot products and such to calculate angles.

I've ended up wrapping this code to trim the value passed to acos to 1
or -1 if it is within a few decimal places but otherwise throw.

Cheers

Russell
Implimenting direction cosines with quaternians is computer stable,
or easily stabilized...
IEEE has some good articles on this if available,
else if interested please email me;
Bill
XXXX@XXXXX.COM