-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Directed rounding for built-in floating types -- -- Please see the README on GitHub at -- https://github.com/minoki/haskell-floating-point/tree/master/rounded-hw#readme @package rounded-hw @version 0.2.0 module Numeric.Rounded.Hardware.Backend.ViaRational newtype ViaRational a ViaRational :: a -> ViaRational a instance Foreign.Storable.Storable a => Foreign.Storable.Storable (Numeric.Rounded.Hardware.Backend.ViaRational.ViaRational a) instance GHC.Num.Num a => GHC.Num.Num (Numeric.Rounded.Hardware.Backend.ViaRational.ViaRational a) instance GHC.Generics.Generic (Numeric.Rounded.Hardware.Backend.ViaRational.ViaRational a) instance GHC.Show.Show a => GHC.Show.Show (Numeric.Rounded.Hardware.Backend.ViaRational.ViaRational a) instance GHC.Classes.Ord a => GHC.Classes.Ord (Numeric.Rounded.Hardware.Backend.ViaRational.ViaRational a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Numeric.Rounded.Hardware.Backend.ViaRational.ViaRational a) instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Numeric.Rounded.Hardware.Backend.ViaRational.ViaRational a) instance (GHC.Float.RealFloat a, GHC.Num.Num a, Numeric.Rounded.Hardware.Internal.Constants.RealFloatConstants a) => Numeric.Rounded.Hardware.Internal.Class.RoundedRing (Numeric.Rounded.Hardware.Backend.ViaRational.ViaRational a) instance (GHC.Float.RealFloat a, GHC.Num.Num a, Numeric.Rounded.Hardware.Internal.Constants.RealFloatConstants a) => Numeric.Rounded.Hardware.Internal.Class.RoundedFractional (Numeric.Rounded.Hardware.Backend.ViaRational.ViaRational a) instance (GHC.Float.RealFloat a, Numeric.Rounded.Hardware.Internal.Constants.RealFloatConstants a) => Numeric.Rounded.Hardware.Internal.Class.RoundedSqrt (Numeric.Rounded.Hardware.Backend.ViaRational.ViaRational a) instance (GHC.Float.RealFloat a, Numeric.Rounded.Hardware.Internal.Constants.RealFloatConstants a, Foreign.Storable.Storable a) => Numeric.Rounded.Hardware.Internal.Class.RoundedRing_Vector Data.Vector.Storable.Vector (Numeric.Rounded.Hardware.Backend.ViaRational.ViaRational a) instance (GHC.Float.RealFloat a, Numeric.Rounded.Hardware.Internal.Constants.RealFloatConstants a, Foreign.Storable.Storable a) => Numeric.Rounded.Hardware.Internal.Class.RoundedFractional_Vector Data.Vector.Storable.Vector (Numeric.Rounded.Hardware.Backend.ViaRational.ViaRational a) instance (GHC.Float.RealFloat a, Numeric.Rounded.Hardware.Internal.Constants.RealFloatConstants a, Foreign.Storable.Storable a) => Numeric.Rounded.Hardware.Internal.Class.RoundedSqrt_Vector Data.Vector.Storable.Vector (Numeric.Rounded.Hardware.Backend.ViaRational.ViaRational a) instance (GHC.Float.RealFloat a, Numeric.Rounded.Hardware.Internal.Constants.RealFloatConstants a, Data.Vector.Unboxed.Base.Unbox a) => Numeric.Rounded.Hardware.Internal.Class.RoundedRing_Vector Data.Vector.Unboxed.Base.Vector (Numeric.Rounded.Hardware.Backend.ViaRational.ViaRational a) instance (GHC.Float.RealFloat a, Numeric.Rounded.Hardware.Internal.Constants.RealFloatConstants a, Data.Vector.Unboxed.Base.Unbox a) => Numeric.Rounded.Hardware.Internal.Class.RoundedFractional_Vector Data.Vector.Unboxed.Base.Vector (Numeric.Rounded.Hardware.Backend.ViaRational.ViaRational a) instance (GHC.Float.RealFloat a, Numeric.Rounded.Hardware.Internal.Constants.RealFloatConstants a, Data.Vector.Unboxed.Base.Unbox a) => Numeric.Rounded.Hardware.Internal.Class.RoundedSqrt_Vector Data.Vector.Unboxed.Base.Vector (Numeric.Rounded.Hardware.Backend.ViaRational.ViaRational a) instance Data.Vector.Unboxed.Base.Unbox a => Data.Vector.Generic.Mutable.Base.MVector Data.Vector.Unboxed.Base.MVector (Numeric.Rounded.Hardware.Backend.ViaRational.ViaRational a) instance Data.Vector.Unboxed.Base.Unbox a => Data.Vector.Generic.Base.Vector Data.Vector.Unboxed.Base.Vector (Numeric.Rounded.Hardware.Backend.ViaRational.ViaRational a) instance Data.Vector.Unboxed.Base.Unbox a => Data.Vector.Unboxed.Base.Unbox (Numeric.Rounded.Hardware.Backend.ViaRational.ViaRational a) -- | The types in this module implements rounding-mode-controlled -- operations in C. -- -- There are several ways to control rounding mode in C, and an -- appropriate technology will be selected at compile time. This library -- implements the following options: -- --
-- >>> binaryFloatToDecimalDigitsRn ToNearest 3 (0.125 :: Double) -- ([1,2,5],0) -- -- >>> binaryFloatToDecimalDigitsRn ToNearest 3 (12.5 :: Double) -- ([1,2,5],2) --binaryFloatToDecimalDigitsRn :: forall a. RealFloat a => RoundingMode -> Int -> a -> ([Int], Int) -- |
-- >>> binaryFloatToFixedDecimalDigitsRn ToNearest 3 (0.125 :: Double) -- [1,2,5] -- -- >>> binaryFloatToFixedDecimalDigitsRn ToNearest 3 (12.5 :: Double) -- [1,2,5,0,0] --binaryFloatToFixedDecimalDigitsRn :: forall a. RealFloat a => RoundingMode -> Int -> a -> [Int] -- |
-- >>> binaryFloatToDecimalDigits (0.125 :: Double) -- ([1,2,5],0) -- -- >>> binaryFloatToDecimalDigits (12.5 :: Double) -- ([1,2,5],2) --binaryFloatToDecimalDigits :: RealFloat a => a -> ([Int], Int) -- |
-- >>> showEFloatRn ToNearest (Just 0) (0 :: Double) "" -- "0e0" -- -- >>> showEFloatRn ToNearest Nothing (0 :: Double) "" -- "0.0e0" -- -- >>> showEFloatRn ToNearest Nothing (0.5 :: Double) "" -- "5.0e-1" --showEFloatRn :: RealFloat a => RoundingMode -> Maybe Int -> a -> ShowS -- |
-- >>> showFFloatRn ToNearest (Just 0) (0 :: Double) "" -- "0" -- -- >>> showFFloatRn ToNearest Nothing (0 :: Double) "" -- "0.0" -- -- >>> showFFloatRn ToNearest Nothing (-0 :: Double) "" -- "-0.0" -- -- >>> showFFloatRn ToNearest Nothing (-0.5 :: Double) "" -- "-0.5" --showFFloatRn :: RealFloat a => RoundingMode -> Maybe Int -> a -> ShowS showGFloatRn :: RealFloat a => RoundingMode -> Maybe Int -> a -> ShowS -- | The type for IEEE754 rounding-direction attributes. data RoundingMode -- | Round to the nearest value (IEEE754 roundTiesToEven) ToNearest :: RoundingMode -- | Round downward (IEEE754 roundTowardNegative) TowardNegInf :: RoundingMode -- | Round upward (IEEE754 roundTowardPositive) TowardInf :: RoundingMode -- | Round toward zero (IEEE754 roundTowardZero) TowardZero :: RoundingMode -- | Returns the opposite rounding direction. -- -- TowardNegInf and TowardInf are swapped. oppositeRoundingMode :: RoundingMode -> RoundingMode -- | This class allows you to recover the runtime value from a type-level -- rounding mode. -- -- See rounding. class Rounding (r :: RoundingMode) -- | Recovers the value from type-level rounding mode. rounding :: Rounding r => proxy r -> RoundingMode -- | Lifts a rounding mode to type-level. reifyRounding :: RoundingMode -> (forall s. Rounding s => Proxy s -> a) -> a -- | A type tagged with a rounding direction. -- -- The rounding direction is effective for a single operation. You -- won't get the correctly-rounded result for a compound expression like -- (a - b * c) :: Rounded 'TowardInf Double. -- -- In particular, a negative literal like -0.1 :: Rounded r -- Double doesn't yield the correctly-rounded value for -- -0.1. To get the correct value, call fromRational -- explicitly (i.e. fromRational (-0.1) :: Rounded r Double) or -- use NegativeLiterals extension. newtype Rounded (r :: RoundingMode) a Rounded :: a -> Rounded (r :: RoundingMode) a [getRounded] :: Rounded (r :: RoundingMode) a -> a data family MVector s a data family Vector a -- | Returns the smallest value that is larger than the argument. -- -- IEEE 754 nextUp operation. -- --
-- >>> nextUp 1 == (0x1.000002p0 :: Float) -- True -- -- >>> nextUp 1 == (0x1.0000_0000_0000_1p0 :: Double) -- True -- -- >>> nextUp (1/0) == (1/0 :: Double) -- True -- -- >>> nextUp (-1/0) == (- maxFinite :: Double) -- True -- -- >>> nextUp 0 == (0x1p-1074 :: Double) -- True -- -- >>> nextUp (-0) == (0x1p-1074 :: Double) -- True -- -- >>> nextUp (-0x1p-1074) :: Double -- returns negative zero -- -0.0 --nextUp :: RealFloat a => a -> a -- | Returns the largest value that is smaller than the argument. -- -- IEEE 754 nextDown operation. -- --
-- >>> nextDown 1 == (0x1.ffff_ffff_ffff_fp-1 :: Double) -- True -- -- >>> nextDown 1 == (0x1.fffffep-1 :: Float) -- True -- -- >>> nextDown (1/0) == (maxFinite :: Double) -- True -- -- >>> nextDown (-1/0) == (-1/0 :: Double) -- True -- -- >>> nextDown 0 == (-0x1p-1074 :: Double) -- True -- -- >>> nextDown (-0) == (-0x1p-1074 :: Double) -- True -- -- >>> nextDown 0x1p-1074 -- returns positive zero -- 0.0 -- -- >>> nextDown 0x1p-1022 == (0x0.ffff_ffff_ffff_fp-1022 :: Double) -- True --nextDown :: RealFloat a => a -> a -- | Returns the value whose magnitude is smaller than that of the -- argument, and is closest to the argument. -- -- This operation is not in IEEE, but may be useful to some. -- --
-- >>> nextTowardZero 1 == (0x1.ffff_ffff_ffff_fp-1 :: Double) -- True -- -- >>> nextTowardZero 1 == (0x1.fffffep-1 :: Float) -- True -- -- >>> nextTowardZero (1/0) == (maxFinite :: Double) -- True -- -- >>> nextTowardZero (-1/0) == (-maxFinite :: Double) -- True -- -- >>> nextTowardZero 0 :: Double -- returns positive zero -- 0.0 -- -- >>> nextTowardZero (-0 :: Double) -- returns negative zero -- -0.0 -- -- >>> nextTowardZero 0x1p-1074 :: Double -- 0.0 --nextTowardZero :: RealFloat a => a -> a distanceUlp :: RealFloat a => a -> a -> Maybe Integer -- | fusedMultiplyAdd a b c computes a * b + c as -- a single, ternary operation. Rounding is done only once. -- -- May make use of hardware FMA instructions if the target architecture -- has it; set fma3 package flag on x86 systems. -- -- IEEE 754 fusedMultiplyAdd operation. -- --
-- \(a :: Double) (b :: Double) (c :: Double) -> fusedMultiplyAdd a b c == fromRational (toRational a * toRational b + toRational c) --fusedMultiplyAdd :: RealFloat a => a -> a -> a -> a roundedFromInteger_default :: RealFloat a => RoundingMode -> Integer -> a roundedFromRational_default :: RealFloat a => RoundingMode -> Rational -> a intervalFromInteger_default :: RealFloat a => Integer -> (Rounded 'TowardNegInf a, Rounded 'TowardInf a) intervalFromIntegral :: (Integral i, RealFloat a) => i -> (Rounded 'TowardNegInf a, Rounded 'TowardInf a) intervalFromRational_default :: RealFloat a => Rational -> (Rounded 'TowardNegInf a, Rounded 'TowardInf a) class RealFloatConstants a -- | <math> positiveInfinity :: RealFloatConstants a => a -- | <math> negativeInfinity :: RealFloatConstants a => a maxFinite :: RealFloatConstants a => a minPositive :: RealFloatConstants a => a -- | The correctly-rounded value of <math> pi_down :: RealFloatConstants a => Rounded 'TowardNegInf a -- | The correctly-rounded value of <math> pi_up :: RealFloatConstants a => Rounded 'TowardInf a -- | The correctly-rounded value of <math> three_pi_down :: RealFloatConstants a => Rounded 'TowardNegInf a -- | The correctly-rounded value of <math> three_pi_up :: RealFloatConstants a => Rounded 'TowardInf a -- | The correctly-rounded value of <math> five_pi_down :: RealFloatConstants a => Rounded 'TowardNegInf a -- | The correctly-rounded value of <math> five_pi_up :: RealFloatConstants a => Rounded 'TowardInf a -- | The correctly-rounded value of <math> log2_down :: RealFloatConstants a => Rounded 'TowardNegInf a -- | The correctly-rounded value of <math> log2_up :: RealFloatConstants a => Rounded 'TowardInf a -- | The correctly-rounded value of <math> exp1_down :: RealFloatConstants a => Rounded 'TowardNegInf a -- | The correctly-rounded value of <math> exp1_up :: RealFloatConstants a => Rounded 'TowardInf a -- | The correctly-rounded value of <math> exp1_2_down :: RealFloatConstants a => Rounded 'TowardNegInf a -- | The correctly-rounded value of <math> exp1_2_up :: RealFloatConstants a => Rounded 'TowardInf a -- | The correctly-rounded value of <math> expm1_2_down :: RealFloatConstants a => Rounded 'TowardNegInf a -- | The correctly-rounded value of <math> expm1_2_up :: RealFloatConstants a => Rounded 'TowardInf a -- | The correctly-rounded value of <math> sqrt2_down :: RealFloatConstants a => Rounded 'TowardNegInf a -- | The correctly-rounded value of <math> sqrt2_up :: RealFloatConstants a => Rounded 'TowardInf a -- | The correctly-rounded value of <math> sqrt2m1_down :: RealFloatConstants a => Rounded 'TowardNegInf a -- | The correctly-rounded value of <math> sqrt2m1_up :: RealFloatConstants a => Rounded 'TowardInf a -- | The correctly-rounded value of <math> sqrt1_2_down :: RealFloatConstants a => Rounded 'TowardNegInf a -- | The correctly-rounded value of <math> sqrt1_2_up :: RealFloatConstants a => Rounded 'TowardInf a -- | The correctly-rounded value of <math> three_minus_2sqrt2_down :: RealFloatConstants a => Rounded 'TowardNegInf a -- | The correctly-rounded value of <math> three_minus_2sqrt2_up :: RealFloatConstants a => Rounded 'TowardInf a -- | The correctly-rounded value of <math> two_minus_sqrt2_down :: RealFloatConstants a => Rounded 'TowardNegInf a -- | The correctly-rounded value of <math> two_minus_sqrt2_up :: RealFloatConstants a => Rounded 'TowardInf a -- | Lifted version of RoundedSqrt class (RoundedSqrt a, RoundedRing_Vector vector a) => RoundedSqrt_Vector vector a -- | Equivalent to map . roundedSqrt map_roundedSqrt :: RoundedSqrt_Vector vector a => RoundingMode -> vector a -> vector a -- | Equivalent to map . roundedSqrt map_roundedSqrt :: (RoundedSqrt_Vector vector a, Vector vector a) => RoundingMode -> vector a -> vector a -- | Lifted version of RoundedFractional class (RoundedFractional a, RoundedRing_Vector vector a) => RoundedFractional_Vector vector a -- | Equivalent to zipWith . roundedDiv zipWith_roundedDiv :: RoundedFractional_Vector vector a => RoundingMode -> vector a -> vector a -> vector a -- | Equivalent to zipWith . roundedDiv zipWith_roundedDiv :: (RoundedFractional_Vector vector a, Vector vector a) => RoundingMode -> vector a -> vector a -> vector a -- | Lifted version of RoundedRing class RoundedRing a => RoundedRing_Vector vector a -- | Equivalent to \r -> foldl (roundedAdd r) 0 roundedSum :: RoundedRing_Vector vector a => RoundingMode -> vector a -> a -- | Equivalent to zipWith . roundedAdd zipWith_roundedAdd :: RoundedRing_Vector vector a => RoundingMode -> vector a -> vector a -> vector a -- | Equivalent to zipWith . roundedSub zipWith_roundedSub :: RoundedRing_Vector vector a => RoundingMode -> vector a -> vector a -> vector a -- | Equivalent to zipWith . roundedMul zipWith_roundedMul :: RoundedRing_Vector vector a => RoundingMode -> vector a -> vector a -> vector a -- | Equivalent to zipWith3 . roundedFusedMultiplyAdd zipWith3_roundedFusedMultiplyAdd :: RoundedRing_Vector vector a => RoundingMode -> vector a -> vector a -> vector a -> vector a -- | Equivalent to \r -> foldl (roundedAdd r) 0 roundedSum :: (RoundedRing_Vector vector a, Vector vector a, Num a) => RoundingMode -> vector a -> a -- | Equivalent to zipWith . roundedAdd zipWith_roundedAdd :: (RoundedRing_Vector vector a, Vector vector a) => RoundingMode -> vector a -> vector a -> vector a -- | Equivalent to zipWith . roundedSub zipWith_roundedSub :: (RoundedRing_Vector vector a, Vector vector a) => RoundingMode -> vector a -> vector a -> vector a -- | Equivalent to zipWith . roundedMul zipWith_roundedMul :: (RoundedRing_Vector vector a, Vector vector a) => RoundingMode -> vector a -> vector a -> vector a -- | Equivalent to zipWith3 . roundedFusedMultiplyAdd zipWith3_roundedFusedMultiplyAdd :: (RoundedRing_Vector vector a, Vector vector a) => RoundingMode -> vector a -> vector a -> vector a -> vector a -- | Rounding-controlled version of sqrt. class RoundedRing a => RoundedSqrt a roundedSqrt :: RoundedSqrt a => RoundingMode -> a -> a intervalSqrt :: RoundedSqrt a => Rounded 'TowardNegInf a -> Rounded 'TowardInf a -> (Rounded 'TowardNegInf a, Rounded 'TowardInf a) -- | Rounding-controlled version of Fractional. class RoundedRing a => RoundedFractional a roundedDiv :: RoundedFractional a => RoundingMode -> a -> a -> a roundedRecip :: RoundedFractional a => RoundingMode -> a -> a roundedRecip :: (RoundedFractional a, Num a) => RoundingMode -> a -> a roundedFromRational :: RoundedFractional a => RoundingMode -> Rational -> a roundedFromRational :: (RoundedFractional a, RealFloat a) => RoundingMode -> Rational -> a roundedFromRealFloat :: (RoundedFractional a, RealFloat b) => RoundingMode -> b -> a roundedFromRealFloat :: (RoundedFractional a, Fractional a, RealFloat b) => RoundingMode -> b -> a intervalDiv :: RoundedFractional a => Rounded 'TowardNegInf a -> Rounded 'TowardInf a -> Rounded 'TowardNegInf a -> Rounded 'TowardInf a -> (Rounded 'TowardNegInf a, Rounded 'TowardInf a) intervalDivAdd :: RoundedFractional a => Rounded 'TowardNegInf a -> Rounded 'TowardInf a -> Rounded 'TowardNegInf a -> Rounded 'TowardInf a -> Rounded 'TowardNegInf a -> Rounded 'TowardInf a -> (Rounded 'TowardNegInf a, Rounded 'TowardInf a) intervalRecip :: RoundedFractional a => Rounded 'TowardNegInf a -> Rounded 'TowardInf a -> (Rounded 'TowardNegInf a, Rounded 'TowardInf a) intervalFromRational :: RoundedFractional a => Rational -> (Rounded 'TowardNegInf a, Rounded 'TowardInf a) -- | Rounding-controlled version of Num. class Ord a => RoundedRing a roundedAdd :: RoundedRing a => RoundingMode -> a -> a -> a roundedSub :: RoundedRing a => RoundingMode -> a -> a -> a roundedMul :: RoundedRing a => RoundingMode -> a -> a -> a roundedFusedMultiplyAdd :: RoundedRing a => RoundingMode -> a -> a -> a -> a roundedFromInteger :: RoundedRing a => RoundingMode -> Integer -> a roundedFromInteger :: (RoundedRing a, RealFloat a) => RoundingMode -> Integer -> a -- |
-- \x_lo x_hi y_lo y_hi -> intervalAdd (Rounded x_lo) (Rounded x_hi) (Rounded y_lo) (Rounded y_hi) == (Rounded (roundedAdd TowardNegInf x_lo y_lo), Rounded (roundedAdd TowardInf x_hi y_hi)) --intervalAdd :: RoundedRing a => Rounded 'TowardNegInf a -> Rounded 'TowardInf a -> Rounded 'TowardNegInf a -> Rounded 'TowardInf a -> (Rounded 'TowardNegInf a, Rounded 'TowardInf a) -- |
-- \x_lo x_hi y_lo y_hi -> intervalSub (Rounded x_lo) (Rounded x_hi) (Rounded y_lo) (Rounded y_hi) == (Rounded (roundedSub TowardNegInf x_lo y_hi), Rounded (roundedSub TowardInf x_hi y_lo)) --intervalSub :: RoundedRing a => Rounded 'TowardNegInf a -> Rounded 'TowardInf a -> Rounded 'TowardNegInf a -> Rounded 'TowardInf a -> (Rounded 'TowardNegInf a, Rounded 'TowardInf a) intervalMul :: RoundedRing a => Rounded 'TowardNegInf a -> Rounded 'TowardInf a -> Rounded 'TowardNegInf a -> Rounded 'TowardInf a -> (Rounded 'TowardNegInf a, Rounded 'TowardInf a) intervalMulAdd :: RoundedRing a => Rounded 'TowardNegInf a -> Rounded 'TowardInf a -> Rounded 'TowardNegInf a -> Rounded 'TowardInf a -> Rounded 'TowardNegInf a -> Rounded 'TowardInf a -> (Rounded 'TowardNegInf a, Rounded 'TowardInf a) intervalFromInteger :: RoundedRing a => Integer -> (Rounded 'TowardNegInf a, Rounded 'TowardInf a) backendNameT :: RoundedRing a => Tagged a String -- | Returns the name of backend as a string. -- -- Example: -- --
-- >>> :m + Data.Proxy -- >>> backendName (Proxy :: Proxy Double) -- "FastFFI+SSE2" --backendName :: RoundedRing a => proxy a -> String -- | The type for IEEE754 rounding-direction attributes. data RoundingMode -- | Round to the nearest value (IEEE754 roundTiesToEven) ToNearest :: RoundingMode -- | Round downward (IEEE754 roundTowardNegative) TowardNegInf :: RoundingMode -- | Round upward (IEEE754 roundTowardPositive) TowardInf :: RoundingMode -- | Round toward zero (IEEE754 roundTowardZero) TowardZero :: RoundingMode -- | Returns the opposite rounding direction. -- -- TowardNegInf and TowardInf are swapped. oppositeRoundingMode :: RoundingMode -> RoundingMode -- | This class allows you to recover the runtime value from a type-level -- rounding mode. -- -- See rounding. class Rounding (r :: RoundingMode) -- | Recovers the value from type-level rounding mode. rounding :: Rounding r => proxy r -> RoundingMode -- | Lifts a rounding mode to type-level. reifyRounding :: RoundingMode -> (forall s. Rounding s => Proxy s -> a) -> a -- | A type tagged with a rounding direction. -- -- The rounding direction is effective for a single operation. You -- won't get the correctly-rounded result for a compound expression like -- (a - b * c) :: Rounded 'TowardInf Double. -- -- In particular, a negative literal like -0.1 :: Rounded r -- Double doesn't yield the correctly-rounded value for -- -0.1. To get the correct value, call fromRational -- explicitly (i.e. fromRational (-0.1) :: Rounded r Double) or -- use NegativeLiterals extension. newtype Rounded (r :: RoundingMode) a Rounded :: a -> Rounded (r :: RoundingMode) a [getRounded] :: Rounded (r :: RoundingMode) a -> a data family MVector s a data family Vector a module Numeric.Rounded.Hardware.Class -- | Rounding-controlled version of Num. class Ord a => RoundedRing a roundedAdd :: RoundedRing a => RoundingMode -> a -> a -> a roundedSub :: RoundedRing a => RoundingMode -> a -> a -> a roundedMul :: RoundedRing a => RoundingMode -> a -> a -> a roundedFusedMultiplyAdd :: RoundedRing a => RoundingMode -> a -> a -> a -> a roundedFromInteger :: RoundedRing a => RoundingMode -> Integer -> a roundedFromInteger :: (RoundedRing a, RealFloat a) => RoundingMode -> Integer -> a -- |
-- \x_lo x_hi y_lo y_hi -> intervalAdd (Rounded x_lo) (Rounded x_hi) (Rounded y_lo) (Rounded y_hi) == (Rounded (roundedAdd TowardNegInf x_lo y_lo), Rounded (roundedAdd TowardInf x_hi y_hi)) --intervalAdd :: RoundedRing a => Rounded 'TowardNegInf a -> Rounded 'TowardInf a -> Rounded 'TowardNegInf a -> Rounded 'TowardInf a -> (Rounded 'TowardNegInf a, Rounded 'TowardInf a) -- |
-- \x_lo x_hi y_lo y_hi -> intervalSub (Rounded x_lo) (Rounded x_hi) (Rounded y_lo) (Rounded y_hi) == (Rounded (roundedSub TowardNegInf x_lo y_hi), Rounded (roundedSub TowardInf x_hi y_lo)) --intervalSub :: RoundedRing a => Rounded 'TowardNegInf a -> Rounded 'TowardInf a -> Rounded 'TowardNegInf a -> Rounded 'TowardInf a -> (Rounded 'TowardNegInf a, Rounded 'TowardInf a) intervalMul :: RoundedRing a => Rounded 'TowardNegInf a -> Rounded 'TowardInf a -> Rounded 'TowardNegInf a -> Rounded 'TowardInf a -> (Rounded 'TowardNegInf a, Rounded 'TowardInf a) intervalMulAdd :: RoundedRing a => Rounded 'TowardNegInf a -> Rounded 'TowardInf a -> Rounded 'TowardNegInf a -> Rounded 'TowardInf a -> Rounded 'TowardNegInf a -> Rounded 'TowardInf a -> (Rounded 'TowardNegInf a, Rounded 'TowardInf a) intervalFromInteger :: RoundedRing a => Integer -> (Rounded 'TowardNegInf a, Rounded 'TowardInf a) backendNameT :: RoundedRing a => Tagged a String -- | Rounding-controlled version of Fractional. class RoundedRing a => RoundedFractional a roundedDiv :: RoundedFractional a => RoundingMode -> a -> a -> a roundedRecip :: RoundedFractional a => RoundingMode -> a -> a roundedRecip :: (RoundedFractional a, Num a) => RoundingMode -> a -> a roundedFromRational :: RoundedFractional a => RoundingMode -> Rational -> a roundedFromRational :: (RoundedFractional a, RealFloat a) => RoundingMode -> Rational -> a roundedFromRealFloat :: (RoundedFractional a, RealFloat b) => RoundingMode -> b -> a roundedFromRealFloat :: (RoundedFractional a, Fractional a, RealFloat b) => RoundingMode -> b -> a intervalDiv :: RoundedFractional a => Rounded 'TowardNegInf a -> Rounded 'TowardInf a -> Rounded 'TowardNegInf a -> Rounded 'TowardInf a -> (Rounded 'TowardNegInf a, Rounded 'TowardInf a) intervalDivAdd :: RoundedFractional a => Rounded 'TowardNegInf a -> Rounded 'TowardInf a -> Rounded 'TowardNegInf a -> Rounded 'TowardInf a -> Rounded 'TowardNegInf a -> Rounded 'TowardInf a -> (Rounded 'TowardNegInf a, Rounded 'TowardInf a) intervalRecip :: RoundedFractional a => Rounded 'TowardNegInf a -> Rounded 'TowardInf a -> (Rounded 'TowardNegInf a, Rounded 'TowardInf a) intervalFromRational :: RoundedFractional a => Rational -> (Rounded 'TowardNegInf a, Rounded 'TowardInf a) -- | Rounding-controlled version of sqrt. class RoundedRing a => RoundedSqrt a roundedSqrt :: RoundedSqrt a => RoundingMode -> a -> a intervalSqrt :: RoundedSqrt a => Rounded 'TowardNegInf a -> Rounded 'TowardInf a -> (Rounded 'TowardNegInf a, Rounded 'TowardInf a) -- | Lifted version of RoundedRing class RoundedRing a => RoundedRing_Vector vector a -- | Equivalent to \r -> foldl (roundedAdd r) 0 roundedSum :: RoundedRing_Vector vector a => RoundingMode -> vector a -> a -- | Equivalent to zipWith . roundedAdd zipWith_roundedAdd :: RoundedRing_Vector vector a => RoundingMode -> vector a -> vector a -> vector a -- | Equivalent to zipWith . roundedSub zipWith_roundedSub :: RoundedRing_Vector vector a => RoundingMode -> vector a -> vector a -> vector a -- | Equivalent to zipWith . roundedMul zipWith_roundedMul :: RoundedRing_Vector vector a => RoundingMode -> vector a -> vector a -> vector a -- | Equivalent to zipWith3 . roundedFusedMultiplyAdd zipWith3_roundedFusedMultiplyAdd :: RoundedRing_Vector vector a => RoundingMode -> vector a -> vector a -> vector a -> vector a -- | Equivalent to \r -> foldl (roundedAdd r) 0 roundedSum :: (RoundedRing_Vector vector a, Vector vector a, Num a) => RoundingMode -> vector a -> a -- | Equivalent to zipWith . roundedAdd zipWith_roundedAdd :: (RoundedRing_Vector vector a, Vector vector a) => RoundingMode -> vector a -> vector a -> vector a -- | Equivalent to zipWith . roundedSub zipWith_roundedSub :: (RoundedRing_Vector vector a, Vector vector a) => RoundingMode -> vector a -> vector a -> vector a -- | Equivalent to zipWith . roundedMul zipWith_roundedMul :: (RoundedRing_Vector vector a, Vector vector a) => RoundingMode -> vector a -> vector a -> vector a -- | Equivalent to zipWith3 . roundedFusedMultiplyAdd zipWith3_roundedFusedMultiplyAdd :: (RoundedRing_Vector vector a, Vector vector a) => RoundingMode -> vector a -> vector a -> vector a -> vector a -- | Lifted version of RoundedFractional class (RoundedFractional a, RoundedRing_Vector vector a) => RoundedFractional_Vector vector a -- | Equivalent to zipWith . roundedDiv zipWith_roundedDiv :: RoundedFractional_Vector vector a => RoundingMode -> vector a -> vector a -> vector a -- | Equivalent to zipWith . roundedDiv zipWith_roundedDiv :: (RoundedFractional_Vector vector a, Vector vector a) => RoundingMode -> vector a -> vector a -> vector a -- | Lifted version of RoundedSqrt class (RoundedSqrt a, RoundedRing_Vector vector a) => RoundedSqrt_Vector vector a -- | Equivalent to map . roundedSqrt map_roundedSqrt :: RoundedSqrt_Vector vector a => RoundingMode -> vector a -> vector a -- | Equivalent to map . roundedSqrt map_roundedSqrt :: (RoundedSqrt_Vector vector a, Vector vector a) => RoundingMode -> vector a -> vector a -- | Although popular CPUs allow program to control the rounding direction -- of floating-point operations, such feature is not directly accessible -- to Haskell. -- -- Several options are available to control the rounding direction, -- including -- --
-- >>> :m + Data.Proxy -- >>> backendName (Proxy :: Proxy Double) -- "FastFFI+SSE2" --backendName :: RoundedRing a => proxy a -> String module Numeric.Rounded.Hardware -- | A type tagged with a rounding direction. -- -- The rounding direction is effective for a single operation. You -- won't get the correctly-rounded result for a compound expression like -- (a - b * c) :: Rounded 'TowardInf Double. -- -- In particular, a negative literal like -0.1 :: Rounded r -- Double doesn't yield the correctly-rounded value for -- -0.1. To get the correct value, call fromRational -- explicitly (i.e. fromRational (-0.1) :: Rounded r Double) or -- use NegativeLiterals extension. newtype Rounded (r :: RoundingMode) a Rounded :: a -> Rounded (r :: RoundingMode) a [getRounded] :: Rounded (r :: RoundingMode) a -> a -- | The type for IEEE754 rounding-direction attributes. data RoundingMode -- | Round to the nearest value (IEEE754 roundTiesToEven) ToNearest :: RoundingMode -- | Round downward (IEEE754 roundTowardNegative) TowardNegInf :: RoundingMode -- | Round upward (IEEE754 roundTowardPositive) TowardInf :: RoundingMode -- | Round toward zero (IEEE754 roundTowardZero) TowardZero :: RoundingMode -- | This class allows you to recover the runtime value from a type-level -- rounding mode. -- -- See rounding. class Rounding (r :: RoundingMode) -- | Rounding-controlled version of Num. class Ord a => RoundedRing a -- | Rounding-controlled version of Fractional. class RoundedRing a => RoundedFractional a -- | Rounding-controlled version of sqrt. class RoundedRing a => RoundedSqrt a module Numeric.Rounded.Hardware.Interval.Class class IsInterval i where { type family EndPoint i; } withEndPoints :: IsInterval i => (Rounded 'TowardNegInf (EndPoint i) -> Rounded 'TowardInf (EndPoint i) -> i) -> i -> i singleton :: IsInterval i => EndPoint i -> i makeInterval :: IsInterval i => Rounded 'TowardNegInf (EndPoint i) -> Rounded 'TowardInf (EndPoint i) -> i width :: IsInterval i => i -> Rounded 'TowardInf (EndPoint i) hull :: IsInterval i => i -> i -> i intersection :: IsInterval i => i -> i -> i maybeIntersection :: IsInterval i => i -> i -> Maybe i equalAsSet :: IsInterval i => i -> i -> Bool -- | a is a subset of b subset :: IsInterval i => i -> i -> Bool weaklyLess :: IsInterval i => i -> i -> Bool precedes :: IsInterval i => i -> i -> Bool interior :: IsInterval i => i -> i -> Bool strictLess :: IsInterval i => i -> i -> Bool strictPrecedes :: IsInterval i => i -> i -> Bool disjoint :: IsInterval i => i -> i -> Bool infix 4 `disjoint` infix 4 `strictPrecedes` infix 4 `strictLess` infix 4 `interior` infix 4 `precedes` infix 4 `weaklyLess` infix 4 `subset` infix 4 `equalAsSet` module Numeric.Rounded.Hardware.Interval.NonEmpty data Interval a I :: !Rounded 'TowardNegInf a -> !Rounded 'TowardInf a -> Interval a increasing :: (forall r. Rounding r => Rounded r a -> Rounded r a) -> Interval a -> Interval a maxI :: Ord a => Interval a -> Interval a -> Interval a minI :: Ord a => Interval a -> Interval a -> Interval a powInt :: (Ord a, Num a, RoundedRing a) => Interval a -> Int -> Interval a null :: Interval a -> Bool inf :: Interval a -> Rounded 'TowardNegInf a sup :: Interval a -> Rounded 'TowardInf a width :: (Num a, RoundedRing a) => Interval a -> Rounded 'TowardInf a hull :: RoundedRing a => Interval a -> Interval a -> Interval a instance GHC.Generics.Generic (Numeric.Rounded.Hardware.Interval.NonEmpty.Interval a) instance GHC.Show.Show a => GHC.Show.Show (Numeric.Rounded.Hardware.Interval.NonEmpty.Interval a) instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Numeric.Rounded.Hardware.Interval.NonEmpty.Interval a) instance (GHC.Num.Num a, Numeric.Rounded.Hardware.Internal.Class.RoundedRing a) => GHC.Num.Num (Numeric.Rounded.Hardware.Interval.NonEmpty.Interval a) instance (GHC.Num.Num a, Numeric.Rounded.Hardware.Internal.Class.RoundedFractional a) => GHC.Real.Fractional (Numeric.Rounded.Hardware.Interval.NonEmpty.Interval a) instance (GHC.Num.Num a, Numeric.Rounded.Hardware.Internal.Class.RoundedFractional a, Numeric.Rounded.Hardware.Internal.Class.RoundedSqrt a, GHC.Classes.Eq a, GHC.Float.RealFloat a, Numeric.Rounded.Hardware.Internal.Constants.RealFloatConstants a) => GHC.Float.Floating (Numeric.Rounded.Hardware.Interval.NonEmpty.Interval a) instance (GHC.Float.RealFloat a, Numeric.Rounded.Hardware.Internal.Class.RoundedRing a) => Numeric.Rounded.Hardware.Interval.Class.IsInterval (Numeric.Rounded.Hardware.Interval.NonEmpty.Interval a) instance (Data.Vector.Unboxed.Base.Unbox a, GHC.Classes.Ord a, GHC.Real.Fractional a) => Data.Vector.Generic.Mutable.Base.MVector Data.Vector.Unboxed.Base.MVector (Numeric.Rounded.Hardware.Interval.NonEmpty.Interval a) instance (Data.Vector.Unboxed.Base.Unbox a, GHC.Classes.Ord a, GHC.Real.Fractional a) => Data.Vector.Generic.Base.Vector Data.Vector.Unboxed.Base.Vector (Numeric.Rounded.Hardware.Interval.NonEmpty.Interval a) instance (Data.Vector.Unboxed.Base.Unbox a, GHC.Classes.Ord a, GHC.Real.Fractional a) => Data.Vector.Unboxed.Base.Unbox (Numeric.Rounded.Hardware.Interval.NonEmpty.Interval a) instance (Data.Primitive.Types.Prim a, GHC.Classes.Ord a, GHC.Real.Fractional a) => Data.Array.Base.MArray (Data.Array.Base.STUArray s) (Numeric.Rounded.Hardware.Interval.NonEmpty.Interval a) (GHC.ST.ST s) instance (Data.Primitive.Types.Prim a, GHC.Classes.Ord a, GHC.Real.Fractional a) => Data.Array.Base.IArray Data.Array.Base.UArray (Numeric.Rounded.Hardware.Interval.NonEmpty.Interval a) module Numeric.Rounded.Hardware.Interval data Interval a I :: !Rounded 'TowardNegInf a -> !Rounded 'TowardInf a -> Interval a Empty :: Interval a increasing :: (forall r. Rounding r => Rounded r a -> Rounded r a) -> Interval a -> Interval a maxI :: Ord a => Interval a -> Interval a -> Interval a minI :: Ord a => Interval a -> Interval a -> Interval a powInt :: (Ord a, Num a, RoundedRing a) => Interval a -> Int -> Interval a null :: Interval a -> Bool inf :: Interval a -> Rounded 'TowardNegInf a sup :: Interval a -> Rounded 'TowardInf a width :: (Num a, RoundedRing a) => Interval a -> Rounded 'TowardInf a widthUlp :: RealFloat a => Interval a -> Maybe Integer hull :: RoundedRing a => Interval a -> Interval a -> Interval a intersection :: RoundedRing a => Interval a -> Interval a -> Interval a instance GHC.Generics.Generic (Numeric.Rounded.Hardware.Interval.Interval a) instance GHC.Show.Show a => GHC.Show.Show (Numeric.Rounded.Hardware.Interval.Interval a) instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Numeric.Rounded.Hardware.Interval.Interval a) instance (GHC.Num.Num a, Numeric.Rounded.Hardware.Internal.Class.RoundedRing a) => GHC.Num.Num (Numeric.Rounded.Hardware.Interval.Interval a) instance (GHC.Num.Num a, Numeric.Rounded.Hardware.Internal.Class.RoundedFractional a) => GHC.Real.Fractional (Numeric.Rounded.Hardware.Interval.Interval a) instance (GHC.Num.Num a, Numeric.Rounded.Hardware.Internal.Class.RoundedFractional a, Numeric.Rounded.Hardware.Internal.Class.RoundedSqrt a, GHC.Classes.Eq a, GHC.Float.RealFloat a, Numeric.Rounded.Hardware.Internal.Constants.RealFloatConstants a) => GHC.Float.Floating (Numeric.Rounded.Hardware.Interval.Interval a) instance (GHC.Num.Num a, Numeric.Rounded.Hardware.Internal.Class.RoundedRing a, GHC.Float.RealFloat a) => Numeric.Rounded.Hardware.Interval.Class.IsInterval (Numeric.Rounded.Hardware.Interval.Interval a) instance (Data.Vector.Unboxed.Base.Unbox a, GHC.Classes.Ord a, GHC.Real.Fractional a) => Data.Vector.Generic.Mutable.Base.MVector Data.Vector.Unboxed.Base.MVector (Numeric.Rounded.Hardware.Interval.Interval a) instance (Data.Vector.Unboxed.Base.Unbox a, GHC.Classes.Ord a, GHC.Real.Fractional a) => Data.Vector.Generic.Base.Vector Data.Vector.Unboxed.Base.Vector (Numeric.Rounded.Hardware.Interval.Interval a) instance (Data.Vector.Unboxed.Base.Unbox a, GHC.Classes.Ord a, GHC.Real.Fractional a) => Data.Vector.Unboxed.Base.Unbox (Numeric.Rounded.Hardware.Interval.Interval a) instance (Data.Primitive.Types.Prim a, GHC.Classes.Ord a, GHC.Real.Fractional a) => Data.Array.Base.MArray (Data.Array.Base.STUArray s) (Numeric.Rounded.Hardware.Interval.Interval a) (GHC.ST.ST s) instance (Data.Primitive.Types.Prim a, GHC.Classes.Ord a, GHC.Real.Fractional a) => Data.Array.Base.IArray Data.Array.Base.UArray (Numeric.Rounded.Hardware.Interval.Interval a) module Numeric.Rounded.Hardware.Rounding -- | The type for IEEE754 rounding-direction attributes. data RoundingMode -- | Round to the nearest value (IEEE754 roundTiesToEven) ToNearest :: RoundingMode -- | Round downward (IEEE754 roundTowardNegative) TowardNegInf :: RoundingMode -- | Round upward (IEEE754 roundTowardPositive) TowardInf :: RoundingMode -- | Round toward zero (IEEE754 roundTowardZero) TowardZero :: RoundingMode -- | Returns the opposite rounding direction. -- -- TowardNegInf and TowardInf are swapped. oppositeRoundingMode :: RoundingMode -> RoundingMode -- | This class allows you to recover the runtime value from a type-level -- rounding mode. -- -- See rounding. class Rounding (r :: RoundingMode) -- | Recovers the value from type-level rounding mode. rounding :: Rounding r => proxy r -> RoundingMode -- | Lifts a rounding mode to type-level. reifyRounding :: RoundingMode -> (forall s. Rounding s => Proxy s -> a) -> a module Numeric.Rounded.Hardware.Vector.Storable coercion :: Coercion (Vector a) (Vector (Rounded r a)) fromVectorOfRounded :: Vector (Rounded r a) -> Vector a toVectorOfRounded :: Vector a -> Vector (Rounded r a) coercionM :: Coercion (MVector s a) (MVector s (Rounded r a)) fromMVectorOfRounded :: MVector s (Rounded r a) -> MVector s a toMVectorOfRounded :: MVector s a -> MVector s (Rounded r a) -- | Equivalent to \r -> foldl (roundedAdd r) 0 roundedSum :: RoundedRing_Vector vector a => RoundingMode -> vector a -> a -- | Equivalent to zipWith . roundedAdd zipWith_roundedAdd :: RoundedRing_Vector vector a => RoundingMode -> vector a -> vector a -> vector a -- | Equivalent to zipWith . roundedSub zipWith_roundedSub :: RoundedRing_Vector vector a => RoundingMode -> vector a -> vector a -> vector a -- | Equivalent to zipWith . roundedMul zipWith_roundedMul :: RoundedRing_Vector vector a => RoundingMode -> vector a -> vector a -> vector a -- | Equivalent to zipWith3 . roundedFusedMultiplyAdd zipWith3_roundedFusedMultiplyAdd :: RoundedRing_Vector vector a => RoundingMode -> vector a -> vector a -> vector a -> vector a -- | Equivalent to zipWith . roundedDiv zipWith_roundedDiv :: RoundedFractional_Vector vector a => RoundingMode -> vector a -> vector a -> vector a -- | Equivalent to map . roundedSqrt map_roundedSqrt :: RoundedSqrt_Vector vector a => RoundingMode -> vector a -> vector a -- | Equivalent to sum sum :: forall r a. (Rounding r, Storable a, RoundedRing_Vector Vector a) => Vector (Rounded r a) -> Rounded r a -- | Equivalent to zipWith (+) zipWith_add :: forall r a. (Rounding r, Storable a, RoundedRing_Vector Vector a) => Vector (Rounded r a) -> Vector (Rounded r a) -> Vector (Rounded r a) -- | Equivalent to zipWith (-) zipWith_sub :: forall r a. (Rounding r, Storable a, RoundedRing_Vector Vector a) => Vector (Rounded r a) -> Vector (Rounded r a) -> Vector (Rounded r a) -- | Equivalent to zipWith (*) zipWith_mul :: forall r a. (Rounding r, Storable a, RoundedRing_Vector Vector a) => Vector (Rounded r a) -> Vector (Rounded r a) -> Vector (Rounded r a) -- | Equivalent to zipWith3 fusedMultiplyAdd zipWith3_fusedMultiplyAdd :: forall r a. (Rounding r, Storable a, RoundedRing_Vector Vector a) => Vector (Rounded r a) -> Vector (Rounded r a) -> Vector (Rounded r a) -> Vector (Rounded r a) -- | Equivalent to zipWith (/) zipWith_div :: forall r a. (Rounding r, Storable a, RoundedFractional_Vector Vector a) => Vector (Rounded r a) -> Vector (Rounded r a) -> Vector (Rounded r a) -- | Equivalent to map sqrt map_sqrt :: forall r a. (Rounding r, Storable a, RoundedSqrt_Vector Vector a) => Vector (Rounded r a) -> Vector (Rounded r a) module Numeric.Rounded.Hardware.Vector.Unboxed -- | Equivalent to \r -> foldl (roundedAdd r) 0 roundedSum :: RoundedRing_Vector vector a => RoundingMode -> vector a -> a -- | Equivalent to zipWith . roundedAdd zipWith_roundedAdd :: RoundedRing_Vector vector a => RoundingMode -> vector a -> vector a -> vector a -- | Equivalent to zipWith . roundedSub zipWith_roundedSub :: RoundedRing_Vector vector a => RoundingMode -> vector a -> vector a -> vector a -- | Equivalent to zipWith . roundedMul zipWith_roundedMul :: RoundedRing_Vector vector a => RoundingMode -> vector a -> vector a -> vector a -- | Equivalent to zipWith3 . roundedFusedMultiplyAdd zipWith3_roundedFusedMultiplyAdd :: RoundedRing_Vector vector a => RoundingMode -> vector a -> vector a -> vector a -> vector a -- | Equivalent to zipWith . roundedDiv zipWith_roundedDiv :: RoundedFractional_Vector vector a => RoundingMode -> vector a -> vector a -> vector a -- | Equivalent to map . roundedSqrt map_roundedSqrt :: RoundedSqrt_Vector vector a => RoundingMode -> vector a -> vector a -- | Equivalent to sum sum :: forall r a. (Rounding r, Unbox a, RoundedRing_Vector Vector a) => Vector (Rounded r a) -> Rounded r a -- | Equivalent to zipWith (+) zipWith_add :: forall r a. (Rounding r, Unbox a, RoundedRing_Vector Vector a) => Vector (Rounded r a) -> Vector (Rounded r a) -> Vector (Rounded r a) -- | Equivalent to zipWith (-) zipWith_sub :: forall r a. (Rounding r, Unbox a, RoundedRing_Vector Vector a) => Vector (Rounded r a) -> Vector (Rounded r a) -> Vector (Rounded r a) -- | Equivalent to zipWith (*) zipWith_mul :: forall r a. (Rounding r, Unbox a, RoundedRing_Vector Vector a) => Vector (Rounded r a) -> Vector (Rounded r a) -> Vector (Rounded r a) -- | Equivalent to zipWith3 fusedMultiplyAdd zipWith3_fusedMultiplyAdd :: forall r a. (Rounding r, Unbox a, RoundedRing_Vector Vector a) => Vector (Rounded r a) -> Vector (Rounded r a) -> Vector (Rounded r a) -> Vector (Rounded r a) -- | Equivalent to zipWith (/) zipWith_div :: forall r a. (Rounding r, Unbox a, RoundedFractional_Vector Vector a) => Vector (Rounded r a) -> Vector (Rounded r a) -> Vector (Rounded r a) -- | Equivalent to map sqrt map_sqrt :: forall r a. (Rounding r, Unbox a, RoundedSqrt_Vector Vector a) => Vector (Rounded r a) -> Vector (Rounded r a)