> Using the fromInteger (and fromRational) axioms should only *increase* > precission, I don't see how that is such a bad thing.
I think it's bad if the behaviour of your program depends on the optimisation level. On 22/08/07, Twan van Laarhoven <[EMAIL PROTECTED]> wrote: > Stefan O'Rear wrote: > > On Wed, Aug 22, 2007 at 06:36:15PM +0100, Neil Mitchell wrote: > > > >>Hi > >> > >> > >>>If Num obeys ring axioms, fromInteger is a perfectly fine > >>>ring-homomorphism. (It's also the first or second homomorphism taught.) > >> > >>Does Int obey these axioms? I'm thinking that assuming properties > >>about things such as numbers is very likely to go wrong very quickly. > >>Monads you might be able to get away with, Numbers you probably can't. > > > > > > Int does obey the axioms, it's the classical ring ℤ[4294967296]. > > Double, however, does not: > > But Double is already quite badly behaved: > > let x = 1e20 > > Prelude> 1 + (x - x) > > 1.0 > > Prelude> (1 + x) - x > > 0.0 > > Using the fromInteger (and fromRational) axioms should only *increase* > precission, I don't see how that is such a bad thing. > > Also, as far as I can see GHC already does this optimizations if the > type is specialized to Double. Except for the fact that the PrelRules > rules don't seem to fire, because the constants get floated out. > > Twan > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe@haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe >
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe