Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Turning very larger numbers into an array of bits

by Marshall (Canon)
on Feb 07, 2017 at 17:30 UTC ( [id://1181323]=note: print w/replies, xml ) Need Help??


in reply to Turning very larger numbers into an array of bits

You might want to also look at Quadruple-precision floating-point format. In IEEE 754-2008 the 128-bit base-2 format is officially referred to as binary128.

As BrowserUk notes: The only 80-bit numbers in common usage are the extended precision 80-bit IEEE 754 floating point values used internally by the X86 & X64 floating point processors. This would not give you 80 bits of integer precession anyway.

The IEEE 754 binary128 format will yield >100 bits of precision which would meet your 80 bit requirements. Even 265 256 (typo) bit formats have been defined. However the choice of compilers is going to be limited. There can be issues affecting stack alignment which can significantly affect performance depending upon the target processor architecture. However since these are binary formats, shifting and masking albeit across 64 bit words can be done efficiently as opposed to using some kind of BCD (Binary Coded Decimal) format.

AFAIK, the low level BCD instructions are still part of the x86 family assembly instructions, but I've never used a compiler that could use them, nor have I written any assembly code for these instructions either. In any event, that doesn't sound like what you want. For raw speed, a C or FORTRAN compiler that can handle the 128bit format would seem like a promising approach. I suspect that the Perl larger int options will be slower for the main calculations that you apparently need to do.

  • Comment on Re: Turning very larger numbers into an array of bits

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1181323]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (3)
As of 2024-04-25 23:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found