|
Prev: Printing from M/F COBOL
Next: Packed decimal versus binary was Re: J4 - presentation/discussion on "Future of the COBOL Standard"
From: Howard Brazee on 7 Apr 2008 10:09 On Sat, 5 Apr 2008 10:54:00 -0600, "tlmfru" <lacey(a)mts.net> wrote: >To make correct arithmetic using only binary possible, it seems to me that >ALL numbers must be implicitly scaled to remove the decimal point. If that >is your meaning, Robert, then you haven't made it clear. Binary fractions >cannot be represented accurately - period. Some can. Some decimal fractions cannot be represented accurately by the measurement I believe you are using.
From: Howard Brazee on 7 Apr 2008 10:12 On Fri, 04 Apr 2008 21:19:36 -0600, Robert <no(a)e.mail> wrote: >That sort of ad hominem is what government and big corporations do when caught in a lie to >which they have no rational defense. Members of this august forum have more artful >responses. > >Robert: The sun rises in the east. Most of the following was amusing - but the basis is that your statement is one that nobody but a fool could argue with. To be more accurate, you should have started off with: Robert: Dogs have spots.
From: tlmfru on 7 Apr 2008 11:49 Howard Brazee <howard(a)brazee.net> wrote in message news:3nakv35t00fnkkoce1rs3cfpsfujsk57hq(a)4ax.com... > On Sat, 5 Apr 2008 10:54:00 -0600, "tlmfru" <lacey(a)mts.net> wrote: > > >To make correct arithmetic using only binary possible, it seems to me that > >ALL numbers must be implicitly scaled to remove the decimal point. If that > >is your meaning, Robert, then you haven't made it clear. Binary fractions > >cannot be represented accurately - period. > > Some can. Some decimal fractions cannot be represented accurately by > the measurement I believe you are using. Yes, you're right. I over-generalized, just a bit, though. There aren't many - only those that are a binary fraction to begin with - 1/2, 1/4, 3/4, etc. PL
From: tlmfru on 7 Apr 2008 12:08 Robert <no(a)e.mail> wrote in message news:521gv394rgj59j3d8u86clvp0a8am6857n(a)4ax.com... > On Sat, 5 Apr 2008 10:54:00 -0600, "tlmfru" <lacey(a)mts.net> wrote: > > > > >One very good reason that pure binary representation was not used is that > >decimal fractions cannot (generally) be expressed except as a repeating > >number in binary. Examples: 0.2 (decimal) = .00110011 ... (binary). .12 > >(decimal) = .000111 etc. (binary). > > To pay for something costing .50, you don't tear a dollar bill in half (a fraction), you > tender 50 pennies (an integer). > Nevertheless, if you're calculating what happened, you've spent half a dollar - unless you convert ALL the figures to pennies. > >To make correct arithmetic using only binary possible, it seems to me that > >ALL numbers must be implicitly scaled to remove the decimal point. If that > >is your meaning, Robert, then you haven't made it clear. Binary fractions > >cannot be represented accurately - period. > > I did make it clear. Here's the thread: > > >> On Mon, 31 Mar 2008 21:55:10 -0300, Clark F Morris > >> <cfmpublic(a)ns.sympatico.ca> wrote: > >> > >>>Try doing a simple divide like calculate the value of 1 / 5 in binary. > >> > >> OK. > >> > >> 01 numerator value 1 binary pic 9(9). > >> 01 denominator value 5 binary pic 9(9). > >> 01 quotient binary pic 9(9)v9(4). > >> > >> compute quotient = numerator / denominator > >> display quotient > >> > >> 0000000002000 > >> > >>>You get a never ending fraction. > >> > >> Looks pretty diadic to me. > > > >That's because you did not do it in binary, you did it in decimal. > >One-fifth is rational in decimal, but irrational in binary. > > >Nope, all three numbers are binary INTEGERS. The fallacy is in thinking of quotient as a fraction. It is not a fraction, it is an integer. > > The compiler SCALED two integers by multiplying by powers of 10, then divided two binary integers to get a quotient with no fraction. > > Binary 10 divided by binary 5 gives binary 2. > > >101111101011110000100000000 / 1100001101010000 = 11111010000 This isn't the point. The point is that with very few exceptions a decimal number with figures on both sides of the decimal point can't be represented as a pure binary number, as the fractional portion is almost always non-terminating. Binary ONE divided by binary 5 gives binary .00110011..... A scaled number is not the number itself: it's a transformation of the original. Incidentally, how do you decode that string of digits? > > >Incidentally - everybody knows about the simple algoritm to convert base 10 > >numbers to base 2 - i.e. repeated division by 2 - > >I had some fun working out the mirror algorithm to convert decimal FRACTIONS > >to binary fractions. (Very easy, actually). (Both algorithms work for any > >base). But what puzzles me is I've never seen this written up anywhere. > >I'm certain that the early developers of computers (or perhaps IBM research > >fellows) must have discovered the algorithm. Has anyone seen it written up? > Who says the number system base must be a real positive integer? I didn't. > In the negadecimal > system, which has -10 as its base, 8163 decimal becomes 12243 negadecimal as 10000 + > (-2000) + 200 + (-40) + 3. The advantage of negative base systems is they don't require a > sign. An imaginary base system such as the one proposed by Donald Knuth represents numbers > without an 'i' nor a sign. > > The ideal numeration base is an irrational called phi or golden ratio, which is 1.61803... > The only digits are 0 and 1, which makes it ideal for computers. One would expect 'our' > integers to produce infinately repeating fractions while irrational numbers produce > terminated fractions. Not so. In phinary, EVERY number can be represented exactly in a > finite string of 0s and 1s, including e, pi and square root of 2. That's a very valuable > attribute. For more on this, see: > > http://www.mcs.surrey.ac.uk/Personal/R.Knott/Fibonacci/phigits.html > http://en.wikipedia.org/wiki/Phinary > Very interesting! But doesn't answer my question. I'd really like to make an original contribution to math or computer science but I can't believe that "my algorithm" is it. PL
From: Robert on 7 Apr 2008 21:24
On Mon, 07 Apr 2008 08:12:37 -0600, Howard Brazee <howard(a)brazee.net> wrote: >On Fri, 04 Apr 2008 21:19:36 -0600, Robert <no(a)e.mail> wrote: > >>That sort of ad hominem is what government and big corporations do when caught in a lie to >>which they have no rational defense. Members of this august forum have more artful >>responses. >> >>Robert: The sun rises in the east. > >Most of the following was amusing - but the basis is that your >statement is one that nobody but a fool could argue with. To be >more accurate, you should have started off with: > >Robert: Dogs have spots. If two out of two dogs had spots, concluding that all dogs have spots would probably, but not necessaryily, be a hasty generalization. If a thousand out of a thousand dogs had spots, the generalization would probably be correct. There is a line somewhere between two and a thousand. Determining where it is requires independent knowledge of the standard deviation between dogs, and a stated confidence interval. If the deviation where known to be zero (dogs are clones), a sample size of one would be adequate. If the goal were certainty, abstraction and generalization would be impossible because we would have to sample every dog in the past, present and future. As a rule of thumb, moderate precision (90%) measurements of human opinion require 50-200 samples; high precision (98%) requires 1,000-2,000. Haven't you seen code written by 100 programmers? |