Re: Precision problem in VBasic 6

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Tony Proctor (tony_proctor_at_aimtechnology_NoMoreSPAM_.com)
Date: 02/02/05


Date: Wed, 2 Feb 2005 18:56:23 -0000

I think the differentiation you're trying to make between storage and "math"
is a bit iffy Lee. They go hand-in-hand. I would probably have argued that
the fundamental issue was the storage format (i.e. representation as a
binary fraction can only represent accurately values which are themselves
the sum of a series of binary fractions, e.g. 2 + 1/2 + 1/8 + 1/256).
However, the "math" is an integral part of the floating-point specification.

On a different subject, the early VAX machines (back in the 80's) had
instructions specifically for decimal and numeric strings. How much of this
was in F/W and how much was in H/W was sometimes hard to tell. However,
later generations of the platform "subsetted" the instructions such that the
primary set were implemented in F/W or H/W, and the rest were emulated with
the equivalent of HAL code (I think it was called PAL code). The result was
that any compiled product that happened to use the secondary instructions
might run about 20 times slower on the new generations. DEC's assumption was
that all code was generated by their own compilers, which was rubbish.
Unfortunately, the company I was with at the time was caught out because
they used a special form of the loop-control instruction that was suddenly
classed as an emulated instruction.

...all that in the interests of processor performance, eh!

            Tony Proctor

P.S. VAX also had instructions for 128-bit H-format floating point. :-)
When they replaced the VAX h/w with Alpha AXP, they didn't include this
format because "no one uses it". Guess who was caught out yet again :-(

"Lee Peedin" <lpeedinREMOVE@UPPERCASEnc.rr.com> wrote in message
news:j6k101t8kaknuk5llhpv6tsgtj2gmlm3te@4ax.com...
> Ken,
> Please accept my apology for "jumping the gun" in regards to your
> statement. Whenever I see "floating point" & "all languages" used in
> the same sentence, I get a bit "defensive". :-) You did, in fact
> clarify your statement with "(that use the same floating point spec)".
> I completely missed that.
> It is "hoped" that by the time the next generation of hardware hits
> the streets, that Decimal Arithmetic will be part of that hardware. I
> know for a fact that much work is being done to get this implemented.
>
> Lee
>
> On Tue, 01 Feb 2005 18:25:37 GMT, Lee Peedin
> <lpeedinREMOVE@UPPERCASEnc.rr.com> wrote:
>
> >On Tue, 1 Feb 2005 07:25:41 -0800, "Ken Halter"
> ><Ken_Halter@Use_Sparingly_Hotmail.com> wrote:
> >
> >>
> >>Note that it's not a VB specific problem (in case your search didn't
turn up
> >>anything useful), it's a problem with the way the data is stored in ram
and
> >>effects all languages (that use the same floating point spec)
> >
> >Ken,
> >I must disagree with that statement - the problem is the use of binary
> >math, to which there is no way to properly represent fractional
> >numbers. Not all programing languages use binary math - Rexx in all
> >flavors and platforms uses decimal math. See the very simple example
> >below.
> >
> >Lee Peedin
> >VP RexxLA
> >
> >/* showmath.rex */
> >
> >numeric digits(15)
> >
> >var = 1
> >do aa = 1 to 25
> > var = var - .1
> > say var
> >end
> >exit
> >
> >c:\Rexx_Trials>showmath
> >0.9
> >0.8
> >0.7
> >0.6
> >0.5
> >0.4
> >0.3
> >0.2
> >0.1
> >0
> >-0.1
> >-0.2
> >-0.3
> >-0.4
> >-0.5
> >-0.6
> >-0.7
> >-0.8
> >-0.9
> >-1.0
> >-1.1
> >-1.2
> >-1.3
> >-1.4
> >-1.5
> >
> >c:\Rexx_Trials>
>



Relevant Pages

  • Re: you cant bash Microsoft enough
    ... The math format is 32.32, ... Instructions like sub and mov are ... and the FPGA gets warmer than the CPU. ... serious multiple of the processor lifetime. ...
    (sci.electronics.design)
  • Re: OT: Wheeeeee! New PSpice Benchmarks
    ... >>requires fast low accuracy math and a bunch of memory transfers that don't ... The AMD may do both better. ... when using the old stack-style instructions for FP math. ... to simulate SMP multithreading when choosing the highest performing chips. ...
    (sci.electronics.cad)
  • Re: OT: Wheeeeee! New PSpice Benchmarks
    ... >>requires fast low accuracy math and a bunch of memory transfers that don't ... The AMD may do both better. ... when using the old stack-style instructions for FP math. ... to simulate SMP multithreading when choosing the highest performing chips. ...
    (sci.electronics.design)
  • Re: you cant bash Microsoft enough
    ... The math format is 32.32, a longword of signed integer ... Instructions like sub and mov are ...
    (sci.electronics.design)
  • Re: you cant bash Microsoft enough
    ... The math format is 32.32, a longword of signed integer ... Instructions like sub and mov are ...
    (sci.electronics.design)