PDA

View Full Version : Number conversion



mombasa
- 9th November 2014, 22:23
I need to convert some numbers that express time values ​​from decimal to sexagesimal . Does anyone have a valid formula ? thanks

Demon
- 10th November 2014, 03:19
How To Convert a Decimal to Sexagesimal

http://geography.about.com/library/howto/htdegrees.htm

Does this help?

Robert

mombasa
- 10th November 2014, 18:21
Thanks Demon, maybe I have not explained well, but I have a number of hours expressed as a decimal (eg. 2.5h - 4,23h - 1,125h) and I need to convert this number in hours: minutes: seconds (HH: MM : ss). Thank you for your help

Archangel
- 10th November 2014, 18:58
Hi Mombassa
in PBP you will have to jump through several hoops like a circus dog
hours to seconds = hours x 3600
minutes to seconds = minutes x 60

seconds to hours = seconds /3600 with no remainder or seconds//3600 with a remainder
minutes= seconds//60 with remainder being your seconds left over
see section 4.17.2 of the manual.
you may display individual digits using DIG command sec 4.17.8

Dave
- 10th November 2014, 19:01
You will need .0001 hour resolution to get 1 second resolution.
.1 hour = 6 min.
.01 hour = 24 sec.
.001 hour = 3.6 sec
.0001 hour = .36 sec

Amoque
- 12th November 2014, 19:13
It would appear, from your examples, that the hours are already done. As minutes and seconds share a base of 60 parts per whole [next] unit, you really only need consider one conversion from decimal fraction (hundredths) to time based (sixtieths) - once for the fraction of hours to minutes, then again on the remainder for fractions of minutes to seconds. Some scaling will be necessary to address the integer math, but...

Fraction of an hour * 60 = minutes. Fraction of a minute * 60 = seconds.

So, if you have 1.125 hours: .125 hours * 60 = 7.5 minutes and .5 minutes * 60 = 30 seconds. 1.125 hours = 01:07:30. Again using your example of 4.23 hours:

.23 hours * 60 = 13.8 minutes. .8 minutes * 60 = 48 seconds = 04:13:48.

Perhaps I have misunderstood your OP, but it does not seem such a difficult exercise to me.

mombasa
- 30th November 2014, 17:46
Thanks to all for the invaluable assistance :D