I sense your sarcasm, but, as you can tell from Zach's honesty, for some people there exists some ambiguity, or even an extreme lack of clarity. So, let's not be so condescending here, huh, ganon? Word.Originally Posted by gcn_zelda
This is a discussion on Unlimited length floating point calculator within the A Brief History of Cprogramming.com forums, part of the Community Boards category; Originally Posted by gcn_zelda I wish I knew what a modulus is. I sense your sarcasm, but, as you can ...
I sense your sarcasm, but, as you can tell from Zach's honesty, for some people there exists some ambiguity, or even an extreme lack of clarity. So, let's not be so condescending here, huh, ganon? Word.Originally Posted by gcn_zelda
When in doubt, MathWorld!
The word rap as it applies to music is the result of a peculiar phonological rule which has stripped the word of its initial voiceless velar stop.
Maybe I'll just wait 'til Calculus or whenever we learn about those thingies.
do you ever program. You need modulus in a lot of cases.
gcn_zelda:
To calculate 10.2 % .5 you could think of is as repeatedly adding/subtracting 0.5 from 10.2 until to recive a value within 0-0.5.
To calculate x % y, add or subtract y from x until you get a value in the interval [0,y[.
Question:
Why does (pi)! equal approx. 7.68 but
1.3! = 1
Are you using the gamma function or not?
EDIT: Matlab says that gamma(pi + 1) = (pi)! ~= 7.1881
1.3! ~= 1.1667
or
1.3! = 1 if you truncate
Last edited by Sang-drax; 11-30-2004 at 09:46 AM.
Last edited by Sang-drax : Tomorrow at 02:21 AM. Reason: Time travelling
Bug: When calulating something that takes more than 1 second, you need to report it as such or just change it. I did Pi! and it took 7.xxx seconds, but it says 7.xxx msecs.
Other than that, good job. I didn't dig too hard, but it seems fairly solid.
I'd say it isn't possible to use "mod 0". It doesn't make any sense.Originally Posted by Zach L.
The calculator answers, somewhat cryptically, 5 % 0 = 00
Last edited by Sang-drax : Tomorrow at 02:21 AM. Reason: Time travelling
It's a perfectly legal algebraic definition. The element 0 generates an ideal [called (0)] which consists of the element 0 alone. So, you can take the modulus with respect to it. You just need the cosets x+(0) and y+(0) to be identical, which only happens when x=y. See my earlier post that goes into this in more detail.
The word rap as it applies to music is the result of a peculiar phonological rule which has stripped the word of its initial voiceless velar stop.
Pardon my ignorance, but I am unfamiliar with the "gamma function." Thank you for pointing out the mistake. The way I am now calculating factorial (and the way I should have been) is just the standard [n * (n - 1) * (n - 2) * ...]. So, using your example, 1.3! = 1.3 * 0.3 = 0.39. Before I was thinking in terms of integers and stopping at 1 instead of zero. What exactly is "the gamma function" and how does it yield 1.3! = 1.1667? Thanks for the info (the horse's mouth is great, but please don't point me at google).Originally Posted by Sang-drax
Thanks for reporting. Actually it doesn't matter if it is over a second, the result is always in seconds, not milliseconds. It's fixed now. Out of curiosity, what are your specs? I just ran it on this machine (Centrino 1.5Ghz) and it took just over 10 seconds.Bug: When calulating something that takes more than 1 second, you need to report it as such or just change it. I did Pi! and it took 7.xxx seconds, but it says 7.xxx msecs.
[edit]
In doing more testing of my own I see that I am up against a foe that may conquer me and my measly HugeFloat class. Calculating a number to a floating point power means deadly problems. Currently my exponent function just treats the power like an integer because otherwise I am screwed since things to decimal powers mean strange things. It's possible that it will be a root (e.g., 1 ^ 0.5 = 1 ^ 1/2 = sqrt(1) = 1.4142135623730950488016887242097). If not, what exactly does a power to a floating point value mean? Should I just stick to treating it like an integer always? Should I always check if the exponent can legally be interpreted as a root? I don't know if I'm up for the challenge at this point... Stick a fork in me, I'm done.
[/edit]
Last edited by LuckY; 11-30-2004 at 11:05 PM.
Bah! You know you can't avoid a link to Google. Of course, you can have one to Not Google too.
The word rap as it applies to music is the result of a peculiar phonological rule which has stripped the word of its initial voiceless velar stop.
>>If not, what exactly does a power to a floating point value mean?<<
If you convert the floating point to a fraction, then x^(y/z) is equal to z'th root of (x^y). For example 4^(2/3) is cube root of 4^2. So 4^(3.16529) is (4^3)*(4^(16529/100000)) which is 64 times the the 100000th root of 4^16529.
Not sure exactly how to do a non repeating infinite float though, such as 4^(pi).
The gamma function is defined as following:Originally Posted by LuckY
G(x) = integral(0,inf) ( t^(x-1) * e^(-t) * dt )
Partial integration shows that G(x+1) = (x+1) * G(x). This combined with G(1) = 1 shows that the gamma function equals the factorial function for integers. The gamma function is a useful generalization of the factorial in some cases.
Originally Posted by LuckYCalculating a real number to the power of a rational number is well-defined. We can use this to define a real number to the power of an irrational:Originally Posted by PJ
a^b where a,b € R is defined as following:
lim{p/q -> b} a^(p/q)
i.e. b is approximated with a rational number which gets closer and closer to the actual real number.
Note that this means that raising a negative number to an irrational number is undefined. There's no way of determining the sign of the result.
This is not easy to implement, I can imagine.
I've only done a BigInt class, which is alot easier.
Last edited by Sang-drax; 12-01-2004 at 06:17 AM.
Last edited by Sang-drax : Tomorrow at 02:21 AM. Reason: Time travelling
Okay a much better operating version is available to anyone who is at all interested in using it or bug-running it. You can get it at http://www.geocities.com/lucky760/hugecalc. I made it dual-threaded so that the damn thing doesn't hang up while running long calculations. Also if it's taking too long for your liking you can just hit ESC or click the X to cancel the current computation. In addition to that I added tool tips to tell what things do and what their keyboard equivalents are. That's the other (and best) thing; you can enter values with your keyboard instead of having to mouse click every number. Finally you can cut/copy/paste stuff using CTRL+Z||C||V and SHIFT+INSERT||DELETE.
Thanks for the help you-all.