P is for Practical | |
PerlMonks |
Re^7: How to write testable command line script? (updated)by AnomalousMonk (Archbishop) |
on Nov 26, 2018 at 16:36 UTC ( [id://1226363]=note: print w/replies, xml ) | Need Help?? |
This is no different from any decimal ...
But if I have the decimal number -345, this is Negative numbers are only permitted in the degree column.
Unfortunately, if one has a d/m/s tuple @dms = (3, 4, 5) one cannot negate it by writing -@dms. One has to negate each element: Update 1: Added the "Negative numbers ..." quote before the second paragraph for clarification, and various other minor wording changes and additions. Update 2: Here's the Klaf subtraction example in terms of normalizing everything to decimal arc-seconds, doing a decimal subtraction and reducing arc-seconds to a d/m/s tuple: (Update: The Klaf addition example also works correctly.) (Update: Moreover, the reversed subtraction dms_2_secs(39, 41, 28) - dms_2_secs(83, 18, 21) yields the expected (-43 -36 -53) tuple.) Give a man a fish: <%-{-{-{-<
In Section
Seekers of Perl Wisdom
|
|