All Downloads are FREE. Search and download functionalities are using the official Maven repository.

scoverage.DoubleFormat.scala Maven / Gradle / Ivy

The newest version!
package scoverage

import java.text.{DecimalFormat, DecimalFormatSymbols}
import java.util.Locale

object DoubleFormat {
  private[this] val twoFractionDigitsFormat: DecimalFormat = {
    val fmt = new DecimalFormat()
    fmt.setDecimalFormatSymbols(new DecimalFormatSymbols(Locale.US))
    fmt.setMinimumIntegerDigits(1)
    fmt.setMinimumFractionDigits(2)
    fmt.setMaximumFractionDigits(2)
    fmt.setGroupingUsed(false)
    fmt
  }

  def twoFractionDigits(d: Double) = twoFractionDigitsFormat.format(d)

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy