[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference rusure::math

Title:Mathematics at DEC
Moderator:RUSURE::EDP
Created:Mon Feb 03 1986
Last Modified:Fri Jun 06 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:2083
Total number of notes:14613

632.0. "Floating point binary" by EAGLE1::DANTOWITZ (Ho, ho, ho ... (-:|>* ) Thu Dec 18 1986 11:31

	Does anyone have a maple routine that will convert a 
	floating point number to binary?

	e.g.  bin(0.5) will output/return "0.1"

	I guess it might be reasonable to add an argument that
	tells the routine the maximum number of bits in the
	answers.

	David
T.RTitleUserPersonal
Name
DateLines
632.1There are alternative approaches...MODEL::YARBROUGHThu Dec 18 1986 14:5116
>	Does anyone have a maple routine that will convert a 
>	floating point number to binary?
>
>	e.g.  bin(0.5) will output/return "0.1"

It would be easier to answer if I knew what your REAL problem is. MAPLE
will let you do some arcane conversions, e.g. 'convert(.25,binary);'
produces '1/4', and 'ifactor(denom(convert(.125,binary)));' produces 2^3,
so you can know how many bits an exact power of 2 requires, for example.

There are some other tools around that do binary representations more
readily than MAPLE. FORTRAN will output numbers in octal easily enough.
Why do you WANT the binary? Maybe there is a higher-level expression of
your real problem that MAPLE is more suited to solving. 

Lynn Yarbrough
632.21's and 0'sEAGLE1::DANTOWITZHo, ho, ho ... (-:|>* Thu Dec 18 1986 16:1913
	I'd just like to see the ones and zeros in the mantissa.

	The problem involves accuracy and representation of
	floating point numbers.  Using MAPLE I can get better
	accuracy than H_floating representations (I am of
	course making the assumption that MAPLE is correct).

        The routine is simple in nature and I was just curious
	if someone had done it already.  (Why reinvent the wheel.)
	I'll get around to it myself eventually.

	David
632.3MPENGINE::ROTHFri Dec 19 1986 08:298
    If you need extraordinary accuracy without a lot of algebraic processing,
    the package MP (written up in the ACM Trans on Math Software some time
    back) is a possibility.  There are some notes about early on.

    I should still have a copy (which I got from another MATH noter long
    ago).

    - Jim