Skip to main content
added 11 characters in body
Source Link
Davislor
  • 8.3k
  • 17
  • 37

The most efficient format for a computer, or to output in hex/octal/binary/base64, is probably to store your number as uint32_t. (If you ever are called upon to roll your own bignum library on some mainframe from the ’70s that supports modern C++ but not this timean exact 32-bit type, feel free to ask for an update.) This is half as fast as it theoretically might be on a 64-bit machine, but makes it much, much easier to get the high bits of multiplication than if you tried to use 64-bit words.

The most efficient format for a computer, or to output in hex/octal/binary/base64, is probably to store your number as uint32_t. (If you ever are called upon to roll your own bignum library on some mainframe from the ’70s that supports modern C++ but not this time, feel free to ask for an update.) This is half as fast as it theoretically might be on a 64-bit machine, but makes it much, much easier to get the high bits of multiplication than if you tried to use 64-bit words.

The most efficient format for a computer, or to output in hex/octal/binary/base64, is probably to store your number as uint32_t. (If you ever are called upon to roll your own bignum library on some mainframe from the ’70s that supports modern C++ but not an exact 32-bit type, feel free to ask for an update.) This is half as fast as it theoretically might be on a 64-bit machine, but makes it much, much easier to get the high bits of multiplication than if you tried to use 64-bit words.

added 209 characters in body
Source Link
Davislor
  • 8.3k
  • 17
  • 37

Compute the Quotient and Remainder at the Same Time

Most division algorithms will give you both, and this is one of the longest computations to have to restart all over again. See, for example, div_t.

Compute the Quotient and Remainder at the Same Time

Most division algorithms will give you both, and this is one of the longest computations to have to restart all over again. See, for example, div_t.

deleted 3 characters in body
Source Link
Davislor
  • 8.3k
  • 17
  • 37

This line of code sets one equal to 2. (Like the old version of IBM Fortran where procedures could change the value of the constant 1 to -1 and make every loop inall the programloops run backwards.)

This line of code sets one equal to 2. (Like the old version of IBM Fortran where procedures could change the value of the constant 1 to make every loop in the program run backwards.)

This line of code sets one equal to 2. (Like the old version of IBM Fortran where procedures could change the value of the constant 1 to -1 and make all the loops run backwards.)

added 139 characters in body
Source Link
Davislor
  • 8.3k
  • 17
  • 37
Loading
Source Link
Davislor
  • 8.3k
  • 17
  • 37
Loading