Skip to content

Instantly share code, notes, and snippets.

@tonymorris
Last active June 10, 2021 22:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tonymorris/88aaca915f5b2a5b5d532df07435ddca to your computer and use it in GitHub Desktop.
Save tonymorris/88aaca915f5b2a5b5d532df07435ddca to your computer and use it in GitHub Desktop.
#!/usr/bin/env runhaskell
import Text.Printf
fromRadian a = a / pi * 180
toRadian a = a / 180 * pi
showDiff :: Int -> String
showDiff x =
let x' = toRadian (fromIntegral x)
diff = fromRadian (x' - sin x')
in "| " <> printf "%03d" x <> " | " <> printf "%012.8f" (diff :: Double) <> " |"
main =
do putStrLn "+-----+--------------+"
putStrLn "| ∠ | error° |"
putStrLn "+-----+--------------+"
mapM_ (putStrLn . showDiff) [0..89]
putStrLn "+-----+--------------+"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment