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

scoverage.domain.DoubleFormat.scala Maven / Gradle / Ivy

There is a newer version: 2.3.0
Show newest version
package scoverage.domain

import java.text.DecimalFormat
import java.text.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 - 2025 Weber Informatics LLC | Privacy Policy