packages feed

rev-scientific 0.1.0.0 → 0.2.0.0

raw patch · 3 files changed

+32/−6 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

CHANGELOG.md view
@@ -4,4 +4,7 @@  * First version. Released on an unsuspecting world. +## 0.2.0.0 -- 2023-06-22++* Second version. Changed the output order, added documentation. 
Data/ReversedScientific.hs view
@@ -6,7 +6,7 @@ -- Stability   :  Experimental -- Maintainer  :  oleksandr.zhabenko@yahoo.com ----- Provides a function that shows the somewhat "reversed" scientific notation of the big 'Integer' number so that it is easier (more likely exact) to compare at quick glance twe numbers in such a notation by their order and values.+-- Provides a function that shows the somewhat "reversed" scientific notation of the big 'Integer' number so that it is easier (more likely exact) to compare at quick glance two consequent numbers in such a notation by their order and values if they are located in the orderd list.  {-# LANGUAGE NoImplicitPrelude #-} @@ -20,16 +20,39 @@ import Data.List (length,dropWhileEnd)  +-- | Two big positive 'Integer' numbers in the ordered list of them are somewhat \'quickly\' compared by values from left to right. If the number+-- after \"e\" is greater than the other one respectively, the number is also greater than the+-- other. If these values are equal, then the next shown 'Double' values are compared (with the same+-- rule). If they are also equal, then the difference between them can be likely find from the last+-- two values (nevertheless, the numbers can differ if the values here are all pairwise equal! But+-- the numbers are close in values one to another and so can represent just a subtle difference).+-- This notation allows to reduce the difference in the lengths of big numbers in general case and+-- to read the standard scientific notation not from right to left, but in a \'more usual\' way —+-- from left to right. If two numbers have different results of the function, then they are+-- definitely unequal numbers. +--+-- Is intended to be used in the PhLADiPreLiO for big numbers output.+--+-- Example:+--+-- > let a = 58702730574235423475087390582374507304750234705847047403750375034750723045720387502357280345+-- > let b = 58738475082532745724057082370582054703750278402705730573074052705780857034750537507053278+-- > showBignum 7 a == \"e91~5.87...m92~345\"+-- > showBignum 7 b == \'e88~5.87...m89~278\"+--+-- As it is seen from the numbers after \"e\" the first one is greater than the second one.+-- Nevertheless, if you append the three digits 345 to the end of the second one, the output here +-- will be equivalent, but the modified second number will be greater than the first one. showBignum :: Int -> Integer -> String showBignum n x    | l0 < 6 = xShow-  | l >= n = mconcat ["e", show (l - 1), "~m", show l0, "~", k1s, ".", k2s, "...", k3s]+  | l >= n = mconcat ["e", show (l - 1), "~", (c1:"."), k2s, "...m", show l0, "~", k3s]   | otherwise = xShow       where xShow = show x             l = length xShow             k = dropWhileEnd (== '0') xShow              l0 = length k             f (p:q:r:s:t:u:v:vs) = f (p:q:r:t:u:v:vs)-            f (p:q:r:s:t:u:_) = ([p], [q, r], [s, t, u])-            (k1s,k2s,k3s) = f k+            f (p:q:r:s:t:u:_) = (p, [q, r], [s, t, u])+            (c1,k2s,k3s) = f k 
rev-scientific.cabal view
@@ -1,12 +1,12 @@ cabal-version:      2.4 name:               rev-scientific-version:            0.1.0.0+version:            0.2.0.0  -- A short (one-line) description of the package. synopsis:           A library to provide special kind of big numbers writing.   -- A longer description of the package.-description:        Provides a function that shows the somewhat "reversed" scientific notation of the big 'Integer' number so that it is easier (more likely exact) to compare at quick glance two numbers in such a notation by their order and values.+description:        Provides a function that shows the somewhat "reversed" scientific notation of the big 'Integer' number so that it is easier (more likely exact) to compare at quick glance two numbers in such a notation by their order and values in the ordered list of the multiple values.  -- A URL where users can report bugs. -- bug-reports: