double getMagnitude(double value) { var magnitude = 0.001; while (magnitude < value) { magnitude *= 10; } magnitude = magnitude / 100; return magnitude; }