You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Bytes(Double.MaxValue / 2.0) == (Bytes(Double.MaxValue / 2.0) + Bytes(1.0)) will evaluate to true
This happens because Information's underlying type is Double. Not sure about reasons to choose this, it seems that Long should suit these needs better.
The text was updated successfully, but these errors were encountered:
final class Information private(val amount: Long, val unit: InformationUnit)
extends Quantity[Information]
with TimeIntegral[DataRate] {
Add this to the Information class as well:
def value = amount.toDouble
// overridden to remove the forcing of doubles for this unit that makes
// no sense now that this dimension is represented by a long
override def toString(): String = s"$amount ${unit.symbol}"
override def toString(uom: UnitOfMeasure[Information]): String =
in(uom).toString()
In the Information object: change the first apply method like so (toDouble becomes toLong):
private[information] def apply[A](n: A, unit: InformationUnit)(implicit num: Numeric[A]) = new Information(num.toLong(n), unit)
Change the InformationSpec test to remove the .0 from the expected strings in the string formatting test
Go ahead and make that PR for yourself and push it back...
atk91
pushed a commit
to atk91/squants
that referenced
this issue
Apr 11, 2019
Bytes(Double.MaxValue / 2.0) == (Bytes(Double.MaxValue / 2.0) + Bytes(1.0))
will evaluate totrue
This happens because
Information
's underlying type isDouble
. Not sure about reasons to choose this, it seems thatLong
should suit these needs better.The text was updated successfully, but these errors were encountered: