in reply to Re^8: How to write testable command line script? (updated)
in thread How to write testable command line script?
... 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.
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).c:\@Work\Perl\monks\thechartist>perl -wMstrict -le "use TrigCalc qw(reduce); ;; my @dms = reduce(-1, 59, 0); print qq{(@dms)}; " (0 -1 0)
Give a man a fish: <%-{-{-{-<
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^10: How to write testable command line script? (updated)
by thechartist (Monk) on Nov 26, 2018 at 21:53 UTC |