Skip to content

Commit

Permalink
refactor into smaller files
Browse files Browse the repository at this point in the history
  • Loading branch information
silky committed May 4, 2021
1 parent b7cc87e commit 8b0e6e6
Show file tree
Hide file tree
Showing 7 changed files with 1,079 additions and 980 deletions.
6 changes: 3 additions & 3 deletions plutus-tx/src/PlutusTx/Sqrt.hs
Expand Up @@ -30,8 +30,8 @@ data Sqrt
= Imaginary
-- | An exact integer result. The 'rsqrt' of 4 is 'Exactly 2'.
| Exactly Integer
-- | The Integer component of a non-integral result. The 'rsqrt 2' is
-- 'Approximately 1'.
-- | The Integer component (i.e. the floor) of a non-integral result. The
-- 'rsqrt 2' is 'Approximately 1'.
| Approximately Integer
deriving stock (Haskell.Show, Haskell.Eq)

Expand All @@ -43,6 +43,7 @@ rsqrt r
| n * d < 0 = Imaginary
| n == 0 = Exactly 0
| n == d = Exactly 1
| n < d = Approximately 0
| n < 0 = rsqrt $ negate n % negate d
| otherwise = go 1 $ 1 + divide n d
where
Expand All @@ -52,7 +53,6 @@ rsqrt r
go l u
| l * l * d == n = Exactly l
| u == (l + 1) = Approximately l
| n < d = Approximately 0
| otherwise =
let
m = divide (l + u) 2
Expand Down
4 changes: 4 additions & 0 deletions plutus-use-cases/plutus-use-cases.cabal
Expand Up @@ -51,6 +51,10 @@ library
Plutus.Contracts.Stablecoin
Plutus.Contracts.Swap
Plutus.Contracts.Uniswap
Plutus.Contracts.Uniswap.Data
Plutus.Contracts.Uniswap.OnChain
Plutus.Contracts.Uniswap.OffChain
Plutus.Contracts.Uniswap.Pool
Plutus.Contracts.Vesting
hs-source-dirs: src
default-language: Haskell2010
Expand Down

0 comments on commit 8b0e6e6

Please sign in to comment.