next up previous
Next: Other Useful Codes Up: cddlib Reference Manual Previous: Examples


Numerical Accuracy

A little caution is in order. Many people have observed numerical problems of cddlib when the floating version of cddlib is used. As we all know, floating-point computation might not give a correct answer, especially when an input data is very sensitive to a small perturbation. When some strange behavior is observed, it is always wise to create a rationalization of the input (for example, one can replace 0.3333333 with 1/3) and to compute it with cddlib compiled with gmp rational to see what a correct behavior should be. Whenever the time is not important, it is safer to use gmp rational arithmetic.

If you need speedy computation with floating-point arithmetic, you might want to ``play with'' the constant dd_almostzero defined in cdd.h:

   #define dd_almostzero  1.0E-7
This number is used to recognize whether a number is zero: a number whose absolute value is smaller than dd_almostzero is considered zero, and nonzero otherwise. You can change this to modify the behavior of cddlib. One might consider the default setting is rather large for double precision arithmetic. This is because cddlib is made to deal with highly degenerate data and it works better to treat a relatively large ``epsilon'' as zero.

Another thing one can do is scaling. If the values in one column of an input is of smaller magnitude than those in another column, scale one so that they become comparable.


next up previous
Next: Other Useful Codes Up: cddlib Reference Manual Previous: Examples
Komei Fukuda 2004-11-24