Extract from Time
|
10-10-2015, 06:53 PM
Post: #1
|
|||
|
|||
Extract from Time
Hi all,
Is there a command to convert "Time" to a decimal value? I need this to calculate the fraction of a day according to "Time" Cheers Jan |
|||
10-10-2015, 09:02 PM
Post: #2
|
|||
|
|||
RE: Extract from Time
Maybe
Code: HMS→(Time) |
|||
10-12-2015, 06:52 AM
Post: #3
|
|||
|
|||
RE: Extract from Time
hello,
HMS-> will not do what you think/want. HMS-> will convert a real number which is represent HMS values (with the decimal part in the [0 to 0,6[ range into a number with a decimal part in the [0..1[ range. however the Time function does NOT return a number encoded in HMS, but a number DISPLAYED in HMS format (which is different). To remove the HMS display flag, add that number to 0. 0+Time will return what you want (the 'format' of the first of 2 operands does take precedence over the format of the second one)... HMS-> functions are there because old habits die hard, but HMS encoding is "bad" (as in crossing the streams"), as base 60 and base 10 conversions always lead to precision lost. This is why Prime is privileging DISPLAY in HMS with internal encoding staying in decimal. Cyrille Although I work for the HP calculator group, the views and opinions I post here are my own. I do not speak for HP. |
|||
10-12-2015, 06:57 AM
Post: #4
|
|||
|
|||
RE: Extract from Time | |||
10-12-2015, 08:06 AM
Post: #5
|
|||
|
|||
RE: Extract from Time
(10-12-2015 06:52 AM)cyrille de brébisson Wrote: HMS-> will not do what you think/want. I strongly suspect that this is not correct. If it were correct, then HMS→(1.3) would return 1.5 (as on other HP calculators), but it doesn't. HMS→(1.3) returns 1.3, and in general the HMS→ function simply returns any real argument unchanged. All it does is turn off the HMS display flag for HMS-format inputs. That makes it perfect for what the OP wanted, and less cryptic than 0+Time or approx(Time) or evalf(Time) or anything like that. <0|ɸ|0> -Joe- |
|||
10-12-2015, 03:10 PM
Post: #6
|
|||
|
|||
RE: Extract from Time
Hello,
Yep, I stand corrected, HMS-> and ->HMS only changes the display flag but does not change the real's value. Thanks Joe for shining, as always, light on such issues! Cyrille Although I work for the HP calculator group, the views and opinions I post here are my own. I do not speak for HP. |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)