0.3.4
Release Notes
User-facing library changes
Potentially breaking changes:
- New approach to applying magnitudes (#176)
- The good news: conversions are in some cases faster (at runtime)
than before! - The bad news: this can change results very slightly for floating
point types. This is just the "usual floating point error": that
is, the new result might be one or two representable floating point
numbers away from the old one. (Well-written code should not break,
because relying on exact results for floating point computations is
inconsistent with standard best practices.) - See the brand new Applying Magnitudes docs to understand the
change in detail!
- The good news: conversions are in some cases faster (at runtime)
Unit Symbols: (#194, #196, #197)
Finally, a concise way to make a Quantity
. Like user-defined
literals, only better!
using ::au::symbols::m;
using ::au::symbols::s;
constexpr auto a1 = (meters / squared(second))(9.8f); // Old
constexpr auto a2 = 9.8f * m / s / s; // New!
Note how easy it is to work with alternative rep, such as float
;
user-defined literals would really struggle here. They also support
unit slot APIs, so you can write .as(m / s / s)
.
Check out the Unit Symbol section in our units docs for more details.
Constants (feature preview): (#194, #200, #204, #207)
If you have a constant of nature, such as the speed of light or Planck's
constant, this new feature will let you use it much more effectively and
efficiently. You can instantaneously multiply or divide it with any
number or quantity: the operation happens at compile time, so there
is no runtime cost! You can also convert it to any desired Quantity
type, and take advantage of our perfect conversion policy: we allow
the conversion if it can be exactly represented in the type, and forbid
it otherwise. See the Constant docs for more details.
(This is only a "feature preview" because we haven't actually included
any constant values yet. We will use the new feature internally at
Aurora for a while, and we expect to begin adding constants in the next
release.)
Runtime conversion checkers (feature preview): (#208, #212)
The gold standard for dealing with unit conversions that might overflow
integer types is to check every unit conversion at runtime. Au is now
the first units library (that we know of!) which provides a boolean
conversion checker for every individual unit conversion, which can check
whether it will be lossy for a specific runtime value. Now it's very
easy for users to lean on these utilities to do the "heavy lifting", and
write a generic "checked conversion" function using their project's
preferred error handling mechanism. See the "Check every conversion at
runtime" section of the Overflow docs for more details.
(This is only a "feature preview" because we haven't added explicit-rep
APIs, and we haven't added support for QuantityPoint
yet.)
Other enhancements, bugfixes, and refactorings:
- New function,
as_chrono_duration(Quantity)
, to turn any Au duration
into an exactly-equivalentstd::chrono::duration
type (#199) - New function,
remainder(Quantity)
: a unit-aware analogue for
std::remainder
(basically a zero-centeredfmod
) (#188) - New function,
representable_in<T>(m)
, to indicate whether
a magnitudem
can be exactly represented in the typeT
(#183) ZERO
now works as users would expect inmin
,max
, andclamp
(#182)- Make
Quantity
in
/as
APIs into full-fledged unit slots (#195) inverse_as
was too strict, preventing some valid use cases; we used
constants to safely relax its underlying policy (#202)- Let
u
inunit_label(u)
be a unit slot (#206) - Enable checking representability of Magnitude that can't fit in
std::uintmax_t
(#211) - We can now compute a value for every representable magnitude, even
those with fractional powers! (#213) - The
chrono
interoperation utilities now get their own bazel target
(#201)
New units
No new units in Au 0.3.4.
Tooling updates
make-single-file
has new--all-units
option (#178)
Documentation updates
Here are the brand new and/or significantly updated docs, shown by their
place in the hierarchy:
- Discussion
- Concepts
- Implementation
- Reference
- Constant (#200)
- Unit: Unit Symbol section (#196, #198)
Au now has explicit support for Compiler Explorer (a.k.a. "godbolt")!
- Automatically generate "godbolt friendly" single-file scripts with
every unit (#178) - Make a "canonical" Au godbolt link, and feature it on our README
(#193)
We also made the following other doc changes:
- All links are now underlined, in order to improve accessibility (#191)
- Updated comparison table to reflect mp-units improvements (#175)
RELEASE.md
includes instructions to test commented-out cases, and
check compile time impact (#180)- Fix legacy internal links to point to
main
version of docs (#192)
Repo updates
- Update python deps to fix dependabot alert 5 (#181) and 6 (since
withdrawn; #184) - Add
-Wshadow
to our regular compiler options (#205) - Add
-pedantic
to ourEXTRA_COPTS
compiler options (#210)
Closed Issues
Here are all of the issues that were closed between these releases.
(Note that the resolution is at the level of days, so some of these
issues might show up in the notes for more than one release.)
https://github.com/aurora-opensource/au/issues?q=is%3Aissue+closed%3A2023-09-01..2023-12-20
Contributors
Thanks to those who authored or reviewed PRs, or filed or participated
in Issues! Alphabetically: