The following warnings occurred:
Warning [2] Undefined array key 219773 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 219785 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 219787 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 219788 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 219809 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 220040 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined variable $thread - Line: 295 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 295 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Trying to access array offset on value of type null - Line: 295 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 295 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined variable $fid - Line: 295 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 295 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 219788 - Line: 331 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 331 errorHandler->error_callback
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 304 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 219809 - Line: 331 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 331 errorHandler->error_callback
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 304 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 220040 - Line: 331 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 331 errorHandler->error_callback
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 304 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined variable $theme - Line: 3 - File: inc/plugins/threaded_mode.php(305) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php(305) : eval()'d code 3 errorHandler->error_callback
/inc/plugins/threaded_mode.php 305 eval
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Trying to access array offset on value of type null - Line: 3 - File: inc/plugins/threaded_mode.php(305) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php(305) : eval()'d code 3 errorHandler->error_callback
/inc/plugins/threaded_mode.php 305 eval
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined variable $theme - Line: 3 - File: inc/plugins/threaded_mode.php(305) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php(305) : eval()'d code 3 errorHandler->error_callback
/inc/plugins/threaded_mode.php 305 eval
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Trying to access array offset on value of type null - Line: 3 - File: inc/plugins/threaded_mode.php(305) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php(305) : eval()'d code 3 errorHandler->error_callback
/inc/plugins/threaded_mode.php 305 eval
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined variable $lang - Line: 5 - File: inc/plugins/threaded_mode.php(305) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php(305) : eval()'d code 5 errorHandler->error_callback
/inc/plugins/threaded_mode.php 305 eval
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Attempt to read property "messages_in_thread" on null - Line: 5 - File: inc/plugins/threaded_mode.php(305) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php(305) : eval()'d code 5 errorHandler->error_callback
/inc/plugins/threaded_mode.php 305 eval
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks





Back with my DEG<->DMS formulas !



#2

Hello,

I thought it could interest you to know how I got these formulas (with x>0):

DEG->DMS(x)=(90*x+INT(60*x)+100*INT(x))/250

DMS->DEG(x)=(250*x-INT(100*x)-60*INT(x))/90

To compute DEG->DMS(x):

D = unknown degrees as integer

M = unknown minutes as integer

s = unknown seconds as decimal

Known x=D+M/60+s/3600

D = INT(x)

M = INT(60*x-60*D)

M = INT(60*x-60*INT(x))

M = INT(60*x)-60*INT(x)

s = 3600*x-3600*D-60*M

s = 3600*x-3600*INT(x)-60*(INT(60*x)-60*INT(x))

s = 3600*x-3600*INT(x)-60*INT(60*x)+3600*INT(x)

s = 3600*x-60*INT(60*x)

DMS(x) = D+M/100+s/10000

DMS(x) = INT(x)+(INT(60*x)-60*INT(x))/100+(3600*x-60*INT(60*x))/10000

DMS(x) = (10000*INT(x)+100*INT(60*x)-6000*INT(x)+3600*x-60*INT(60*x))/10000

DMS(x) = (3600*x+40*INT(60*x)+4000*INT(x))/10000

DMS(x) = (90*x+INT(60*x)+100*INT(x))/250

It's mathematically exact, but special care is needed in evaluating INT(60*x) on a calculator.

=> It seems better to round 60*x to last internal digit before applying INT.

To compute DMS->DEG(x):

D = unknown degrees as integer

M = unknown minutes as integer

s = unknown seconds as decimal

Known x=D+M/100+s/10000

D = INT(x)

M = INT(100*x-100*D)

M = INT(100*x-100*INT(x))

M = INT(100*x)-100*INT(x)

s = 10000*x-10000*D-100*M

s = 10000*x-10000*INT(x)-100*(INT(100*x)-100*INT(x))

s = 10000*x-10000*INT(x)-100*INT(100*x)+10000*INT(x)

s = 10000*x-100*INT(100*x)

DEG(x) = D+M/60+s/3600

DEG(x) = INT(x)+(INT(100*x)-100*INT(x))/60+(10000*x-100*INT(100*x))/3600

DEG(x) = (3600*INT(x)+60*INT(100*x)-6000*INT(x)+10000*x-100*INT(100*x))/3600

DEG(x) = (10000*x-40*INT(100*x)-2400*INT(x))/3600

DEG(x) = (250*x-INT(100*x)-60*INT(x))/90

Thanks for reading !

Edited: 2 May 2012, 3:08 a.m.


#3

Hi!

Wow! Great work!

I have written some programs just to take a DMS number and show it in DMS format, I mean, take something like 123.455959 and return the string "123º45'59"59" so it would be easier to read the DMS itself.

My first two versions worked pretty well until I tried them with negative numbers.

Your formulas are way more sophisticated, they are used to compute the DMS and the DEG versions of each other, I see that. But I also noticed that they seem to have no provision for negative input data; do they work accordingly in this case? I did not try any, could not tell, but since they mostly add factors, I felt as if they may deal only with positive numbers.

Best regards.

Luiz (Brazil)


#4

Hello,

Thanks for your answer.

Their sophistication is in their simplicity (one line formulas).

As I've already specified it ("x>0"), they work only for positive numbers (therefore you need to work with abs value and restore sign at the end)

All those lines in my post were just their mathematical proof (I hope I didn't make any error ...)


#5

Hi.

My bad, sorry. I read the (x>0) but my brain did not convert it into information, just the words 'x is greater than zero' echoing in the void... Gee, must give it a break.

Quote:
Their sophistication is in their simplicity (one line formulas).
I could not say it differently. It is also the beauty of the complex solutions expressed as simple terms and expressions. Touchè!

Thanks!

Luiz (Brazil)

Edited: 2 May 2012, 10:31 a.m.

#6

Hello there. PGILLET and the rest of the crew, I'm glad my original inquiry has sparked some inspiration. My pleasure.

#7

Thank you, now my 18C can do it too :-)


Possibly Related Threads…
Thread Author Replies Views Last Post
  HP Prime - Saved formulas, expressions CR Haeger 6 2,024 10-07-2013, 08:25 PM
Last Post: CR Haeger
  Lost formulas David Goldstein 5 1,931 05-08-2013, 03:39 AM
Last Post: Katie Wasserman
  Getting back to the CL Geir Isene 6 2,098 03-20-2013, 07:02 PM
Last Post: Geir Isene
  HP-11C Back Screws John Swisher 0 1,258 09-12-2012, 10:52 AM
Last Post: John Swisher
  I am back ;) with a problem on HP 41 ;( wildpig 7 2,145 07-09-2012, 11:30 AM
Last Post: Mike Morrow
  Formulae or formulas, that's the question (poll) Walter B 56 12,892 06-16-2012, 11:16 AM
Last Post: William L. Drylie
  15c LE back at HP Neil Carlson 4 1,610 03-27-2012, 04:56 PM
Last Post: Harald
  [WP34s] About SKIP and BACK fhub 8 2,444 01-09-2012, 06:10 PM
Last Post: Neil Hamilton (Ottawa)
  15C back in stock at hp.com sjthomas 8 2,488 12-22-2011, 10:32 AM
Last Post: Dan Grelinger
  The most abused phrase "Check Back Soon" Michael de Estrada 8 2,532 10-11-2011, 10:25 PM
Last Post: hpnut

Forum Jump: