Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #11178

Re: Fun With Numbers

Newsgroups comp.lang.javascript
Subject Re: Fun With Numbers
From "Evertjan." <exjxw.hannivoort@interxnl.net>
References <v3rmi7l1i7ji615ltsn7mncfsh2tf6ip2k@4ax.com> <4f2ba914$0$6858$e4fe514c@news2.news.xs4all.nl> <7aeoi7d5vreent13jmtdg4pbov0dqu3su9@4ax.com>
Message-ID <Xns9FEEDA005C9B7eejj99@194.109.133.133> (permalink)
Date 2012-02-03 20:25 +0000

Show all headers | View raw


Gene Wirchenko wrote on 03 feb 2012 in comp.lang.javascript:

>>Just wondering: how do you calculate 3,62% of ($4.56 + $14.13) and
>>equal it to 3,62% of $4.56 plus 3,62% of $14.13 ?
>>Or go from euro to dollar, etc ?
> 

integer multiplication [20 items sole at ...] of currency needs to be 
exact, so do this multiplication on integer cents.
And do not convert from and to binary floating point dollars at all,
use strings.

Percentage or currency conversion needs to be rounded anyway,
so here the problem of binary math does not really exist.

============

We used to have Basic implementations with BNC [Binary Coded Decimal]-math,
those where the days!

I wrote here 20 Jan 2006:
> "Central Data Basic" for the Signetics 2650 microprocessor,
> rumored to be coded by a William Gates in the early 1980's,
> had excellent BCD support.

Nice to read that threaad again with those familiar names:
<http://bytes.com/topic/javascript/answers/447636-show-hex-numbers>


-- 
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Fun With Numbers Gene Wirchenko <genew@ocis.net> - 2012-02-02 21:23 -0800
  Re: Fun With Numbers "Tom de Neef" <tdeneef@qolor.nl> - 2012-02-03 10:29 +0100
    Re: Fun With Numbers Gene Wirchenko <genew@ocis.net> - 2012-02-03 11:57 -0800
      Re: Fun With Numbers "Evertjan." <exjxw.hannivoort@interxnl.net> - 2012-02-03 20:25 +0000
    Re: Fun With Numbers Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-02-04 15:12 +0100
  Re: Fun With Numbers Dr J R Stockton <reply1205@merlyn.demon.co.uk> - 2012-02-04 23:42 +0000

csiph-web