John Meacham (Sun, Mar 13, 2005 at 08:08:56PM -0800): > On Sun, Mar 13, 2005 at 11:08:26PM +0000, Thomas Davie wrote: > > [...] We could define maxBound as > > (2^(mantisa_space))^(2^(exponent_space)) and min bound pretty > > similarly... But I'm sure that everyone will agree that this is a > > horrible hack.
2 cent: module Float_bounds ( max_float , min_float , min_pos_float , max_neg_float ) where d = 1 :: Double f = 1 :: Float max_float x = encodeFloat (radix ^ mant - 1) (expo - mant) where radix = floatRadix x mant = floatDigits x expo = snd $ floatRange x min_pos_float x = encodeFloat (1) (expo - mant) where radix = floatRadix x mant = floatDigits x expo = fst $ floatRange x min_float x = - max_float x max_neg_float x = - min_pos_float x Regards -- Stefan Karrmann _______________________________________________ Haskell mailing list Haskell@haskell.org http://www.haskell.org/mailman/listinfo/haskell