Re: how do I get more numbers past the decimal?



The Natural Philosopher wrote:
Jake Barnes wrote:
On Aug 5, 11:45 pm, Jerry Stuckle <jstuck...@xxxxxxxxxxxxx> wrote:
Jake Barnes wrote:
On Aug 1, 7:12 pm, gordonb.v6...@xxxxxxxxxxx (Gordon Burditt) wrote:
How are you getting even that many? A floating point number is stored
on a 32 bit machine using the 24 bit for the mantissa and its sign and 8
bits for the exponent and its sign.
That's one format. Other common (IEEE standard) formats are 64
bits and 80 bits. Yes, on a 32-bit machine, with Intel and AMD x86
architectures being prominent examples. In fact the same floating-point
formats are used on an (ancient) 8086/8087 combination, which is
generally referred to as a *16* bit processor. There's also the
(ancient) 8088/8087 combination, which by one attribute, the width
of the external data bus, makes it an *8* bit processor (but still
with 32-bit, 64-bit, and 80-bit floating-point formats).
PHP implementations tend to use IEEE doubles on machines that have
IEEE doubles.
32-bit floating point numbers tend to have not enough precision to
do much with them, especially after taking into account cascading
errors in a complicated calculation. Ok, maybe you could calculate
(for some USA states) sales tax on something cheap, but not on a
company jet or high-end luxury car, without having to resort to
multi-precision arithmetic.
Interesting stuff. So for the multi precision arithmetic, programmers
switch to the 64 bit or 80 bit floating point formats?
For very high precision, programmers use binary coded decimal (BCD).
It's slower - but can be as accurate as you want. That's what they use
to calculate pi to multi-billion decimal places, for instance (of
course, they don't use a PC for it! :-) ).


This page makes it seem like there are several variations on BCD:

http://en.wikipedia.org/wiki/Binary-coded_decimal

I'm curious which of these variations is considered high precision?
I'm confused by this bit, which sounds like it lacks precision:


Dont worry. Jerry was talking out of his arse. BCD is no more and no less accurate on generic numbers than anything else., its virtue is its exact reproduction of decimal numbers like 12.3456.

"BCD is very common in electronic systems where a numeric value is to
be displayed, especially in systems consisting solely of digital
logic, and not containing a microprocessor. By utilizing BCD, the
manipulation of numerical data for display can be greatly simplified
by treating each digit as a separate single sub-circuit. This matches
much more closely the physical reality of display hardware—a designer
might choose to use a series of separate identical 7-segment displays
to build a metering circuit, for example. If the numeric quantity were
stored and manipulated as pure binary, interfacing to such a display
would require complex circuitry. Therefore, in cases where the
calculations are relatively simple working throughout with BCD can
lead to a simpler overall system than converting to binary.

The same argument applies when hardware of this type uses an embedded
microcontroller or other small processor. Often, smaller code results
when representing numbers internally in BCD format, since a conversion
from or to binary representation can be expensive on such limited
processors. For these applications, some small processors feature BCD
arithmetic modes, which assist when writing routines that manipulate
BCD quantities."


Fair comment really.
With BCD you generally use one byte per significant digit, so its as precise on the mantissa as the number of bytes allocated.




Which once again shows you're stupidity. ROFLMAO!

Processors use one nibble per digit (two digits per byte). But if you really were an engineer like you claim, you'd know that. Or, if you ever coded in assembler, you'd know that.

The idiot has been caught (again)!

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@xxxxxxxxxxxxx
==================
.



Relevant Pages

  • Re: how do I get more numbers past the decimal?
    ... Other common formats are 64 ... So for the multi precision arithmetic, ... BCD is no more and no less accurate on generic numbers than anything else., its virtue is its exact reproduction of decimal numbers like 12.3456. ... With BCD you generally use one byte per significant digit, so its as precise on the mantissa as the number of bytes allocated. ...
    (comp.lang.php)
  • Re: how do I get more numbers past the decimal?
    ... Other common formats are 64 ... So for the multi precision arithmetic, ... BCD is no more and no less accurate on generic numbers than anything else., its virtue is its exact reproduction of decimal numbers like 12.3456. ... With BCD you generally use one byte per significant digit, so its as precise on the mantissa as the number of bytes allocated. ...
    (comp.lang.php)
  • Re: how do I get more numbers past the decimal?
    ... Other common formats are 64 ... So for the multi precision arithmetic, ... BCD is no more and no less accurate on generic numbers than anything else., its virtue is its exact reproduction of decimal numbers like 12.3456. ... manipulation of numerical data for display can be greatly simplified ...
    (comp.lang.php)
  • Re: how do I get more numbers past the decimal?
    ... Other common formats are 64 ... So for the multi precision arithmetic, ... This page makes it seem like there are several variations on BCD: ... Intel chips also support bcd natively, but only up to 7 or 8 digits. ...
    (comp.lang.php)
  • Re: How to hande SAP BCD numrics in RPGLE
    ... program that connects to a remote Unix SAP server to retrieve cost ... BCD data is just like packed except that there is no sign. ... last digit is the next to last digit, ... the zero digit), you will then have the actual number. ...
    (comp.sys.ibm.as400.misc)