dvas

2013-05-17
2013-05-17
  • Erik Olofsen
    Erik Olofsen
    2013-05-17

    Earlier I studied the source code for the dround distribution (see that topic).

    Now I needed a distribution for VAS (visual analog scale) scores - these are between 0 and 10 (both inclusive) and usually rounded to integers.

    Based on the files for dround I just wrote

    static inline double value(vector<double const *> const &par)
    {
        if (T(par)<0.0) return 0.0;
        else if (T(par)>10.0) return 10.0;
        return fround(T(par), NDIGITS(par));
    }
    

    and added the name "dvas", added the filenames to Makefile.am (in directories functions and distributions), ran automake, and put statements in bugs.cc so that the dvas function and distribution can be used - and it seems to work.

    Would that be a correct approach?