CycloneTechnology/ChaMP

View on GitHub
champ-ipmi/src/main/scala/com/cyclone/ipmi/protocol/sdr/RawAccuracy.scala

Summary

Maintainability
A
0 mins
Test Coverage
package com.cyclone.ipmi.protocol.sdr

case class RawAccuracy(value: Double) extends AnyVal

object RawAccuracy {

  /**
    * Utility to create from accuracy figure that stored as
    * 1/100 of a percent (i.e. one ten-thousandth) and an exponent
    */
  def fromPerTenThouAndExp(perTenThou: Int, exp: Int): RawAccuracy =
    RawAccuracy(perTenThou.toDouble / 10000 * Math.pow(10, exp))

}