473,657 Members | 2,418 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Oracle vs. SAS numerics - any ideas?

Hi, all,

I posted a similar message at comp.soft-sys.sas.

I used code like the following via SAS PROC SQL pass-thru to create a
table named user.tmp in Oracle:

drop table user.tmp;
create table user.tmp ( cnum varchar(5), xnum number );
insert into user.tmp values ( '0.001', null );
insert into user.tmp values ( '0.056', null );
insert into user.tmp values ( '0.432', null );
update user.tmp set xnum = to_number( cnum );

and then in SAS I fetched the data with code like:

proc sql;
connect to oracle ( ... );
create table work.tmp as
select *
from connection to oracle
( select cnum,
xnum,
dump(xnum) dnum,
rawtohex(xnum) hnum
from user.tmp );
disconnect from oracle;
quit;

Then, I manually calculated (%chartohex) the binary equivalent of cnum
beyond the IEEE representation used on Alpha OpenVMS SAS (double
precision), and compared that extended result with the internal
representation of xnum after it had been copied to SAS:

data work.tmp;
set work.tmp;
orahex = put( xnum, hex16. );
sasnum = input( cnum, ??best32. );
sashex = put( sasnum, hex16. );
%chartohex( cnum, bint, bfrac, bin, hex, max = 53 );
nbit = substr( bin, 53, 1 );
run;
proc print; run;

and got this:

Obs CNUM DNUM HNUM
1 0.001 Typ=2 Len=2: 191,11 BF0B
2 0.056 Typ=2 Len=3: 192,6,61 C0063D
3 0.432 Typ=2 Len=3: 192,44,21 C02C15

Obs ORAHEX SASHEX HEX NBIT

1 3F50624DD2F1A9F C 3F50624DD2F1A9F C 3F50624DD2F1A9F BE 1
2 3FACAC083126E97 8 3FACAC083126E97 9 3FACAC083126E97 8D 1
3 3FDBA5E353F7CED A 3FDBA5E353F7CED 9 3FDBA5E353F7CED 91 0

I am reasonably sure that the %CHARTOHEX macro correctly calculated
the extra HEX nibble. It confirms that the values of SASHEX are
rounded.

But the values of ORAHEX do not appear to be consistently rounded.

Obs=1 appears to have rounded HEX=...A9FBE to ORAHEX=...A9FC, as
expected since NBIT=1. In this case, I got the same result as in
SASHEX.

But Obs=2 appears to have truncated rather than rounded up, from
HEX=...E978D to just ORAHEX=...E978, even though NBIT=1 (next bit).

Worse yet, for Obs=3 rounded up from HEX=...CED91 to ORAHEX=...CEDA,
even though NBIT=0.

I cannot tell if this occurred in "connection to oracle" on the SAS
side somewhere, or if the conversion to IEEE was done on the Oracle
side. So, I don't know exactly where these roundings and truncations
are occurring.

Note that the values of SASHEX round up when NBIT=1, and round down
when NBIT=0, as expected.

Does anyone know why there is such inconsistency in the ORAHEX
results, or what rule makes them consistent?

Thanks!
Andy
Jul 19 '05 #1
0 4784

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
9171
by: Cherrish Vaidiyan | last post by:
Hello all, A warm Xmas greetings to all. I have a small problem with starting up the database. Here my strategy. I have installed Oracle 9i R 2 on Red Hat 9. i created two database on this system. And the two datasbe is working perfectly. Now i needed another RH9 system to work on Oracle 9i. So I was guided to copy the oracle home folder and that the oracle will be up for work. I even got such a response from Google Group. I copied...
0
1386
by: Kong Li | last post by:
Follow up to this thread, the latest Oracle 9i release 2 patchset (9.2.0.5) fixed the handle count leak problem. The problem is in Oracle client component. Thanks. Kong ----- From: Kong Li (likong@email.com)
3
4071
by: Manzanita | last post by:
Hi. I'm using boost::numerics::ublas to solve linear symmetric and hermitian systems (cholesky, qr, etc.). I'm aware that ublas only provide basic algebra operations (blas1, blas2 and blas3) so i've tried some other libraries to work with ublas, with no success so far. In order to do so i downloaded boost::numerics::bindings (which aren't available in www.boost.org right now but in the list which boost developers have in yahoo), those...
11
13269
by: Ellen K | last post by:
Hi all, I set up our Oracle Financials as a linked server to one of my SQL Server boxes. On running a test query, I got the following error message: OLE DB provider 'MSDAORA' supplied inconsistent metadata for a column. Metadata information was changed at execution time. OLE DB error trace . The Oracle datatype of the column with the supposedly inconsistent
4
7228
by: Roger Redford | last post by:
Dear Experts, I'm attempting to marry a system to an Oracle 817 datbase. Oracle is my specialty, the back end mainly, so I don't know much about java or javascript. The system uses javascript to make ODBC calls to the db. The particular system I'm working with, will not work with an Oracle stored procedure I'm told. However, it
0
1114
by: Larry Baxter | last post by:
We have some computationally intense code that would greatly benefit from any floating point performance enhancement we could find. We have tests valarrays vs vectors at all optimization levels but find no difference in performance depspite the supposed potential superior efficiency of valarrys under aggressive optimization. Less formal tests of similar code under VC++6 appeared to yield significant performance advantages. Any ideas on...
2
11229
by: rob merritt | last post by:
Hi I have a simple problem hopefully. how would I replace all no numerics using <string name>.regex if if I have a string like 123456.309.123456 or 123456-307-123456 or
8
1855
by: Learner | last post by:
Hello, I have a situation that I need to be able to identify if there are any numerical values in a string variable that might have numerics including charecters. For instanse Dim strValue as stirng strValue = "Inside Diameter=9" then how to identify the numerical value 9 in it.
0
273
by: A. Barnet | last post by:
Hi, all, I posted a similar message at comp.soft-sys.sas. I used code like the following via SAS PROC SQL pass-thru to create a table named user.tmp in Oracle: drop table user.tmp; create table user.tmp ( cnum varchar(5), xnum number ); insert into user.tmp values ( '0.001', null );
0
8829
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8734
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8508
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7341
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6172
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5633
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4164
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4323
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2733
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.