new javascript version using scaled integers instead of floating point.