Talk:Horizontal sundial calculations

From Rosetta Code
Revision as of 19:15, 16 May 2011 by Rdm (talk | contribs)

Hi, How about adding the actual calculation being done to the Task description, or pointing it out if it is in the wikipedia article? Thanks. --Paddy3118 07:05, 24 June 2010 (UTC)


It surprises me that every submission (except BBC BASIC) outputs an obviously incorrect value for 6pm (18:00). --Richard Russell 14:47, 16 May 2011 (UTC)

This point of view seems a bit provocative, perhaps even trollish? I see one entry that has labeled "11 am" as "1 am" but most of the others use an "offset from noon" notation, which has some educational merit.] --Rdm 17:29, 16 May 2011 (UTC)
I think he's talking about the hour line angle values. BBC BASIC shows "-95.775" while most other langauges show "84.225". I can't quite tell if these are equivalent (I need a picture), but their absolute values add up to 180 which makes me think they might just be the same angle from different directions. --Mwn3d 17:50, 16 May 2011 (UTC)
Oh, yes, the principal value issue. Hmm... --Rdm 18:12, 16 May 2011 (UTC)
Arguably, the existing implementations satisfy the task requirement: enough information is given for a human to produce an accurate sundial. However, we are computer programmers and we know that that a computer consuming these results would do the wrong thing. Probably the task itself should be more specific about what is required. --Rdm 18:49, 16 May 2011 (UTC)
I see you added a fix for J. What is the math behind this fix? In general, how do you avoid this problem? --Mwn3d 18:51, 16 May 2011 (UTC)
In essence, I use atan2 with arguments X= cos (sun hour angle), Y= sin (sun hour angle)* sin (latitude). --Rdm 19:15, 16 May 2011 (UTC)