H->HMS conversion HP-15C vs. HP42S vs HP67
09-09-2018, 01:54 PM (This post was last modified: 09-09-2018 01:59 PM by Thomas Okken.)
Post: #39
 Thomas Okken Senior Member Posts: 1,843 Joined: Feb 2014
RE: H->HMS conversion HP-15C vs. HP42S vs HP67
The problem with using nextafter() is that the closest decimal equivalent isn't always going to be higher. In other words, you're always rounding up, but sometimes 0.3999 really is 0.3999, not a mangled 0.4000.

How about this: instead of multiplying by 10^12, I'll multiply by whichever power of 10 makes the integral part of the number have 12 digits (or 15, or whatever choice is safe), then round to the nearest integer, then remove what was originally the integer part, and finally normalize the scale of the remainder. That should preserve the nice properties of the current Free42 Binary implementation, while improving its handling of binary round-off as much as possible (without doing the equivalent of a full-blown dtoa(), anyway).
 « Next Oldest | Next Newest »

 Messages In This Thread H->HMS conversion HP-15C vs. HP42S vs HP67 - Siegfried - 09-06-2018, 11:16 AM RE: H->HMS conversion HP-15C vs. HP42S vs HP67 - BartDB - 09-06-2018, 11:30 AM RE: H->HMS conversion HP-15C vs. HP42S vs HP67 - Massimo Gnerucci - 09-06-2018, 11:35 AM RE: H->HMS conversion HP-15C vs. HP42S vs HP67 - Robert VM - 09-06-2018, 12:58 PM RE: H->HMS conversion HP-15C vs. HP42S vs HP67 - Paul Dale - 09-06-2018, 11:32 AM RE: H->HMS conversion HP-15C vs. HP42S vs HP67 - ijabbott - 09-06-2018, 06:51 PM RE: H->HMS conversion HP-15C vs. HP42S vs HP67 - Thomas Okken - 09-06-2018, 10:37 PM RE: H->HMS conversion HP-15C vs. HP42S vs HP67 - Siegfried - 09-07-2018, 09:42 PM RE: H->HMS conversion HP-15C vs. HP42S vs HP67 - Didier Lachieze - 09-06-2018, 12:05 PM RE: H->HMS conversion HP-15C vs. HP42S vs HP67 - Gene - 09-06-2018, 01:07 PM RE: H->HMS conversion HP-15C vs. HP42S vs HP67 - Paul Dale - 09-07-2018, 03:40 AM RE: H->HMS conversion HP-15C vs. HP42S vs HP67 - rprosperi - 09-06-2018, 01:21 PM RE: H->HMS conversion HP-15C vs. HP42S vs HP67 - burkhard - 09-06-2018, 01:42 PM RE: H->HMS conversion HP-15C vs. HP42S vs HP67 - Albert Chan - 09-06-2018, 02:14 PM RE: H->HMS conversion HP-15C vs. HP42S vs HP67 - Dieter - 09-06-2018, 05:01 PM RE: H->HMS conversion HP-15C vs. HP42S vs HP67 - burkhard - 09-06-2018, 05:14 PM RE: H->HMS conversion HP-15C vs. HP42S vs HP67 - Dieter - 09-06-2018, 05:31 PM RE: H->HMS conversion HP-15C vs. HP42S vs HP67 - Albert Chan - 09-06-2018, 07:36 PM RE: H->HMS conversion HP-15C vs. HP42S vs HP67 - Werner - 09-07-2018, 09:43 AM RE: H->HMS conversion HP-15C vs. HP42S vs HP67 - Thomas Okken - 09-07-2018, 02:40 PM RE: H->HMS conversion HP-15C vs. HP42S vs HP67 - Albert Chan - 09-08-2018, 12:59 PM RE: H->HMS conversion HP-15C vs. HP42S vs HP67 - Zaphod - 09-06-2018, 05:58 PM RE: H->HMS conversion HP-15C vs. HP42S vs HP67 - burkhard - 09-06-2018, 06:02 PM RE: H->HMS conversion HP-15C vs. HP42S vs HP67 - Pekis - 09-07-2018, 07:07 AM RE: H->HMS conversion HP-15C vs. HP42S vs HP67 - Albert Chan - 09-07-2018, 03:43 PM RE: H->HMS conversion HP-15C vs. HP42S vs HP67 - Albert Chan - 09-08-2018, 06:03 PM RE: H->HMS conversion HP-15C vs. HP42S vs HP67 - Albert Chan - 09-09-2018, 04:21 AM RE: H->HMS conversion HP-15C vs. HP42S vs HP67 - Joe Horn - 09-09-2018, 05:10 AM RE: H->HMS conversion HP-15C vs. HP42S vs HP67 - Carsen - 09-09-2018, 05:29 AM RE: H->HMS conversion HP-15C vs. HP42S vs HP67 - Werner - 09-09-2018, 07:50 AM RE: H->HMS conversion HP-15C vs. HP42S vs HP67 - teenix - 09-09-2018, 08:59 AM RE: H->HMS conversion HP-15C vs. HP42S vs HP67 - AndiGer - 09-15-2018, 09:54 AM RE: H->HMS conversion HP-15C vs. HP42S vs HP67 - AndiGer - 09-07-2018, 04:57 PM RE: H->HMS conversion HP-15C vs. HP42S vs HP67 - Gene - 09-07-2018, 08:49 PM RE: H->HMS conversion HP-15C vs. HP42S vs HP67 - Thomas Okken - 09-08-2018, 02:35 PM RE: H->HMS conversion HP-15C vs. HP42S vs HP67 - Albert Chan - 09-08-2018, 03:45 PM RE: H->HMS conversion HP-15C vs. HP42S vs HP67 - Albert Chan - 09-09-2018, 06:13 AM RE: H->HMS conversion HP-15C vs. HP42S vs HP67 - Albert Chan - 09-09-2018, 11:39 AM RE: H->HMS conversion HP-15C vs. HP42S vs HP67 - Werner - 09-09-2018, 08:51 AM RE: H->HMS conversion HP-15C vs. HP42S vs HP67 - Thomas Okken - 09-09-2018 01:54 PM RE: H->HMS conversion HP-15C vs. HP42S vs HP67 - Albert Chan - 09-09-2018, 03:25 PM RE: H->HMS conversion HP-15C vs. HP42S vs HP67 - Pekis - 09-10-2018, 07:31 AM RE: H->HMS conversion HP-15C vs. HP42S vs HP67 - Albert Chan - 09-10-2018, 12:46 PM RE: H->HMS conversion HP-15C vs. HP42S vs HP67 - Pekis - 09-10-2018, 01:31 PM RE: H->HMS conversion HP-15C vs. HP42S vs HP67 - Albert Chan - 09-10-2018, 04:28 PM RE: H->HMS conversion HP-15C vs. HP42S vs HP67 - Werner - 09-12-2018, 07:14 AM RE: H->HMS conversion HP-15C vs. HP42S vs HP67 - Albert Chan - 09-12-2018, 02:08 PM RE: H->HMS conversion HP-15C vs. HP42S vs HP67 - Albert Chan - 09-12-2018, 08:20 PM RE: H->HMS conversion HP-15C vs. HP42S vs HP67 - Werner - 09-14-2018, 12:46 PM RE: H->HMS conversion HP-15C vs. HP42S vs HP67 - Joe Horn - 09-10-2018, 03:32 PM RE: H->HMS conversion HP-15C vs. HP42S vs HP67 - Albert Chan - 09-10-2018, 06:18 PM RE: H->HMS conversion HP-15C vs. HP42S vs HP67 - Joe Horn - 09-10-2018, 06:53 PM RE: H->HMS conversion HP-15C vs. HP42S vs HP67 - Dieter - 09-10-2018, 07:13 PM RE: H->HMS conversion HP-15C vs. HP42S vs HP67 - Joe Horn - 09-10-2018, 07:06 PM RE: H->HMS conversion HP-15C vs. HP42S vs HP67 - DaveBr - 09-20-2018, 08:52 PM RE: H->HMS conversion HP-15C vs. HP42S vs HP67 - Werner - 09-12-2018, 07:06 AM RE: H->HMS conversion HP-15C vs. HP42S vs HP67 - Werner - 09-10-2018, 02:10 PM RE: H->HMS conversion HP-15C vs. HP42S vs HP67 - Albert Chan - 09-13-2018, 04:47 AM RE: H->HMS conversion HP-15C vs. HP42S vs HP67 - Pekis - 09-13-2018, 08:47 AM RE: H->HMS conversion HP-15C vs. HP42S vs HP67 - Albert Chan - 09-13-2018, 01:46 PM RE: H->HMS conversion HP-15C vs. HP42S vs HP67 - Albert Chan - 09-18-2018, 04:56 PM RE: H->HMS conversion HP-15C vs. HP42S vs HP67 - Pekis - 09-13-2018, 03:11 PM RE: H->HMS conversion HP-15C vs. HP42S vs HP67 - Albert Chan - 09-15-2018, 02:47 PM RE: H->HMS conversion HP-15C vs. HP42S vs HP67 - Craig Bladow - 09-21-2018, 03:06 AM RE: H->HMS conversion HP-15C vs. HP42S vs HP67 - Albert Chan - 09-21-2018, 12:16 PM RE: H->HMS conversion HP-15C vs. HP42S vs HP67 - Ken S - 09-21-2018, 06:08 AM