dround

2013-02-01
2013-02-06
  • Erik Olofsen
    Erik Olofsen
    2013-02-01

    The 'distribution' dround handles rounded data to n significant digits.

    Experimenting with it revealed that with n=0, the data should be in the range 1..10. It cannot be zero.

    In practice, one often encounters rounded data to integers, so that the numbers above 10 actually have 2 significant digits etc.; and zero may be encountered.

    Could this situation be handled by dround or a modification of it?

     
  • Erik Olofsen
    Erik Olofsen
    2013-02-01

    In the meantime I modified DRound.cc as follows which seems to work as I hoped for (but the use/meaning of NDIGITS is just a tryout):

    static inline double value(vector<double const="" *=""> const &par)
    {
    // return fprec(T(par), NDIGITS(par));
    return NDIGITS(par)*round(T(par)/NDIGITS(par));
    }

     
  • Martyn Plummer
    Martyn Plummer
    2013-02-06

    We should be using fround here, not fprec. This will be corrected in the next release. Sorry about that.