SPSS 17: wrong result computing 3 * 0.7

classic Classic list List threaded Threaded
22 messages Options
12
Reply | Threaded
Open this post in threaded view
|

Re: SPSS 17: wrong result computing 3 * 0.7

Art Kendall
On VAX machines in FORTRAN  using long precision  Real * 16   or
Integer*16 is very useful when a great deal of precision is needed.

A floating point number has 31 places of accuracy and IIRC exponents of
more than 4000.  IIRC that allowed numbers larger than 700!

Does the 64-bit version of SPSS  give real*8 or real*16?

Art Kendall
Social Research Consultants

Richard Ristow wrote:

> At 07:39 AM 11/14/2008, Art Kendall wrote:
>
>> One of the languages on the DEC-10 around the mid 70s   APL?  Algol?
>> MACRO? had compares the considered the fuzz.
>
> The APL implementation for the IBM 360 used a 'fuzz'; that is,
> numbers were taken as equal in comparisons if they were equal within
> a small fraction (the 'fuzz'). I imagine other implementations did as
> well, since it was taken as an inherent feature of the language.
>
>> It was very common in other languages to multiply by a constant so
>> that more of the digits were to the left of the decimal point and
>> then rounding or truncating before doing the compare.
>
> It was, and is, wisest in all programming languages, to ensure that
> values that must be retained exactly be integers, only. For example,
> accounting programs in languages using floating-point arithmetic keep
> (United States) currency values in cents, rather than in dollars and
> cents ($12.45).
>
> Fuzzy comparison eliminates most cases where two quantities that you
> expect to be equal aren't considered so by the program, but it should
> never be relied on when exact comparison is critical. (Nor is it
> reliable when the precision of the numbers approaches the maximum
> precision of the representation; however, that is rare with 64-bit
> floating-point precision.)
>
> =====================
> To manage your subscription to SPSSX-L, send a message to
> [hidden email] (not to SPSSX-L), with no body text except the
> command. To leave the list, send the command
> SIGNOFF SPSSX-L
> For a list of commands to manage subscriptions, send the command
> INFO REFCARD
>
>

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Art Kendall
Social Research Consultants
Reply | Threaded
Open this post in threaded view
|

Re: SPSS 17: wrong result computing 3 * 0.7

David Hitchin
Quoting Art Kendall <[hidden email]>:

> On VAX machines in FORTRAN  using long precision  Real * 16   or
> Integer*16 is very useful when a great deal of precision is needed.
>
> A floating point number has 31 places of accuracy and IIRC exponents
> of more than 4000.  IIRC that allowed numbers larger than 700!
>
This is all rather theoretical. How many of the data values entered into
SPSS have more than a few significant figures of accuracy? You could
measure my height and write it down to 31 decimal places, but it depends
on the time of day, how straight I stand - even the temperature of the
ruler which will expand when it gets warm. Most measurements get fuzzy
after a few significant figures.

If you record the years 2005, 2007, 2007, etc you might think that you
have equal time intervals, but in fact a leap year is .27% longer than
an ordinary one.

Remember that nearly all data values are fuzzy, and however precisely
SPSS does its calculations and prints them, fuzzy data produces results
which should be interpreted as lying within a range of fuzziness.

David Hitchin

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
12