Since Abs() returns an UnknownUnit rather than void, I assume the return value is supposed to contain the absolute value. But I found the underlying value was also mutated -- calling Abs() on a negative quantity changed it to a positive quantity, so I lost my original value. This is noted in test case 01 and is resolved by my pull request.
Not resolved by this pull request, I think it would be desirable if the unit prefix was fully preserved through this operation. So the absolute value of -32 MHz could be written by the ToString() method as 32 MHz rather than -3.2e7 Hz. I understand this is a broader change and may not be considered urgent or important right now.
A couple of points here:
Since
Abs()
returns anUnknownUnit
rather thanvoid
, I assume the return value is supposed to contain the absolute value. But I found the underlying value was also mutated -- callingAbs()
on a negative quantity changed it to a positive quantity, so I lost my original value. This is noted in test case 01 and is resolved by my pull request.Not resolved by this pull request, I think it would be desirable if the unit prefix was fully preserved through this operation. So the absolute value of
-32 MHz
could be written by theToString()
method as32 MHz
rather than-3.2e7 Hz
. I understand this is a broader change and may not be considered urgent or important right now.