Horizontal sundial calculations: Difference between revisions
m
→{{header|Haskell}}: (minor tidying)
SqrtNegInf (talk | contribs) (Added Perl example) |
m (→{{header|Haskell}}: (minor tidying)) |
||
Line 1,018:
=={{header|Haskell}}==
<lang haskell>
roundDec d = (/ 10.0 ^ d) . fromIntegral . round . (* 10.0 ^ d)▼
radToDegr = ((180 / pi) *)
▲roundDec d = (/10.0^d). fromIntegral. round. (*10.0^d)
main = do
let lat
long
legalMerid = -150
sinOfLat
diff
(putStrLn . unlines)
mapM_
(\h ->
dhla = radToDegr . atan. (sinOfLat *). tan $ degrToRad sha▼
++ take 16 (show (roundDec 3 sha) ++ repeat ' ' )▼
take 7 (show h ++ repeat ' ') ++
) [-6,-5..6]</lang>▼
" " ++ show (roundDec 3 dhla))
{{out}}
<pre>*Rosetta.HorSunDial> main
|