- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - OpenVMS
- >
- How to Convert "long double" to IEEE?
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-26-2006 04:47 AM
01-26-2006 04:47 AM
In my program, I call the function in this way, "(void)CVT$CONVERT_FLOAT(&input, CVT$K_VAX_H, &output, CVT$K_IEEE_X, CVT$M_BIG_ENDIAN);". I see only CVT$K_VAX_H is close to "long double". It has the size of 16 byte. But "output" has no data.
What else should I do? Thanks.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-26-2006 12:01 PM
01-26-2006 12:01 PM
Re: How to Convert "long double" to IEEE?
Are you sure your input parameter contains a valid H float value?
Maybe post a complete example that demonstrates the problem?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-26-2006 10:48 PM
01-26-2006 10:48 PM
Re: How to Convert "long double" to IEEE?
Purely Personal Opinion
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-27-2006 06:46 AM
01-27-2006 06:46 AM
Re: How to Convert "long double" to IEEE?
------------------------
#include
#include
#include
#include
int main(void)
{
long double f = 401.1234;
unsigned char s1[16];
unsigned char s2[16];
int i;
long l;
memcpy(s1, &f, 16);
printf("s1=0x");
for(i=15; i>=0; i--)
printf("%02x ", s1[i]);
printf("\n");
l = CVT$CONVERT_FLOAT(&f, CVT$K_VAX_H, s2, CVT$K_IEEE_X, CVT$M_ROUND_TO_NEAREST+CVT$M_BIG_ENDIAN);
printf("s2=0x");
for(i=15; i>=0; i--)
printf("%02x ", s2[i]);
printf("\n");
printf("l=%ld\n", l);
return 0;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-27-2006 06:57 AM
01-27-2006 06:57 AM
Re: How to Convert "long double" to IEEE?
Purely Personal Opinion
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-27-2006 07:09 AM
01-27-2006 07:09 AM
Re: How to Convert "long double" to IEEE?
which is %CVT-S-NORMAL
Purely Personal Opinion
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-27-2006 07:19 AM
01-27-2006 07:19 AM
Re: How to Convert "long double" to IEEE?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-27-2006 04:12 PM
01-27-2006 04:12 PM
SolutionWhat your program is doing is taking an X_FLOAT value, asking that it be interpreted as a big-endian H_FLOAT (a beast that I don't think ever existed in the wild as all native numerics are little endian) and then convert it into an X_FLOAT value, i.e., convert it to what it already was.
You can easily confirm that your long double is an X_FLOAT by building your program for the OpenVMS debugger and doing EXAMINE/X_FLOAT on the "f'" variable. If you are on the VAX platform, you can do EXAMINE/H_FLOAT and see what (little endian) H_FLOAT value you really have.
The nonsensical condition value is problematic and may reflect a bug in the routine. However, you are asking the routine to do something that is logically impossible. What is the real problem you are trying to solve? Do you really have H_FLOAT values sitting around that were written on a VAX?
What's non-intuitive here is that on Alpha and Itanium, your long doubles are 128-bit IEEE values by default regardless of what format your ordinary floats and doubles are in.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-28-2006 01:47 AM
01-28-2006 01:47 AM
Re: How to Convert "long double" to IEEE?
If you want to see how H_FLOAT is laid out, go to:
http://h71000.www7.hp.com/doc/82final/6443/6443pro_046.html#sec_fltng_pt_vax
and for X_FLOAT:
http://h71000.www7.hp.com/doc/82final/6443/6443pro_027.html#sec_real16