Îõ³h&'a%ÅÐ      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNO Safe-Inferred";Ô×Üñ%92formatn+Wrapper for the various formatting options.defaultFormatNôFormatN {fstyle = FSCommaPrec, sigFigs = Just 2, maxDistinguishIterations = 4, addLPad = True, cutRightZeros = True}formatnÃData type representing styles of formatting dependent on the numberformatn+Data type representing styles of formattingformatn 1000 1 0.001formatn 1e3 1e0 1e-3formatn 1,000 1 0.001formatn  00 1.00 0.00formatn100,000% 100% 0.1%formatn$1,000 $1 $0.001formatnSign componentformatnéDecomposition of a Double into the components that are needed to determine significant figure formatting.ÈEliding type changes, the relationship between a Double and a SigFig is:) x == sign * figures * 10^{exponent} formatnsignformatn+significant figures expressed as an Integerformatn'the power of 10 exponent given figures. formatn¯Note that zero can still be represented in a SigFig way, so that we can distinguish between something that starts off as zero, and something that ends up as zero via rounding. isZero (SigFig SigFigPos 0 (-3))True!formatnconvert from a Double to a toSigFig (Just 2) 1234;SigFig {sfSign = SigFigPos, sfFigures = 12, sfExponent = 2} ïtoSigFig Nothing . fromSigFig <==> id toSigFig (Just x) . fromSigFig . toSigFig (Just x) <==> toSigFig (Just x)¯\x -> let (SigFig s fs e) = toSigFig Nothing x in let x' = ((if (s==SigFigNeg) then (-1.0) else 1.0) * fromIntegral fs * 10.0**fromIntegral e) in (x==0 || abs (x/x'-1) < 1e-6)ÔChecks for a valid number of significant figures and turns it off on a silly number.toSigFig Nothing 1234=SigFig {sfSign = SigFigPos, sfFigures = 1234, sfExponent = 0}toSigFig (Just (-3)) 1234=SigFig {sfSign = SigFigPos, sfFigures = 1234, sfExponent = 0}"formatnconvert from a  to a Double"fromSigFig (SigFig SigFigPos 12 2)1200.0#formatnincrease significant figures"incSigFig 1 (SigFig SigFigPos 1 0) [0,5e6,1e7,2e7]Ñ[CommaStyle,ExponentStyle (Just 6),ExponentStyle (Just 7),ExponentStyle (Just 7)],majorityStyle commaPrecStyle [0,5e6,1e7,2e7]ExponentStyle (Just 7)6formatnÂformat a number according to a FormatStyle and significant figuresformat CommaStyle (Just 2) 1234"1,200"7formatn$format a SigFig according to a style,formatSF CommaStyle (toSigFig (Just 2) 1234)"1,200"*formatSF CommaStyle (SigFig SigFigPos 0 1)"0"-formatSF CommaStyle (SigFig SigFigPos 0 (-1))"0.0"8formatnÞFormat between 0.001 and 1000000 using decimal style and exponential style outside this range.prec (Just 2) 0.00234"0.0023"prec (Just 2) 0.000023"2.3e-5"prec (Just 2) 123"120"prec (Just 2) 123456"120000"prec (Just 2) 1234567"1.2e6"9formatnäFormat using comma separators for numbers above 1,000 but below 1 million, otherwise use prec style.commaPrec (Just 3) 1234"1,230"commaPrec (Just 3) 1234567"1.23e6":formatnåConsistently format a list of numbers,using the minimum number of decimal places or minimum exponent.0formats True True precStyle (Just 1) [0,0.5,1,2]["0.0","0.5","1.0","2.0"]àNote how the presence of 0.5 in the example above changes the format of all numbers. Without it:,formats True True precStyle (Just 1) [0,1,2] ["0","1","2"]?formats False True precStyle (Just 1) $ ((-1)*) <$> [0,0.5,1,2]["0.0","-0.5","-1.0","-2.0"]Æformats True True commaPrecStyle (Just 1) $ ((-1000)*) <$> [0,0.5,1,2]%[" 0"," -500","-1,000","-2,000"]Äformats True True commaPrecStyle (Just 1) $ ((1e6)*) <$> [0,0.5,1,2]1[" 0"," 500,000","1,000,000","2,000,000"]Âformats True True commaPrecStyle (Just 1) $ ((1e6)*) <$> [0.9,2,3]["0.9e6","2.0e6","3.0e6"]Åformats True True commaPrecStyle (Just 1) $ ((1e-6)*) <$> [0,0.5,1,2]%["0.0e-6","0.5e-6","1.0e-6","2.0e-6"]Åformats True True commaPrecStyle (Just 1) $ ((1e-3)*) <$> [0,0.5,1,2]%["0.0000","0.0005","0.0010","0.0020"]Âformats True False (const (ExponentStyle Nothing)) (Just 2) [0..4])["0.0e0","1.0e0","2.0e0","3.0e0","4.0e0"]Áformats True True (const (ExponentStyle Nothing)) (Just 2) [0..4]["0e0","1e0","2e0","3e0","4e0"];formatn*Consistently convert a list of numbers to 2s, using the minimum natural exponent of the list.<formatnŸDecrease the SigFig figure of a list of SigFigs without loss of precision, if possible. This has the effect of removing right zeros in decimal representations.=formatnÚAdd spaces to the left of a text representation so that all elements have the same length.>formatnÑProvide formatted text for a list of numbers so that they are just distinguished. For example, %distinguish 4 commaPrecStyle (Just 2)œ means use as much significant figures as is needed for the numbers to be distinguished on rendering (up to 4+2=6), but with at least 2 significant figures. The difference between this and : can be seen in these examples:Áformats True True commaPrecStyle (Just 2) [0,1,1.01,1.02,1.1,1.2]%["0.0","1.0","1.0","1.0","1.1","1.2"]Çdistinguish 4 True True commaPrecStyle (Just 2) [0,1,1.01,1.02,1.1,1.2]+["0.00","1.00","1.01","1.02","1.10","1.20"]œA common occurence is that significant figures being increased to enable textual uniqueness results in excess right zeros (after a decimal place). Consider:>formats True False commaPrecStyle (Just 1) [0, 0.5, 1, 1.5, 2]["0.0","0.5","1.0","2.0","2.0"]öNote that formats seeks With 1.5 rounding up to 2, the distinguish algorithm will increase the number of sigfigs to 2:Ädistinguish 4 True False commaPrecStyle (Just 1) [0, 0.5, 1, 1.5, 2]$["0.00","0.50","1.00","1.50","2.00"]ãThe format can be simplified further by removing the excess right zeros from each formatted number:Ãdistinguish 4 True True commaPrecStyle (Just 2) [0, 0.5, 1, 1.5, 2]["0.0","0.5","1.0","1.5","2.0"]?formatnThe official FormatN@formatnrun a formatN defaultFormatN 1234"1,200"Aformatn0Consistently format a list of numbers via using >./formatNs defaultFormatN [0,1,1.01,1.02,1.1,1.2]+["0.00","1.00","1.01","1.02","1.10","1.20"]Bformatn,Format with the shorter of show and a style.(format (ExponentStyle Nothing) Nothing 0"0e0".formatOrShow (ExponentStyle Nothing) Nothing 0"0":formatn#left pad to the largest text lengthformatn&Try and reduce excess right-hand zerosformatnstyleformatnsignificant figures requestedformatnlist of numbers;formatnsignificant figures requestedformatnlist of numbersQformatn#left pad to the largest text lengthformatnstyleformatnlist of numbers>formatnmaximum number of iterationsformatn#left pad to the largest text lengthformatn%try and reduce excess right zero padsformatnstyleformatnsignificant figures requestedformatnlist of numbersà  !"#$%&'()*+,-./0123456789:;<=>?@ABÃ!" #$34 %&')(+*76B,-./809215:;<=>?@AÒ      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQÒ$formatn-0.3.0-45vIxLEeX1IGfqvwxYFebf Data.FormatNFormatNfstylesigFigsmaxDistinguishIterationsaddLPad cutRightZerosFStyle FSDecimal FSExponentFSCommaFSFixed FSPercentFSDollarFSPrec FSCommaPrecFSNone FormatStyle DecimalStyle ExponentStyle CommaStyle FixedStyle PercentStyle DollarStyle SigFigSign SigFigNeg SigFigPosSigFigsfSign sfFigures sfExponentisZerotoSigFig fromSigFig incSigFig decSigFigfixedSFexptSF exptSFWithcommaSF decimalSF percentSFdollarSFfixedexptexptWithdecimalcommapercentdollar precStylecommaPrecStyle majorityStyleformatformatSFprec commaPrecformats formatsSF decSigFigslpads distinguishdefaultFormatNformatNformatNs formatOrShow $fEqFormatN $fShowFormatN$fGenericFormatN $fShowFStyle $fEqFStyle $fOrdFStyle$fShowFormatStyle$fEqFormatStyle$fOrdFormatStyle $fEqSigFig $fShowSigFig$fEqSigFigSign$fShowSigFigSign maybeCommaSF formatsFromSF