Ken T. wrote:
On Fri, 24 Jul 2009 11:29:19 -0400, Jeff Higgins wrote:
Is anyone aware of a BigBinary class? It would be like BigDecimal, but
for base-2 numbers.
Depending on what you want this for, you might also consider
BitSet. We can't really tell what features of BigDecimal you want
from your post. Could you provide more information?
Hi,
yup thanks. I've been reading about fixed-point arithmetic.
Among many others:
Fixed-Point Arithmetic: An Introduction
<http://www.digitalsignallabs.com/fp.pdf>
Optimizing Fixed Point (FP) Math with J2ME
<http://www.devx.com/Java/Article/21850>
IAppli Fixed Point Math Library
<http://www.beartronics.com/imode/fplib/index.html>
As suggested by Patricia Shanahan, this would be more
a convenience class.
As suggested by rossum, this is mostly a learning exercise.
So far no one has responded, "Sure use woodie's BB class...,
so Eric Sosman's suggestion seems on target. I'm not sure about
"without much trouble" knowing myself as I do.
[Maybe there is something I'm missing,
(not understanding)with BigDecimal/Integer]
Anyway, I think what I'd like to see is something like:
enum BRep{ONES,TWOS,NATURAL;}
maybe BinaryMathContext extends MathContext
BigBinary(byte[] value, int width, int radix, boolean signed, BRep r)
BigBinary(int value, int width, int radix, boolean signed, BRep r)
BigBinary(BitSet value, int width, int radix, boolean signed, BRep r)
etc. ...
arithmetic methods
conversion methods
properties methods
maybe scaling, bit manipulation methods?