Date: Tue, 13 Jun 2000 09:56:36 -0400 Nigel Pain "SAS(r) Discussion" Nigel Pain Re: 7.3 + 0.1

On Tue, 13 Jun 2000 08:12:13 +0100, Roland <roland.rashleigh- berry@VIRGIN.NET> wrote:

<Clip> >And people pay money for this? > </Clip>

This is a "feature" that is impossible to solve as long as the human brain works in Base 10 and computers work in Binary. This is because practically all decimal fractions resolve to a binary fraction requiring an infinite number of digits (try converting 7.3 or 7.4 to binary, and see where it leads you).

When comparing fractional numbers, I always incorporate them into ROUND functions as in (to use your program):

data _null_; x=7.3; x=x+0.1; put x=hex16.; if ROUND(x,0.1)=ROUND(7.4,0.1) then put '>>>>> equals 7.4 >>>>'; else put '>>>>>>>> not equal to 7.4 >>>>>'; run;

*************************************************** Nigel Pain Scottish Executive Development Department Business Support Unit Victoria Quay EDINBURGH EH6 6QQ UK Tel +44 131 244 7237 Fax +44 131 244 7281 Mailto:nigel.pain@scotland.gov.uk Website: http:\www.scotland.gov.uk

Back to: Top of message | Previous page | Main SAS-L page