- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: computing limitation error - long and double
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
09-29-2008 02:13 PM
09-29-2008 02:13 PM
computing limitation error - long and double
I tried 'double' and 'long' as variable type but none of them are valid type.
This is output.
2847744950/3234344960 = 5295336 (huh??)
Does anybody have any clue???
Thanks a bunch.
Yong
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-29-2008 02:22 PM
09-29-2008 02:22 PM
Re: computing limitation error - long and double
The shell limits you to 32-bit arithmetic. Use something like Perl or 'bc'. For example:
# perl -le 'print +(2**52)'
4503599627370496
# echo 2^52|bc
4503599627370496
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-29-2008 10:02 PM
09-29-2008 10:02 PM
Re: computing limitation error - long and double
ksh was changed in 11.23 to use 64 bit ints. Unfortunately the posix shell wasn't changed.
You can use awk to do calculations in double.
And gdb to do calculations in long double.
(gdb) p (long double)2847744950/3234344960
$2 = 0.88047038433401983194767202568275215
- Tags:
- gdb
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-29-2008 11:02 PM
09-29-2008 11:02 PM
Re: computing limitation error - long and double
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-29-2008 11:03 PM
09-29-2008 11:03 PM
Re: computing limitation error - long and double
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-01-2008 05:02 AM
10-01-2008 05:02 AM