toHMS and HMSplus give wrong output [FIXED IN v1.4]

Bugs in ND1 (report'em, get'em fixed)

toHMS and HMSplus give wrong output [FIXED IN v1.4]

Postby sokol_22 » Sat Oct 15, 2011 1:13 pm

toHMS(1.2)
gives wrong output
1.116

toHMS(2.2)
gives correct output
2.12

'HMSplus(1.2,1.2)
gives wrong output
2.396
sokol_22
 
Posts: 9
Joined: Sat Oct 15, 2011 12:41 pm

Re: toHMS and HMSplus give wrong output

Postby oliver » Sun Oct 16, 2011 4:13 pm

Hi,

Thank you for reporting this. I can confirm the bug. Oh dear...

I'll work on fixing this for the next update.

Oliver
oliver
Site Admin
 
Posts: 433
Joined: Sat May 01, 2010 2:11 pm

Re: toHMS and HMSplus give wrong output

Postby oliver » Tue Oct 18, 2011 2:55 am

Quick update:

Ok, this has been fixed and will be in the next update. (Let me know if you need it badly, and I deliver it as a restore fix more quickly.)
Two HMS core problems caused these problems (and various others related to HMS).

One was caused by HMS being represented as pseudo-float numbers in HP style. I'm contemplating to give HMS its own data type for a more human readable formatting and avoid potential problems with people inadvertently mixing Reals and HMS data. (If this change is done, "+" will be usable instead of HMSplus etc. I'll keep the old functions for backwards compatibility.)
oliver
Site Admin
 
Posts: 433
Joined: Sat May 01, 2010 2:11 pm

Re: toHMS and HMSplus give wrong output

Postby sokol_22 » Tue Oct 18, 2011 2:03 pm

The *HMS issue is not critical for me. Thanks for quick reply.
sokol_22
 
Posts: 9
Joined: Sat Oct 15, 2011 12:41 pm

Re: toHMS and HMSplus give wrong output

Postby rollo » Tue Oct 18, 2011 5:37 pm

I get an error when the seconds part of the result is less than 10. Does your fix correct that also?

For example, toHMS(.001) gives the message:

toHMS: Result of expression
'(c<10?"0"+c:c).toFixed' [undefined]
is not a function.
rollo
 
Posts: 1
Joined: Tue Oct 18, 2011 5:01 pm

Re: toHMS and HMSplus give wrong output

Postby oliver » Fri Oct 21, 2011 7:20 am

Hi rollo,

Yes, this is fixed too.

It will now return "0.00036".
oliver
Site Admin
 
Posts: 433
Joined: Sat May 01, 2010 2:11 pm


Return to Bugs

Who is online

Users browsing this forum: No registered users and 1 guest

cron