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 |
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.R | Title | User | Personal Name | Date | Lines |
---|---|---|---|---|---|
632.1 | There are alternative approaches... | MODEL::YARBROUGH | Thu Dec 18 1986 14:51 | 16 | |
> 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.2 | 1's and 0's | EAGLE1::DANTOWITZ | Ho, ho, ho ... (-:|>* | Thu Dec 18 1986 16:19 | 13 |
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.3 | MP | ENGINE::ROTH | Fri Dec 19 1986 08:29 | 8 | |
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 |