Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #12278
| From | Gene Wirchenko <genew@ocis.net> |
|---|---|
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: Fixed-point arithmetic library |
| Date | 2012-02-23 13:49 -0800 |
| Organization | A noiseless patient Spider |
| Message-ID | <htcdk7d017ie1sav3rh50tf9fv1hc5c3gj@4ax.com> (permalink) |
| References | <alpine.DEB.2.00.1202222012550.5334@urchin.earth.li> <9ql7jpF3mnU1@mid.individual.net> <nksak719f3qtnogigv4cunsurbv0ti1rk7@4ax.com> <ji43dm$j5o$2@localhost.localdomain> <alpine.DEB.2.00.1202232117370.23797@urchin.earth.li> |
On Thu, 23 Feb 2012 21:21:31 +0000, Tom Anderson
<twic@urchin.earth.li> wrote:
>On Thu, 23 Feb 2012, Martin Gregorie wrote:
>
>> The only fixed decimal arithmetic I've done in anger was in Cobol, which
>> will merrily do the following (Identification and Environment divisions
>> omitted for brevity).
[snipped COBOL code]
>> This would display
>>
>> " 0.800000 / 2.000000 = 0.000000 REMAINDER 0.800000"
>>
>> because, of course, it is exactly equivalent to dividing 800000 by
>> 2000000 and then adding decimal points in their correct fixed positions.
>
>... right. Yes, this is indeed not great. But i don't think this is a
If you need exact decimal representation, it is good.
>correct implementation of fixed-point; what you actually have here is
>essentially integers which are being printed with a format with dots in,
>right? A fixed-point implementation of multiplication or division needs to
Well, yes, that is about what fixed-point is. Certainly, it is a
common implementation of it.
>do some scaling to get the right answers.
COBOL handles the scaling automatically.
>> Is that what you want or is BigDecimal doing the right thing for your
>> problem space?
>
>I don't want what the COBOL does. I need to be able to divide by 2.
You can do that with COBOL. Why do you think that you can not?
Sincerely,
Gene Wirchenko
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar
Fixed-point arithmetic library Tom Anderson <twic@urchin.earth.li> - 2012-02-22 21:39 +0000
Re: Fixed-point arithmetic library Jan Burse <janburse@fastmail.fm> - 2012-02-22 22:59 +0100
Re: Fixed-point arithmetic library Tom Anderson <twic@urchin.earth.li> - 2012-02-23 21:15 +0000
Re: Fixed-point arithmetic library markspace <-@.> - 2012-02-23 13:53 -0800
Re: Fixed-point arithmetic library Robert Klemme <shortcutter@googlemail.com> - 2012-02-23 23:21 +0100
Re: Fixed-point arithmetic library Jan Burse <janburse@fastmail.fm> - 2012-02-24 00:02 +0100
Re: Fixed-point arithmetic library Robert Klemme <shortcutter@googlemail.com> - 2012-02-22 23:13 +0100
Re: Fixed-point arithmetic library Gene Wirchenko <genew@ocis.net> - 2012-02-22 14:59 -0800
Re: Fixed-point arithmetic library Martin Gregorie <martin@address-in-sig.invalid> - 2012-02-23 01:05 +0000
Re: Fixed-point arithmetic library Tom Anderson <twic@urchin.earth.li> - 2012-02-23 21:21 +0000
Re: Fixed-point arithmetic library Gene Wirchenko <genew@ocis.net> - 2012-02-23 13:49 -0800
Re: Fixed-point arithmetic library Tom Anderson <twic@urchin.earth.li> - 2012-02-23 21:16 +0000
Re: Fixed-point arithmetic library Gene Wirchenko <genew@ocis.net> - 2012-02-23 14:03 -0800
Re: Fixed-point arithmetic library Lew <noone@lewscanon.com> - 2012-02-23 14:42 -0800
Re: Fixed-point arithmetic library Gene Wirchenko <genew@ocis.net> - 2012-02-23 15:08 -0800
Re: Fixed-point arithmetic library Martin Gregorie <martin@address-in-sig.invalid> - 2012-02-23 23:05 +0000
Re: Fixed-point arithmetic library glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2012-02-27 00:59 +0000
Re: Fixed-point arithmetic library Arne Vajhøj <arne@vajhoej.dk> - 2012-02-26 20:50 -0500
Re: Fixed-point arithmetic library Robert Klemme <shortcutter@googlemail.com> - 2012-02-27 07:32 +0100
Re: Fixed-point arithmetic library Jan Burse <janburse@fastmail.fm> - 2012-02-27 13:46 +0100
Re: Fixed-point arithmetic library Roedy Green <see_website@mindprod.com.invalid> - 2012-02-24 16:26 -0800
csiph-web