LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (January 2002, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 16 Jan 2002 09:51:13 -0000
Reply-To:     Nigel.Pain@SCOTLAND.GSI.GOV.UK
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Nigel Pain <Nigel.Pain@SCOTLAND.GSI.GOV.UK>
Subject:      Re: mod-function
Content-Type: multipart/alternative;

***************************************************************************** This email and any files transmitted with it are intended solely for the use of the individual or entity to whom they are addressed. *****************************************************************************

> -----Original Message----- > From: John Whittington [mailto:John.W@MEDISCIENCE.CO.UK] > Sent: 15 January 2002 15:17 > Subject: Re: mod-function > > > At 08:29 15/01/02 -0500, Roger Lustig wrote (in part): > > >Engelbert: > >I get the expected zeroes under Win2K/8.2. *Very* strange! > >What aspects of your program have you varied? Does the LENGTH > >statement change things, for instance? > >Needless to say, mod(anything,n) should *never* return a value of n. > > That is indeed correct; mod(anything,n) can never return a > value equal to > or greater than n. However, I'm sure the point with > Englebert's example is > that what the mod() function is returning only _appears_ to > be 'n' because > of the precision with which it is being displayed. As we > discuss so often > here, 25.4 cannot be stored precisely in binary, so 25.4*50 > will not be > EXACTLY 1270 within the machine.

And Roger is correct to question the length statement. This gives all numeric variables a length of 4 bytes, which considerably reduces the precision with which decimals can be stored. It is important to use the maximum length (8) for numbers which may have a fractional portion to them so that precision is maximised.

*************************************************** Nigel Pain Scottish Executive Development Department Business Support Unit Victoria Quay EDINBURGH EH6 6QQ UK Tel +44 131 244 7237 Fax +44 7092 014235

Mailto:nigel.pain@scotland.gsi.gov.uk Website: http:\\www.scotland.gov.uk


[text/html]


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