@@ -0,0 +1,28 @@
1+module basic025
2+
3+-- converting data from strings at runtime so as to prevent the
4+-- compiler of eliding the calls to atan2 via constant folding
5+input : List (String, String, String)
6+input = [
7+ ("atan2", " 1", " 1"),
8+ ("atan2", "-1", " 1"),
9+ ("atan2", " 1", "-1"),
10+ ("atan2", "-1", "-1"),
11+ ("atan2", " 0", " 1"),
12+ ("atan2", " 1", " 0")
13+]
14+
15+round : Double -> Double
16+round x = let y = x * 1e10
17+ z = if y < 0 then (ceiling y) else (floor y)
18+ in z / 1e10
19+
20+-- the input file is read at runtime so as to prevent the compiler of
21+-- eliding the calls to atan2 via constant folding
22+namespace Main
23+ main : IO ()
24+ main = traverse_ evalInput input
25+ where
26+ evalInput : (String, String, String) -> IO ()
27+ evalInput ("atan2", y, x) = printLn $ round $ atan2 (cast y) (cast x)
28+ evalInput _ = putStrLn $ "Could not eval line"