Problem Note 3510: ROUND function problems in Release 8.1 TSLEVEL 1M0
Beginning in Release 8.1 TSLEVEL 1M0, changes were made to the ROUND
function to address a long-standing problem with roundoff units which
are not even multiples of 10. Unfortunately the change also affected
ROUND's behavior with roundoff units which are even multiples of 10,
thus causing problems with code that produced expected results in
earlier releases.
This is an example that produces correct results prior to Release 8.1
and again beginning with Release 8.2, but fails in 8.1. The code
should correctly produce "RIGHT":
DATA _NULL_;
IF (ROUND(.3+1E-13,.1)=.3) THEN PUT 'RIGHT';
ELSE PUT 'WRONG';
RUN;
To correctly compare floating point values in a finite precision
environment, SAS recommends that sites make use of the following
macro:
%MACRO FUZZCOMP(X,Y,EPS=1E-12);
(ABS(&X-&Y) LE &EPS*MAX(ABS(&X),ABS(&Y)))
%MEND;
invoked as:
IF %FUZZCOMP(VAR1,VAR2) THEN...
in place of ROUND functions and a test for strict equality, as:
IF ROUND(VAR1,round-off-unit) EQ ROUND(VAR2,round-off-unit) THEN...
Performing a "fuzzy" comparison eliminates possible problems caused by
variations in the representation of floating point values from one
host platform to another. Using FUZZCOMP in Release 8.1 circumvents
the ROUND function problem.
A Technical Support hot fix for Release 8.1 TSLEVEL TS1M0 for this
issue is available at:
http://www.sas.com/techsup/download/hotfix/81_sbcs_prod_list.html#003510
This problem is corrected in Release 8.2 TSLEVEL 2M0 and beyond.
Operating System and Release Information
| Product Family | Product | System | Reported Release | Fixed Release* |
| SAS System | Base SAS | Microsoft Windows 95/98 | 8.1 TS1M0 | 8.2 TS2M0 |
| Microsoft Windows 2000 Datacenter Server | 8.1 TS1M0 | 8.2 TS2M0 |
| Microsoft Windows 2000 Server | 8.1 TS1M0 | 8.2 TS2M0 |
| Microsoft Windows 2000 Professional | 8.1 TS1M0 | 8.2 TS2M0 |
| Solaris | 8.1 TS1M0 | 8.2 TS2M0 |
| OpenVMS VAX | 8.1 TS1M0 | 8.2 TS2M0 |
| Microsoft Windows 2000 Advanced Server | 8.1 TS1M0 | 8.2 TS2M0 |
| 64-bit Enabled Solaris | 8.1 TS1M0 | 8.2 TS2M0 |
| OS/2 | 8.1 TS1M0 | 8.2 TS2M0 |
| IRIX | 8.1 TS1M0 | 8.2 TS2M0 |
| z/OS | 8.1 TS1M0 | 8.2 TS2M0 |
| ABI+ for Intel Architecture | 8.1 TS1M0 | 8.2 TS2M0 |
| 64-bit Enabled HP-UX | 8.1 TS1M0 | 8.2 TS2M0 |
| OpenVMS Alpha | 8.1 TS1M0 | 8.2 TS2M0 |
| HP-UX | 8.1 TS1M0 | 8.2 TS2M0 |
| CMS | 8.1 TS1M0 | 8.2 TS2M0 |
| 64-bit Enabled AIX | 8.1 TS1M0 | 8.2 TS2M0 |
| Tru64 UNIX | 8.1 TS1M0 | 8.2 TS2M0 |
| AIX | 8.1 TS1M0 | 8.2 TS2M0 |
| Microsoft Windows NT Workstation | 8.1 TS1M0 | 8.2 TS2M0 |
*
For software releases that are not yet generally available, the Fixed
Release is the software release in which the problem is planned to be
fixed.
| Type: | Problem Note |
| Priority: | high |
| Topic: | SAS Reference ==> Functions
|
| Date Modified: | 2002-04-16 12:28:42 |
| Date Created: | 2000-09-26 12:05:53 |