This does not handle decimals and is untested.   John Hughes wrote a great
article on how to derive these functions a while back, but I don't
remember the name/url.

> toBase x base = if (x<base) then [convert x] else (convert digit):(toBase rem base)
>  where convert x = toEnum (x+ascii_0)
>        digit = x - rem
>        rem = x `div` base
>        ascii_0=48

On Mon, 19 Apr 1999, CC600800 wrote:

>       Can anyone help me write a function to convert a decimal number into
> its binary equivalent?
>       Much appreciated.
> 
>       JF
> 

___________________________________________________________________
S. Alexander Jacobson                   Shop.Com
1-212-697-0184 voice                    The Easiest Way To Shop



Reply via email to