Squants v0.4.2 Release Notes
Release Date: 2014-07-06 // over 9 years ago-
๐ Improvements to Market
- โ Add
Price.in
method for directly converting a price to a different currency - โ Add
Price.toString(unit)
method to support formatting in a specific unit - โ Add
Money.toString
overload to support formatting in a different currency - ๐จ Refactor Currencies to be objects rather than vals (no change in usage)
- โ Add
Currency./
method for creating exchange rates - โ Add MoneyNumeric
- โ Add Comparisons for cross-currency Money values (
==#
,!=#
,<#
,<=#
,>#
,>=#
)
Other General Improvements
- โ Add
Quantity.toString
overload that supports standard number formatting (ie, "%3.2f") - โ Add
โ
as another approx operator - โ Add SquantifiedBigDecimal, remove SquantifiedNumeric
- Factor out common data and behavior to new
QuantityCompanion
trait - implemented for all data types exceptMoney
which currently requires special handling - ๐ Implement
String => Quantity
parsing conversions returningTry[Quantity]
for all existing types (see Migration Notes below) - โ Additional Units:
- ElectricCharge:
MilliampereHours
,MilliampereSeconds
- ElectricCharge:
- โ Add
unapply
toUnitOfMeasure
trait and deprecate existing extractors in its favor - โ Json Serialization - experimental, test code only
- โ Generic Quantity Value - experimental, test code only
- โ Add support for Scala cross-version builds (2.10 and 2.11) with 2.11.1 as the default
๐ Bug fixes
- ๐ Fixed
SquareInches.symbol
Migration Note
๐ Quantity String Parsing
๐ String parsers no longer return
Either[String, Q]
but will return aTry[Q]
instead (whereQ
is the specific quantity type). For example,Mass("10 kg")
will return aTry[Mass]
.๐ On failure the
Try.failed
will contain aQuantityStringParseException
which includes the original string to be parsed. This could be used to recover using an alternative parser.Quantity Value Model Unification
๐จ Quantity types implemented as case classes which stored the ratio components of their value (i.e.
Velocity(length, time)
) have been refactored to have a single underlying value.โ This reduction of all types to a single underlying value has resulted in some loss of precision - reflected in the use of more "approximately equal to" tests. However, this change is a precursor to future work that will support far better precision.
Temperature
andMoney
remain as exceptions to the prevailing model. - โ Add