... these are 2 separate ways of describing the same [angle] ...
There are an infinite number of ways to describe any angle. I see nothing inherently wrong with representing -0° 1' 0" (or 0°, -1', 0" in a different notation) as (-1, 59, 0) internally as long as this tuple (and all such "weird" tuples; there are many in the test sets) correctly reduce to whatever you define as a "standard" representation (and the aforementioned tuple does reduce to (0, -1, 0) as shown below). In the end, it's all a matter of the constraints you choose to impose on, e.g., notation and internal representation, user input, user output, etc., etc. These are all programmer choices.
c:\@Work\Perl\monks\thechartist>perl -wMstrict -le
"use TrigCalc qw(reduce);
;;
my @dms = reduce(-1, 59, 0);
print qq{(@dms)};
"
(0 -1 0)
That said, simplest is usually best, so my choice for the internal representation of this angle would be -60 arc-seconds (or maybe decimal degrees, or radians, or whatever).
Give a man a fish: <%-{-{-{-<
| [reply] [d/l] [select] |
Thanks for coming back to this. I was about to go into detail showing how my representation, at least for the purposes of addition and subtraction, was equivalent, but you had already done that for me.
After starting this script, I later realized that my initial algorithm did not handle division correctly. I believe you method of converting everything to seconds is the most general and will likely be what I implement when I revise this.
| [reply] |