scaleUnitMagnitude function

double scaleUnitMagnitude (double value)

Returns the number divided by it's magnitude, effectively returning a number between -10 and 10.

Implementation

double scaleUnitMagnitude(double value) {
  if (value.compareTo(0.0) == 0) {
    return value;
  }

  int m = magnitude(value);
  return value * pow(10, -m);
}