MCPcopy Create free account
hub / github.com/AstroImageJ/astroimagej / round

Method round

ij/src/main/java/ij/plugin/ScaleBar.java:855–860  ·  view source on GitHub ↗

Rounds down a positive value such that the first digit is 1, 2, or 5

(double x)

Source from the content-addressed store, hash-verified

853 }
854 /** Rounds down a positive value such that the first digit is 1, 2, or 5 */
855 static double round(double x) {
856 double base = Math.pow(10, Math.floor(Math.log10(x)+1e-8));
857 if (x > 4.999999*base) return 5*base;
858 else if (x > 1.999999*base) return 2*base;
859 else return base;
860 }
861 } // Utils inner class
862} //ScaleBar class

Callers 15

drawColorBarMethod · 0.45
getDisplayRangeMinMethod · 0.45
getDisplayRangeMaxMethod · 0.45
getFontMethod · 0.45
updateFontMethod · 0.45
trimMethod · 0.45
drawSphereMethod · 0.45
doMathMethod · 0.45
makeLineMethod · 0.45
moveToMethod · 0.45
lineToMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected