|
Hi AreJay,
I was aware of this package, but I didnt mention it since I am not convinced
string representations will lead to good performance.
Most "big integer" packages use arrays of ints or something similar, which
is more computer-friendly.
Regards,
Luc Pattyn
|
|
|
|
|
Luc Pattyn,
Thanks for the information. When I wrote the class using a string was the only way it made since to me but now I'll convert it to an int array instead of a char array. I've been working on my C# and hope to re-write my Long Math class with C# so any performance tips would be greatly appreciated. Thanks again for the helpful advice.
I'm listening but I only speak GEEK.
|
|
|
|
|
thanks all , it help me lot.
Now I have new idea's.
I have class thet works with "big integer" and with "finite field", I wish thet it works for float to and it wos faster.
if I made good class thet works with "big integer and folat", I will publish it.
|
|
|
|
|
Hi,
I want to know, how I can get matrix of positions of pixels of image in the coordinate system (x,y) in matlab?
thank you
soso
|
|
|
|
|
Can anyone suggest some online resources from which to learn discrete math and computer applications. Using C++, as my choice and writing code to classify functions, input relations from sets and test functions,
|
|
|
|
|
I found this site[^] rather interesting...
"...a photo album is like Life, but flat and stuck to pages." - Shog9
|
|
|
|
|
|
|
I have to convert a floating point range into inverse units (Hz to uSec, and back) while assuring that any rounding causes the range to widen, not narrow. A simple X = 1000000/Y conversion could result in rounding in either direction, and short of adjusting Y by an empirically determined delta large enough to always force the rounding in the correct direction I'm unable to think of a good way to control the rounding.
--
Rules of thumb should not be taken for the whole hand.
|
|
|
|
|
Isn't a ceiling function what you want, round up, but not down?
"Oh, what a tangled web we weave, when first we practice to deceive." - Sir Walter Scott
Web - Blog - RSS - Math - LinkedIn - BM
|
|
|
|
|
Probably. I'm using doubles and keeping at most 9SF, so it's doubtful that a single division will throw the bogobits into the part being kept.
--
Rules of thumb should not be taken for the whole hand.
|
|
|
|
|
Multiply by 1o to the number of digits you wish to keep, ceil it, then divide by the power of 10 again. See if this gives you what you want.
"Oh, what a tangled web we weave, when first we practice to deceive." - Sir Walter Scott
Web - Blog - RSS - Math - LinkedIn - BM
|
|
|
|
|
To set it globally for your app you can use _controlfp() or _controlfp_s().
...cmk
Save the whales - collect the whole set
|
|
|
|
|
Need algorithms when next putting a clock forward/back from Windows information (GetTimeZoneInformation())...
|
|
|
|
|
Hmarik wrote: Need algorithms when next putting a clock forward/back from Windows information (GetTimeZoneInformation())...
I'm really glad to know you need that.
Really though, you should perhaps be a bit more specific in your request. Well, at least to me it seems somewhat ambiguous.
|
|
|
|
|
AFAIK there is no algorithm involved; in Europe the start and end dates of "summertime"
are agreed upon, a couple of years beforehand. I guess exact dates are available on the web...
BTW the UK do it slightly different.
Luc Pattyn
|
|
|
|
|
The summertime begins at the last sunday in march at 2 o'clock (since 2002), the wintertime at begins at the last sunday in octobre at 2o'clock (since 2002).
Before 2002 there were no rule, it was declared yearly. (Link in German: http://www.zeitumstellung.de/)
Regards,
Ingp
------------------------------
PROST Roleplaying Game
War doesn't determine who's right. War determines who's left.
"Would you like us to drop a bomb on you too? We have 10,000 of them!"
- espeir
"Perhaps we should lend them a nuke or two."
- espeir
|
|
|
|
|
Hi,
I'm trying do determine an ID3v2 tag size. Acording to the ID3 site it's stored in the first 10 bytes of the tag, acctually there the last 4 of those 10.
This is how they explain it.
The ID3v2 tag size is encoded with four bytes where the most significant bit (bit 7)
is set to zero in every byte, making a total of 28 bits. The zeroed bits are ignored,
so a 257 bytes long tag is represented as $00 00 02 01.
An ID3v2 tag can be detected with the following pattern:
$49 44 33 yy yy xx zz zz zz zz
Where yy is less than $FF, xx is the 'flags' byte and zz is less than $80
I think $00 00 02 01 is a hexadecimal represantation of the bytes. I understand that 1 byte = 01111111 maximum (bit7 =0), so 1 byte can represent 127 bytes (in tag size) maximum. In the example zz is less then $80, so it's less then 128. If so, I come to 4 * 127 * 127 = 64516 bytes in tag size. That's not 256 MB as they claim on the ID3 site.
I'm probably doing something wrong here.
Can anyone explain to me how 257 bytes (tag size) are represented by $00 00 02 01 in hexadecimal?
If you want to know The Truth, STOP lying.
|
|
|
|
|
Expand the hex string 00 00 02 01 to binary, and you get 00000000 00000000 00000010 00000001. Now, we ignore the most significant bit (left-hand end of each byte) giving the bit string 0000000 0000000 0000010 0000001, which when read as normal 8-bit bytes and padded to fill the top byte (padding in brackets) is (0000)0000 00000000 00000001 00000001, or hex 00 00 01 01 which is, in decimal, 257.
This following is a C function to get the size of the tag (assumes int is 32 bits and char is 8 bits.) The first of the four bytes from the ID3 tag is placed in the first position in the array, so for the example input, encodedSize[0] = 0x0, encodedSize[1] = 0x0, encodedSize[2] = 0x2, encodedSize[3] = 0x1 .)
int getTagSize(char encodedSize[4])
{
int retval = 0;
retval = encodedSize[0] << 21 | encodedSize[1] << 14 | encodedSize[2] << 7 | encodedSize[3];
return retval;
}
Not that this function doesn't do any form of sanity check on the input data, which is a Bad Thing™ in real code you must check that each byte of the encoded size is < 0x80, and do whatever is appropriate in your app when encountering an invalid ID3 tag if the test fails.
As for the aside about maximum tag size, the max value with this encoding is $7f 7f 7f 7f, which represents 268435455 bytes, or 256 MB, of ID3v2 tag. I don't see where you're getting 4*127*127 from, but the reason why 127*127*127*127 = 260144641 is wrong is that, while the maximum value for each byte is 127, the total number of values for each byte is 128, and so there are 128*128*128*128 = 268435456 possible values for the tag size (0-268435455)
|
|
|
|
|
There was an error in my reasoning . I did (127+127+127+127)*127 instead of 127*127*127*127, silly me :->.
I get it now. I don't understand C programming, I just got the basics of VB.Net, but I'll learn as I get along.
Reading (and eventually writing) mp3-tags seemed easy, as I could see the tag (more or less) when I open the file in notepad. And I love a challenge .
Thanks for the help. On to the next problem.;)
If you want to know The Truth, STOP lying.
|
|
|
|
|
|
has it been proved whether or not there are a finite number of twin primes yet?
Russell
|
|
|
|
|
The Twin Prime Conjecture is still a conjecture.
"Oh, what a tangled web we weave, when first we practice to deceive." - Sir Walter Scott
Web - Blog - RSS - Math - LinkedIn - BM
|
|
|
|
|
It cant be proven that a finite number exists... can it? because there is an infinite number of... numbers!
|
|
|
|
|
Just the fact that the set of integers is an infinite set does not in any way impact the provability. There are numerous other conjectures which have been proven on this set of (all integer) numbers. One common technique is to assume the conjecture is false, then demonstrate that such an assumption leads to a contradiction, therefore the opposite must be true.Some examples of proven and open conjectures[^]
|
|
|
|