[comp.sys.handhelds] Another 48SX bug?

dmh@goanna.cs.rmit.OZ.AU (Darren Hosking) (05/03/90)

Try the following:

'3*X/3' COLCT

This should collect things in the expression and give 'X' but it actually
gives the incorrect result of '.999999999999*X'.

Is this another bug?

	dmh

ps BTW, I have ROM version A.

Darren Hosking				ACSnet: dmh@goanna.oz	 
Department Of Computer Science		ARPA:   dmh%goanna.oz.au@uunet.uu.net
RMIT					CSNET:  dmh%goanna.oz.au@australia
GPO Box 2476V				UUCP:   ...!uunet!goanna.oz.au!dmh
Melbourne Vic., Australia 3001

jdg@hpqtdla.HP.COM (James Gentles) (05/03/90)

>'3*X/3' COLCT
>This should collect things in the expression and give 'X' but it actually
>gives the incorrect result of '.999999999999*X'.
>Is this another bug?

The 28S does this too.
I'll guess it's a precision problem rather than a bug.

James Gentles

---------------------------------------------------------------------
      I have no professional connection with Hewlett-Packard's 
    calculator operations other than as a user of their products.
---------------------------------------------------------------------
Opinions expressed are my own, and are not intended to be an official
              statement by Hewlett-Packard Company
---------------------------------------------------------------------
Name:         James Gentles   GM4WZP
Organization: Hewlett-Packard  Queensferry Telecomunications Division
Email:        jdg@hpqtdla.hpsqf.hp.com                         hp-sdd 
Address:      Station Road, South Queensferry, West Lothian, Scotland
---------------------------------------------------------------------

TDSTRONG@MTUS5.BITNET (Tim Strong) (05/04/90)

>Try the following:
>
>'3*X/3' COLCT
>
>This should collect things in the expression and give 'X' but it actually
>gives the incorrect result of '.999999999999*X'.
>
>Is this another bug?

No.  It's rounding error.  The calculator has to round off somewhere.  It's
a common occurance in computer programming.  Often one has to make special
efforts to eliminate it or ignore it in programs.  For example,

     7 SQRT SQR

Will probably not give back 7 either.  Though with the number of digits
the 48 carries out inside (I hear its 15).  it could.  The inportant thing
to realize is that rounding error will occur and you just have to work around
it.

HP made large strides on the 28 just making 'SIN(pi)' come out zero.  Try
      pi ->NUM SIN
and you'll see what I mean.

===========================================================================
     ___                     Tim Strong  <TDSTRONG@MTUS5.BITNET>
     |__)  _   _|  _   _     Michigan Technological University
     |   (_| (_| (_| |      Houghton, MI  49931
                                        U.S.A.
===========================================================================