Lumapit sa pangunahing nilalaman

//ERDDAP/com.cohort.util/ScriptMath2/niceDouble

niceDouble

[JVM]
fun niceDouble(d: Double, nDigits: Int): Double

Safely tries to un-bruise a double (8.999999999 -> 9.0, or 1.000000001 -> 1.0).

  • nDigits specifies how many digits. Use 7 for converting float to double. Use 11 for converting 6byte real to double.
  • nGoodDigits afterward is ~ 22-nDigits.

Parameters

JVM

da double (often bruised)
nDigitsthe desired number of significant digits