Re: [Haskell-cafe] Converting from Int to Double

2005-01-27 Thread Dmitri Pissarenko
Thanks! -- Dmitri Pissarenko Software Engineer http://dapissarenko.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Converting from Int to Double

2005-01-26 Thread Jorge Adriano Aires
> >> How can I convert an Int into a Double? > > > > You don't convert to, you convert from :-) > > The function 'fromIntegral' is probably what you want. > > And what function can I use to convert from Double to Int (the inverse of > fromIntegral) ? Use the functions in the RealFrac class. http:

Re: [Haskell-cafe] Converting from Int to Double

2005-01-26 Thread Stefan Holdermans
Dmitri, And what function can I use to convert from Double to Int (the inverse of fromIntegral) ? You should really have a look at the Prelude and the Standard Libraries. Well, it depends on *how* you want to convert. truncate :: (RealFrac a, Integral b) => a -> b round :: (RealFrac a, Integral b)

Re: [Haskell-cafe] Converting from Int to Double

2005-01-26 Thread Dmitri Pissarenko
How can I convert an Int into a Double? You don't convert to, you convert from :-) The function 'fromIntegral' is probably what you want. And what function can I use to convert from Double to Int (the inverse of fromIntegral) ? TIA Dmitri Pissarenko -- Dmitri Pissarenko Software Engineer http://dap

Re: [Haskell-cafe] Converting from Int to Double

2005-01-26 Thread Ketil Malde
Dmitri Pissarenko <[EMAIL PROTECTED]> writes: > How can I convert an Int into a Double? You don't convert to, you convert from :-) The function 'fromIntegral' is probably what you want. -kzm -- If I haven't seen further, it is by standing in the footprints of giants ___

Re: [Haskell-cafe] Converting from Int to Double

2005-01-26 Thread Stefan Holdermans
Dmitri, How can I convert an Int into a Double? fromIntegral :: (Integral a, Num b) => a -> b HTH, Stefan ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Converting from Int to Double

2005-01-26 Thread Dmitri Pissarenko
Zitat von Henning Thielemann <[EMAIL PROTECTED]>: On Wed, 26 Jan 2005, Dmitri Pissarenko wrote: How can I convert an Int into a Double? fromIntegral Thanks! -- Dmitri Pissarenko Software Engineer http://dapissarenko.com ___ Haskell-Cafe mailing list Haske

Re: [Haskell-cafe] Converting from Int to Double

2005-01-26 Thread Henning Thielemann
On Wed, 26 Jan 2005, Dmitri Pissarenko wrote: > How can I convert an Int into a Double? fromIntegral ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] Converting from Int to Double

2005-01-26 Thread Dmitri Pissarenko
Hello! I have a list of integer numbers (grayscale values from 0 to 255) and want to convert them to a list of double numbers, so that each number is 0 <= x <= 1, where 0 is completely black and 1 is completely white. Before I convert the numbers, I need to convert them to a list of double values