Hi,
Just wondering if anyone has any realworld examples or know when you might use the NOT, AND, OR, XOR, <<, >> operators in Ruby.
I've been programming for 4 years and never come across the need to use any of these, wondering how common actual usage is & if its something I should fully understand.
Thanks,
-J
...
How the heck does Ruby do this? Does Jörg or anyone else know what's happening behind the scenes?
Unfortunately I don't know C very well so bignum.c is of little help to me. I was just kind of curious it someone could explain (in plain English) the theory behind whatever miracle algorithm its using.
irb(main):001:0> 999**999
3680...
I would like to add 2 arbitrarily sized integers in C++. How can I go about doing this?
...
Is there a bignum library for JavaScript that I can include like
<script type="text/javascript" src="the_bignum_library.js"></script>
?
I think my users would prefer to enter numbers in a web page and wait a 7 seconds for a result, rather than download an executable and click through a bunch of "this executable could possibly harm yo...
Is there is some mathematical "optimum" base that would speed up factorial calculation?
Background:
Just for fun, I'm implementing my own bignum library. (-: Is this my first mistake? :-).
I'm experimenting with various bases used in the internal representation and regression testing by printing out exact values (in decimal) for n facto...
Hi,
I'm trying to figure out how to implement RSA crypto from scratch (just for the intellectual exercise), and i'm stuck on this point:
For encryption, c = me mod n
Now, e is normally 65537. m and n are 1024-bit integers (eg 128-byte arrays). This is obviously too big for standard methods. How would you implement this?
I've been rea...
Hi,
I'm trying to implement long division for bignums. I can't use a library like GMP unfortunately due to the limitations of embedded programming. Besides, i want the intellectual exercise of learning how to implement it. So far i've got addition and multiplication done using any-length arrays of bytes (so each byte is like a base-256 d...
2^64 is still far from the "infinity" my ram/hard drive can handle...
First I wonder how GMP works with memory/processor since it does some kind of shady optimisations...
I was also wondering if there is a way of storing an integer (unsigned, it's easier) on an arbitrary number of bytes. For example, on 50 bytes, I would have a cap of ...
Hi, i've got a short haskell function here that is supposed to convert "ABCDEF" into 0x41,0x42,0x43,0x44,0x45,0x46 (their ascii values), then multiply them so it becomes 0x4142,4344,4546 but it seems to be limiting integer length - i thought haskell used arbitrary bignums?
The last line of the code works fine, which puzzles me
Any idea...
It seems that GMP provides only string serialization of the mpf (floating point) type:
mpf_get_str(), mpf_class::get_str()
The mpz (integer) type has an additional interface for raw bytes: mpz_out_raw()
http://gmplib.org/manual/Function-Index.html
Am I missing something? Does anyone know of another library that can serialize GMP flo...
I think I've found some gems in the iPhone OS (iOS 4).
I found that there're 128-bit, 256-bit, 512-bit and 1024-bit integer data types, provided by the Accelerate Framework. There're also Apple's implementation of Basic Linear Algebra Subprograms (BLAS), Apple's implementation of LAPACK (Linear Algebra PACKage), and Digital Signal Proce...
How does the system perform the 2^56 modulo 7, if it's 32 bits operating system in cryptography for example?
And how it stored in memory?
...
What is general principals to operate with large integers in javascript? Like in libraries for bigint? How i do it by myself?
...
Can I work with large numbers (more than 10^400) with built-in method in Delphi?
...
I am writing a program in C for file compression. The method i am trying to use involves doing math on the file as if it were one long number. Can anyone recommend a bignum library that would not try to do all of that in ram, but rather let me do math with file pointers. any help would be appreciated, thanks in advance.
...
Hi, I have this code in C that use openssl library to calculate the SHA1 digest of a bignumber.
How I can translate this code in Ruby?
#include <stdio.h>
#include <openssl/sha.h>
#include <openssl/bn.h>
int
main ()
{
// Create a bignum = 3
struct bignum_st *bn = BN_new ();
BN_set_word (bn, 3);
// Initialize SHA1 contex...
I confuse that how I aseert quite large number by PHPUnit.
I wrote fibonacci number. But in case 100, I wrote below.
http://github.com/sanemat/kata-fibonacci-phpunit/commit/b6b2945d2eff1b95e7e25b8be8c7bff11098d44d
I expect this return TRUE.
It failed.
http://www.php.net/manual/en/language.types.float.php
I understood 'never compare...
In one of my modules, I have to deal with the concept of infinity. To date, I have been using 9**9**9 as positive infinity, and this seems to work well, is fast, and seems to be what perl's internals use as infinity.
However, things get a bit dicey if a user of my module decides to use one of the big number modules (like use bigint;)...
By huge numbers, I mean if you took a gigabyte (instead of 4/8 bytes etc.) and tried to add/subtract/multiply/divide it by some other arbitrarily large (or small) number.
Adding and subtracting are rather easy (one k/m/byte at a time):
out_byteN = a_byteN + b_byteN + overflowBit
For every byte, thus I can add/subtract as I read the ...