Need precision help

Reply
Contributor
Posts: 30

Need precision help


I have to get exact result of 1.12345678912345 * 2.12345678912345 I know sas can handle only up to 8 bytes but my data needs prescion rounding is not allowes please help me on this challenge to overcome on it

PROC Star
Posts: 7,363

Re: Need precision help

SAS isn't your problem .. computers can only reach a certain level of precision.

Respected Advisor
Posts: 4,654

Re: Need precision help

2.3856119461510220022193399025 . Use Windows calculator. Smiley Happy

PG

PG
PROC Star
Posts: 7,363

Re: Need precision help

@pgstats: okay, now I'm VERY curious .. how can Window's calculator do something that all of the SAS-related papers regarding numeric precision say it is a hardware limitation?

Respected Advisor
Posts: 4,654

Re: Need precision help

Just like most hand calculators, I suppose. They have tiny processors without floating point number support. They do floating point operations digit by digit, just like Astounding suggested could be done by SAS. - PG

PG
PROC Star
Posts: 1,095

Re: Need precision help

Thanks, PG Stats...just what we need, comic relief!

Seriously, back in my mainframe days I know that System/370 had a sixteen byte "extended" floating point data type. I don't know if it still exists, or what the precision is, but that's the only computing environment I've ever seen that has floating point of more that eight bytes [aside, of course, from Windows calculator :-( ]

Tom

Super User
Posts: 5,085

Re: Need precision help

If you had to, you could make SAS do it.  But you would have to jump through many hoops.  Each incoming variable would have to be stored as a set of 16 individual variables, each one digit long.  Then you could multiply each digit of one times each digit of the other, save the results, and aggregate them at the end.  But you couldn't store the result in a numeric variable or you would lose the precision that you require.  You would have to store the result as a character string.  As others have said, SAS just isn't the right tool for the job if you need that much precision.


Contributor
Posts: 30

Re: Need precision help

SAS's native arithmetic functionality is limited to 8 bytes, but this paper describes several ways to perform arbitrary-precision arithmetic with SAS.

http://www2.sas.com/proceedings/forum2008/021-2008.pdf

Ask a Question
Discussion stats
  • 7 replies
  • 280 views
  • 0 likes
  • 6 in conversation