fmod2p function

double fmod2p(
  1. double arg
)

compute the remainder of truncating division. If it's negative add 2*PI

Implementation

double fmod2p(double arg) {
  double modu = arg.remainder(TWOPI);

  if (modu < 0.0) {
    modu += TWOPI;
  }

  return modu;
}