Enum on Float/Double

Hal Daume III hdaume at ISI.EDU
Tue Oct 21 14:29:42 EDT 2003


This works great for when x/=0...is there a good (Haskell) solution for 
the smallest positive float?

On Tue, 21 Oct 2003, Lennart Augustsson wrote:

> So this has been a while, but i think that decodeFloat,
> incrementing the mantissa, encodeFloat might work.
> But then again, it might not. :)
> 
> 	-- Lennart
> 
> Hal Daume III wrote:
> >>>My preference would be for succ (+-0) to return the smallest positive
> >>>real, since then you could define succ x to be the unique y with
> >>>x < y and forall z . z < y => not (x < z), where such a y exists, and
> >>>I'm not sure if the Haskell standard knows about signed zeros.
> >>
> >>Is this really useful?  Why would you need this number?  Peano
> >>artithmetic on reals? :-)
> > 
> > 
> > Is there any way to do this (yet)?  I found a case where I really need:
> >   f :: Float -> Float
> > where
> >   f x is the least y such that x < y
> > 
> > even if i have to FFI to C, I'd really like a solution.
> > 
> > any help would be appreciated.
> > 
> >  - Hal
> > 
> > 
> > _______________________________________________
> > Haskell mailing list
> > Haskell at haskell.org
> > http://www.haskell.org/mailman/listinfo/haskell
> > 
> 
> 

-- 
 Hal Daume III                                   | hdaume at isi.edu
 "Arrest this man, he talks in maths."           | www.isi.edu/~hdaume



More information about the Haskell mailing list