File tree Expand file tree Collapse file tree 19 files changed +110
-24
lines changed
Expand file tree Collapse file tree 19 files changed +110
-24
lines changed Original file line number Diff line number Diff line change 11module GHC.Float (module Exports ) where
22
3+ import GHC.Types
4+ import GHC.Real
35import "base" GHC.Float as Exports
Original file line number Diff line number Diff line change 1+ module spec GHC . Float where
2+
3+ import GHC . Types
4+
5+ class ( GHC . Real . Fractional a ) = > GHC . Float . Floating a where
6+ GHC . Float . pi :: a
7+ GHC . Float . exp :: a -> { y :a | y > 0 }
8+ GHC . Float . log :: { x :a | x > 0 } -> a
9+ GHC . Float . sqrt :: { x :a | x >= 0 } -> { y :a | y >= 0 }
10+ ( GHC . Float . **) :: x :a -> { y :a | x = 0 => y >= 0 } -> a
11+ GHC . Float . logBase :: { b :a | b > 0 && b /= 1 } -> { x :a | x > 0 } -> a
12+ GHC . Float . sin :: a -> { y :a | -1 <= y && y <= 1 }
13+ GHC . Float . cos :: a -> { y :a | -1 <= y && y <= 1 }
14+ GHC . Float . tan :: a -> a
15+ GHC . Float . asin :: { x :a | -1 <= x && x <= 1 } -> a
16+ GHC . Float . acos :: { x :a | -1 <= x && x <= 1 } -> a
17+ GHC . Float . atan :: a -> a
18+ GHC . Float . sinh :: a -> a
19+ GHC . Float . cosh :: a -> { y :a | y >= 1 }
20+ GHC . Float . tanh :: a -> { y :a | -1 < y && y < 1 }
21+ GHC . Float . asinh :: a -> a
22+ GHC . Float . acosh :: { y :a | y >= 1 } -> a
23+ GHC . Float . atanh :: { y :a | -1 < y && y < 1 } -> a
24+ GHC . Float . log1p :: a -> a
25+ GHC . Float . expm1 :: a -> a
26+ GHC . Float . log1pexp :: a -> a
27+ GHC . Float . log1mexp :: a -> a
Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ import GHC.List
1212import GHC.Maybe
1313import GHC.Num
1414import GHC.Real
15+ import GHC.Float
1516import GHC.Types
1617import GHC.Word
1718
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ import GHC.List
66import GHC .Maybe
77import GHC .Num
88import GHC .Real
9+ import GHC .Float
910import GHC .Word
1011
1112import Data .Foldable
Original file line number Diff line number Diff line change @@ -183,28 +183,6 @@ part1 _ = do
183183 let allRounds2 = iterate {- (Main.round 8 3 m2) -} id input in
184184 print $ allRounds2 !! 20
185185
186- part2 :: () -> IO ()
187- part2 _ = do
188- putStrLn " Part 2"
189- let m1 = computeModulus example in do
190- putStrLn $ " Working mod " ++ show m1
191- let allRounds = iterate {- (Main.round 4 1 m1) -} id example in do
192- print $ allRounds !! 1000
193- print $ allRounds !! 2000
194- print $ allRounds !! 3000
195- print $ allRounds !! 4000
196- print $ allRounds !! 5000
197- print $ allRounds !! 6000
198- print $ allRounds !! 7000
199- print $ allRounds !! 8000
200- print $ allRounds !! 9000
201- print $ allRounds !! 10000
202-
203- let m2 = computeModulus input in do
204- putStrLn $ " Working mod " ++ show m2
205- let allRounds2 = iterate {- (Main.round 8 1 m2) -} id input in
206- print $ allRounds2 !! 10000
207-
208186mymain :: IO ()
209- mymain = part1 () >> part2 ()
187+ mymain = part1 ()
210188
Original file line number Diff line number Diff line change 1+ {-@ LIQUID " --expect-error-containing=CosNegTest.hs:6:1" @- }
2+ module CosNegTest where
3+
4+ {- @ test :: a -> {x:a | x > 1} @-}
5+ test :: Floating a => a -> a
6+ test x = cos x
Original file line number Diff line number Diff line change 1+ {-@ LIQUID " --expect-error-containing=ExpNegTest.hs:6:1" @- }
2+ module ExpNegTest where
3+
4+ {- @ test :: a -> {x:a | x <= 0} @-}
5+ test :: Floating a => a -> a
6+ test x = exp x
Original file line number Diff line number Diff line change 1+ {-@ LIQUID " --expect-error-containing=ExponentiationNegTest.hs:5:1" @- }
2+ module ExponentiationNegTest where
3+
4+ test :: Floating a => a
5+ test = 0 ** (- 1 )
Original file line number Diff line number Diff line change 1+ {-@ LIQUID " --expect-error-containing=LogNegTest.hs:5:1" @- }
2+ module LogNegTest where
3+
4+ test :: Floating a => a
5+ test = log 0
Original file line number Diff line number Diff line change 1+ {-@ LIQUID " --expect-error-containing=SinNegTest.hs:6:1" @- }
2+ module SinNegTest where
3+
4+ {- @ test :: a -> {x:a | x > 1} @-}
5+ test :: Floating a => a -> a
6+ test x = sin x
You can’t perform that action at this time.
0 commit comments