The C function you are looking for is called 'nextafter', and is present on all systems/libraries that pretend to be fully IEEE-754 compliant (as this is a required function from the standard). It even takes a direction parameter (so you can do both nextafter and firstbefore). Since its API is simple, an FFI should be rather straightforward. Jacques -----Original Message----- From: haskell-bounces@haskell.org [mailto:haskell-bounces@haskell.org] On Behalf Of Hal Daume III Sent: October 21, 2003 2:37 PM To: Ketil Z Malde Cc: haskell@haskell.org; Simon Peyton-Jones; George Russell Subject: Re: Enum on Float/Double
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@haskell.org http://www.haskell.org/mailman/listinfo/haskell