packages feed

posit 2022.0.1.1 → 2022.0.1.2

raw patch · 4 files changed

+46/−47 lines, 4 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

README.md view
@@ -1,4 +1,4 @@-# posit 2022.0.1.1+# posit 2022.0.1.2  The [Posit Standard 2022](https://posithub.org/docs/posit_standard-2.pdf), and [Posit Standard 3.2](https://posithub.org/docs/posit_standard.pdf), @@ -101,48 +101,47 @@ instances.  -Well, so...-Iron sharpens Iron, or so they say.-So, the implementations might not be perfect, but... they pretty good!+The Elementary Functions for this posit library are implemented natively+using the next larger posit number.  P16 and Posit16 numbers are tested+exhaustively against Double Precision numbers as the orical.  The results+are below:  Number of Accurate Bits `exp`:-![exp](https://github.com/waivio/posit/tree/posit-2022/test/Results/Bits Accuracy of exp with P16 and Posit16.png "Number of Accurate Bits exp")+![numberOfAccurateBits exp](https://github.com/waivio/posit/blob/posit-2022/test/Results/Bits%20Accuracy%20of%20exp%20with%20P16%20and%20Posit16.png)  Number of Accurate Bits `log`:-![log](https://github.com/waivio/posit/tree/posit-2022/test/Results/Bits Accuracy of log with P16 and Posit16.png "Number of Accurate Bits log")+![numberOfAccuarateBits log](https://github.com/waivio/posit/blob/posit-2022/test/Results/Bits%20Accuracy%20of%20log%20with%20P16%20and%20Posit16.png)  Number of Accurate Bits `sqrt`:-![sqrt](https://github.com/waivio/posit/tree/posit-2022/test/Results/Bits Accuracy of sqrt with P16 and Posit16.png "Number of Accurate Bits sqrt")+![numberOfAccuarateBits sqrt](https://github.com/waivio/posit/blob/posit-2022/test/Results/Bits%20Accuracy%20of%20sqrt%20with%20P16%20and%20Posit16.png)  Number of Accurate Bits `sin`:-![sin](https://github.com/waivio/posit/tree/posit-2022/test/Results/Bits Accuracy of sin with P16 and Posit16.png "Number of Accurate Bits sin")+![numberOfAccuarateBits sin](https://github.com/waivio/posit/blob/posit-2022/test/Results/Bits%20Accuracy%20of%20sin%20with%20P16%20and%20Posit16.png)  Number of Accurate Bits `cos`:-![cos](https://github.com/waivio/posit/tree/posit-2022/test/Results/Bits Accuracy of cos with P16 and Posit16.png "Number of Accurate Bits cos")+![numberOfAccuarateBits cos](https://github.com/waivio/posit/blob/posit-2022/test/Results/Bits%20Accuracy%20of%20cos%20with%20P16%20and%20Posit16.png)  Number of Accurate Bits `asin`:-![asin](https://github.com/waivio/posit/tree/posit-2022/test/Results/Bits Accuracy of asin with P16 and Posit16.png "Number of Accurate Bits asin")+![numberOfAccuarateBits asin](https://github.com/waivio/posit/blob/posit-2022/test/Results/Bits%20Accuracy%20of%20asin%20with%20P16%20and%20Posit16.png)  Number of Accurate Bits `acos`:-![acos](https://github.com/waivio/posit/tree/posit-2022/test/Results/Bits Accuracy of acos with P16 and Posit16.png "Number of Accurate Bits acos")+![numberOfAccuarateBits acos](https://github.com/waivio/posit/blob/posit-2022/test/Results/Bits%20Accuracy%20of%20acos%20with%20P16%20and%20Posit16.png)  Number of Accurate Bits `atan`:-![atan](https://github.com/waivio/posit/tree/posit-2022/test/Results/Bits Accuracy of atan with P16 and Posit16.png "Number of Accurate Bits atan")+![numberOfAccuarateBits atan](https://github.com/waivio/posit/blob/posit-2022/test/Results/Bits%20Accuracy%20of%20atan%20with%20P16%20and%20Posit16.png)  Number of Accurate Bits `sinh`:-![sinh](https://github.com/waivio/posit/tree/posit-2022/test/Results/Bits Accuracy of sinh with P16 and Posit16.png "Number of Accurate Bits sinh")+![numberOfAccuarateBits sinh](https://github.com/waivio/posit/blob/posit-2022/test/Results/Bits%20Accuracy%20of%20sinh%20with%20P16%20and%20Posit16.png)  Number of Accurate Bits `cosh`:-![cosh](https://github.com/waivio/posit/tree/posit-2022/test/Results/Bits Accuracy of cosh with P16 and Posit16.png "Number of Accurate Bits cosh")+![numberOfAccuarateBits cosh](https://github.com/waivio/posit/blob/posit-2022/test/Results/Bits%20Accuracy%20of%20cosh%20with%20P16%20and%20Posit16.png)  Number of Accurate Bits `asinh`:-![asinh](https://github.com/waivio/posit/tree/posit-2022/test/Results/Bits Accuracy of asinh with P16 and Posit16.png "Number of Accurate Bits asinh")+![numberOfAccuarateBits asinh](https://github.com/waivio/posit/blob/posit-2022/test/Results/Bits%20Accuracy%20of%20asinh%20with%20P16%20and%20Posit16.png)  Number of Accurate Bits `acosh`:-![acosh](https://github.com/waivio/posit/tree/posit-2022/test/Results/Bits Accuracy of acosh with P16 and Posit16.png "Number of Accurate Bits acosh")+![numberOfAccuarateBits acosh](https://github.com/waivio/posit/blob/posit-2022/test/Results/Bits%20Accuracy%20of%20acosh%20with%20P16%20and%20Posit16.png)  Number of Accurate Bits `atanh`:-![atanh](https://github.com/waivio/posit/tree/posit-2022/test/Results/Bits Accuracy of atanh with P16 and Posit16.png "Number of Accurate Bits atanh")--+![numberOfAccuarateBits atanh](https://github.com/waivio/posit/blob/posit-2022/test/Results/Bits%20Accuracy%20of%20atanh%20with%20P16%20and%20Posit16.png) 
posit.cabal view
@@ -1,7 +1,7 @@ cabal-version: 1.12  name:           posit-version:        2022.0.1.1+version:        2022.0.1.2 description:    The Posit Number format attempting to conform to the Posit Standard Versions 3.2 and 2022.  Where Real numbers are approximated by `Maybe Rational` and sampled in a similar way to the projective real line. homepage:       https://github.com/waivio/posit#readme bug-reports:    https://github.com/waivio/posit/issues
stack.yaml view
@@ -1,7 +1,7 @@ # This file is attempting to maintain the working Liquid Haskell versions # that coorispond to a specific GHC or Stackage version -# resolver: nightly-2023-05-20  # ghc-9.4.5+# resolver: nightly-2023-06-19  # ghc-9.4.5 resolver: lts-20.26 # ghc-9.2.8 # resolver: lts-19.33 # ghc-9.0.2 # resolver: lts-18.28 # ghc-8.10.7@@ -16,8 +16,8 @@   - Chart-cairo-1.9.3   - cairo-0.13.10.0   # For LiquidHaskell:-  - hashable-1.3.5.0 # lts-20.16 and below-  # - hashable-1.4.2.0 # ghc-9.4.4+  # - hashable-1.3.5.0 # lts-20.16 and below+  - hashable-1.4.2.0 # ghc-9.4.4   - text-format-0.3.2   - Diff-0.3.4   - optparse-applicative-0.16.1.0
test/TestElementaryFunctions.hs view
@@ -16,6 +16,7 @@ main :: IO () main = do expPlotP16Posit16           logPlotP16Posit16+          sqrtPlotsP16Posit16           sinPlotsP16Posit16           cosPlotsP16Posit16           asinPlotsP16Posit16@@ -26,23 +27,8 @@           asinhPlotsP16Posit16           acoshPlotsP16Posit16           atanhPlotsP16Posit16-          sqrtPlotsP16Posit16 -- -sinPlotsP16Posit16 = toFile def "./test/Results/Bits Accuracy of sin with P16 and Posit16.png" $ do-    let sineP16 = filter (\(_,d) -> not $ nanOrInf d) [(read (displayIntegral p) :: Double, err p (sin p) sin) | p <- enumFrom (NaR :: P16)]-        sinePosit16 = filter (\(_,d) -> not $ nanOrInf d) [(read (displayIntegral p) :: Double, err p (sin p) sin) | p <- enumFrom (NaR :: Posit16)]-    layout_title .= "Number of Accurate Bits of P16 and Posit16 Sine"-    plot (line "sin P16 error" [sineP16])-    plot (line "sin Posit16 error" [sinePosit16])--cosPlotsP16Posit16 = toFile def "./test/Results/Bits Accuracy of cos with P16 and Posit16.png" $ do-    let cosineP16 = filter (\(_,d) -> not $ nanOrInf d) [(read (displayIntegral p) :: Double, err p (cos p) cos) | p <- enumFrom (NaR :: P16)]-        cosinePosit16 = filter (\(_,d) -> not $ nanOrInf d) [(read (displayIntegral p) :: Double, err p (cos p) cos) | p <- enumFrom (NaR :: Posit16)]-    layout_title .= "Number of Accurate Bits of P16 and Posit16 Cosine"-    plot (line "cos P16 error" [cosineP16])-    plot (line "cos Posit16 error" [cosinePosit16])- expPlotP16Posit16 = toFile def "./test/Results/Bits Accuracy of exp with P16 and Posit16.png" $ do     let expP16 = filter (\(_,d) -> not $ nanOrInf d) [(read (displayIntegral p) :: Double, err p (exp p) exp) | p <- enumFrom (NaR :: P16)]         expPosit16 = filter (\(_,d) -> not $ nanOrInf d) [(read (displayIntegral p) :: Double, err p (exp p) exp) | p <- enumFrom (NaR :: Posit16)]@@ -57,6 +43,27 @@     plot (line "log P16 error" [lnP16])     plot (line "log Posit16 error" [lnPosit16]) +sqrtPlotsP16Posit16 = toFile def "./test/Results/Bits Accuracy of sqrt with P16 and Posit16.png" $ do+    let sqrtP16 = filter (\(_,d) -> not $ nanOrInf d) [(read (displayIntegral p) :: Double, err p (sqrt p) sqrt) | p <- enumFrom (0 :: P16)]+        sqrtPosit16 = filter (\(_,d) -> not $ nanOrInf d) [(read (displayIntegral p) :: Double, err p (sqrt p) sqrt) | p <- enumFrom (0 :: Posit16)]+    layout_title .= "Number of Accurate Bits of P16 and Posit16 Square Root"+    plot (line "sqrt P16 error" [sqrtP16])+    plot (line "sqrt Posit16 error" [sqrtPosit16])++sinPlotsP16Posit16 = toFile def "./test/Results/Bits Accuracy of sin with P16 and Posit16.png" $ do+    let sineP16 = filter (\(_,d) -> not $ nanOrInf d) [(read (displayIntegral p) :: Double, err p (sin p) sin) | p <- enumFrom (NaR :: P16)]+        sinePosit16 = filter (\(_,d) -> not $ nanOrInf d) [(read (displayIntegral p) :: Double, err p (sin p) sin) | p <- enumFrom (NaR :: Posit16)]+    layout_title .= "Number of Accurate Bits of P16 and Posit16 Sine"+    plot (line "sin P16 error" [sineP16])+    plot (line "sin Posit16 error" [sinePosit16])++cosPlotsP16Posit16 = toFile def "./test/Results/Bits Accuracy of cos with P16 and Posit16.png" $ do+    let cosineP16 = filter (\(_,d) -> not $ nanOrInf d) [(read (displayIntegral p) :: Double, err p (cos p) cos) | p <- enumFrom (NaR :: P16)]+        cosinePosit16 = filter (\(_,d) -> not $ nanOrInf d) [(read (displayIntegral p) :: Double, err p (cos p) cos) | p <- enumFrom (NaR :: Posit16)]+    layout_title .= "Number of Accurate Bits of P16 and Posit16 Cosine"+    plot (line "cos P16 error" [cosineP16])+    plot (line "cos Posit16 error" [cosinePosit16])+ asinPlotsP16Posit16 = toFile def "./test/Results/Bits Accuracy of asin with P16 and Posit16.png" $ do     let arcsineP16 = filter (\(_,d) -> not $ nanOrInf d) [(read (displayIntegral p) :: Double, err p (asin p) sin) | p <- enumFromTo (-1 :: P16) 1]         arcsinePosit16 = filter (\(_,d) -> not $ nanOrInf d) [(read (displayIntegral p) :: Double, err p (asin p) sin) | p <- enumFromTo (-1 :: Posit16) 1]@@ -99,10 +106,10 @@     plot (line "asinh P16 error" [archypsineP16])     plot (line "asinh Posit16 error" [archypsinePosit16]) -acoshPlotsP16Posit16 = toFile def "./test/Results/Bits Accuracy of cosh with P16 and Posit16.png" $ do+acoshPlotsP16Posit16 = toFile def "./test/Results/Bits Accuracy of acosh with P16 and Posit16.png" $ do     let archypcosineP16 = filter (\(_,d) -> not $ nanOrInf d) [(read (displayIntegral p) :: Double, err p (acosh p) acosh) | p <- enumFrom (NaR :: P16)]         archypcosinePosit16 = filter (\(_,d) -> not $ nanOrInf d) [(read (displayIntegral p) :: Double, err p (acosh p) acosh) | p <- enumFrom (NaR :: Posit16)]-    layout_title .= "Number of Accurate Bits of P16 and Posit16 Hyperbolic Cosine"+    layout_title .= "Number of Accurate Bits of P16 and Posit16 Inv Hyperbolic Cosine"     plot (line "acosh P16 error" [archypcosineP16])     plot (line "acosh Posit16 error" [archypcosinePosit16]) @@ -112,13 +119,6 @@     layout_title .= "Number of Accurate Bits of P16 and Posit16 Inv Hyperbolic Tangent"     plot (line "atanh P16 error" [archyptangentP16])     plot (line "atanh Posit16 error" [archyptangentPosit16])--sqrtPlotsP16Posit16 = toFile def "./test/Results/Bits Accuracy of sqrt with P16 and Posit16.png" $ do-    let sqrtP16 = filter (\(_,d) -> not $ nanOrInf d) [(read (displayIntegral p) :: Double, err p (sqrt p) sqrt) | p <- enumFrom (0 :: P16)]-        sqrtPosit16 = filter (\(_,d) -> not $ nanOrInf d) [(read (displayIntegral p) :: Double, err p (sqrt p) sqrt) | p <- enumFrom (0 :: Posit16)]-    layout_title .= "Number of Accurate Bits of P16 and Posit16 Square Root"-    plot (line "sqrt P16 error" [sqrtP16])-    plot (line "sqrt Posit16 error" [sqrtPosit16])