úÎ4r1*     (c) Edward Kmett 2013-2015BSD3Edward Kmett <ekmett@gmail.com> experimental non-portable Trustworthy*+357>GLN¤This provides a numeric data type with effectively doubled precision by using Knuth's error free transform and a number of custom compensated arithmetic circuits.@This construction can be iterated, doubling precision each time.Rround (Prelude.product [2..100] :: Compensated (Compensated (Compensated Double)))ž93326215443944152681699238856266700490715968264381621468592963895217599993229915608941463976156518286253697920827223758251185210916864000000000000000000000000Prelude.product [2..100]ž93326215443944152681699238856266700490715968264381621468592963895217599993229915608941463976156518286253697920827223758251185210916864000000000000000000000000This extracts both the  and  components of a  number.Used internally to construct + values that satisfy our residual contract.When in doubt, use  a b  instead of  a bThis  number is used to  Z the significand in half, so we can multiply them separately without losing precision in . a b k computes k x y such that x + y = a + b x = fl(a + b)Which is to say that x is the floating point image of (a + b) and y stores the residual error term. a b k computes k x y such that x + y = a + b x = fl(a + b)#but only under the assumption that  a   b. If you aren't sure, use .Which is to say that x is the floating point image of (a + b) and y stores the residual error term. a b k computes k x y such that x + y = a * b x = fl(a * b)Which is to say that x is the floating point image of (a * b) and y stores the residual error term.FThis could be nicer if we had access to a hardware fused multiply-add."Priest's renormalization algorithm renorm a b c generates a  number assuming a  b  c.   a k computes k x y such that x + y = a * a x = fl(a * a)Which is to say that x is the floating point image of (a * a) and y stores the residual error term. 0Calculate a fast square of a compensated number. ;error-free split of a floating point number into two parts.%Note: these parts do not satisfy the  contract :Calculate a scalar + compensated sum with Kahan summation.Compute a *  ayThis provides the isomorphism between the compact representation we store these in internally and the naive pair of the  and  components.This  lets us edit the  directly, leaving the  untouched.This  lets us edit the  directly, leaving the  untouched. Extract the  component of a 8 value, when and if compensation is no longer required.$Perform Kahan summation over a list.TODO: do this right!NB:( Experimental and partially implemented.”Other than sqrt, the accuracy of these is basically uncalculated! In fact many of these are known to be wrong! Patches and improvements are welcome.=   !"#$%&'()*+,-./0123456789:;<=>?    1   !"#$%&'()*+,-./0123456789;:=<?>@      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHcompe_LWjf2D0FGK17ESVqezBMgHNumeric.CompensatedOvercompensated Compensable Compensatedwith compensatedmagicaddfaddtimesdividesquaredsquaresplit+^*^ _Compensatedprimalresidual uncompensatedkahanbaseGHC.Numabsghc-prim GHC.Classes>=renormlens_H6cwX6oRUn2AjsBgQFn70sControl.Lens.TypeLens$fPreciseCompensated$fFloatingCompensated V_CompensatedMV_CompensatedCCCFCDcompensatedConstrcompensatedDataType$fVectorVectorCompensated$fMVectorMVectorCompensatedTFCo:R:VectorCompensatedTFCo:R:MVectorsCompensated$fStorableCompensated$fSafeCopyCompensated$fSerialCompensated$fSerializeCompensated$fBinaryCompensated$fRealFracCompensated$fRealCompensated$fFractionalCompensated$fEnumCompensated$fNumCompensated$fMonoidCompensated$fSemigroupCompensated$fOrdCompensated$fEqCompensated$fEachCompensatedCompensatedabTFCo:R:IndexCompensated$fReadCompensated$fShowCompensated$fNFDataCompensated$fDataCompensated$fHashableCompensatedTFCo:R:CompensatedCompensated$fCompensableCompensatedTFCo:R:CompensatedFloat$fCompensableFloatTFCo:R:CompensatedDouble$fCompensableDouble