Re: how do I get more numbers past the decimal?
- From: Jerry Stuckle <jstucklex@xxxxxxxxxxxxx>
- Date: Fri, 07 Aug 2009 07:48:42 -0400
The Natural Philosopher wrote:
Jake Barnes wrote:On Aug 5, 11:45 pm, Jerry Stuckle <jstuck...@xxxxxxxxxxxxx> wrote: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.Jake Barnes wrote:On Aug 1, 7:12 pm, gordonb.v6...@xxxxxxxxxxx (Gordon Burditt) wrote:For very high precision, programmers use binary coded decimal (BCD).Interesting stuff. So for the multi precision arithmetic, programmersHow are you getting even that many? A floating point number is storedThat's one format. Other common (IEEE standard) formats are 64
on a 32 bit machine using the 24 bit for the mantissa and its sign and 8
bits for the exponent and its sign.
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.
switch to the 64 bit or 80 bit floating point formats?
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:
"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
==================
.
- Follow-Ups:
- Re: how do I get more numbers past the decimal?
- From: Doug Miller
- Re: how do I get more numbers past the decimal?
- From: The Natural Philosopher
- Re: how do I get more numbers past the decimal?
- References:
- how do I get more numbers past the decimal?
- From: Jake Barnes
- Re: how do I get more numbers past the decimal?
- From: sheldonlg
- Re: how do I get more numbers past the decimal?
- From: Gordon Burditt
- Re: how do I get more numbers past the decimal?
- From: Jake Barnes
- Re: how do I get more numbers past the decimal?
- From: Jerry Stuckle
- Re: how do I get more numbers past the decimal?
- From: Jake Barnes
- Re: how do I get more numbers past the decimal?
- From: The Natural Philosopher
- how do I get more numbers past the decimal?
- Prev by Date: Re: exec() has a syntax error, need an index.php page, cURL script
- Next by Date: Re: exec() has a syntax error, need an index.php page, cURL script
- Previous by thread: Re: how do I get more numbers past the decimal?
- Next by thread: Re: how do I get more numbers past the decimal?
- Index(es):
Relevant Pages
|