Search the web
Sign In
New User? Sign Up
wcalc · Wcalc Users
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Want to share photos of your group with the world? Add a group photo to Flickr.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
mod doesn't work wery well   Message List  
Reply | Forward Message #50 of 114 |
I wanted the remainder of a division with big numbers, this is what
I've done:

$ time wcalc "2^56 - floor(2^56 / 57)*57"
= 4

real 0m0.004s
user 0m0.001s
sys 0m0.003s
$ time wcalc "2^56 % 57"
^C

real 0m15.002s
user 0m14.635s
sys 0m0.003s
$

the standard operator takes too much time to calculate the
solution (I never waited for its solution), can anything be
done to solve this issue?

Cheers,
Daniele

--
GPG Fingerprint: 7B1F 0815 BB7D CF35 1018 EEAB 4B97 6382 F151 402D
-
GPG Key [ID: 0xF151402D] available @ pgp.mit.edu
-------------
RIP is irrelevant. Spoofing is futile. Your routes will be aggregated.
-- Alex Yuriev



Wed Jun 28, 2006 10:12 am

scrows@...
Send Email Send Email

Forward
Message #50 of 114 |
Expand Messages Author Sort by Date

I wanted the remainder of a division with big numbers, this is what I've done: $ time wcalc "2^56 - floor(2^56 / 57)*57" = 4 real 0m0.004s user 0m0.001s ...
Daniele
scrows@...
Send Email
Jun 28, 2006
10:15 am

... Heh, right. Counting up to 2^56 in 57-steps might take a while. ;-) ... Sure. Patch attached. Cheers, Ingo...
Ingo van Lil
ingo_swt
Offline Send Email
Jun 28, 2006
6:30 pm

... Hmm. What is currently in CVS is this: mpfr_set_ui(temp, 0, GMP_RNDN); mpfr_div(temp, first, second, GMP_RNDN); mpfr_rint(temp, temp, GMP_RNDZ); ...
Kyle Wheeler
m3m0ryh0l3
Offline Send Email
Jun 29, 2006
4:18 am

... What's the first line good for? ... -20 is not an option. The question is: When performing the integer division of -340 and 60, do you round the result by...
Ingo van Lil
ingo_swt
Offline Send Email
Jun 29, 2006
8:03 am

... Hmm, not much, come to think of it. ... Hmm, well, I tend to like not being restrictive, and I also like maintaining the existing behavior. In Wcalc 1.x,...
Kyle Wheeler
m3m0ryh0l3
Offline Send Email
Jun 29, 2006
9:35 pm

... Actually, if I'm reading the ADA reference manual correctly, the REM operator does exactly what your algorithm does (A REM B keeps the sign of A) while the...
Ingo van Lil
ingo_swt
Offline Send Email
Jun 29, 2006
11:05 pm

... Well, I'm not saying I'm in love with ADA, I'm just suggesting we preserve the existing behavior for % and do a better/different one with a new operator...
Kyle Wheeler
m3m0ryh0l3
Offline Send Email
Jun 30, 2006
1:23 am

... Well, rounding output towards zero would pick floor() or ceil() depending on the sign of output. I'm checking the sign of the first operand instead. So, if...
Ingo van Lil
ingo_swt
Offline Send Email
Jun 30, 2006
8:35 am

Perhaps I found another bug in the mod operator, I don't know if the result change with the last modifies to the way the mod works, so .. For `m % n' where `m'...
Daniele
scrows@...
Send Email
Jul 5, 2006
3:35 pm

... Nope, that's wrong. Looks like I need to get this fixed version out asap. ~Kyle -- It is easier to be critical than to be correct. -- Benjamin Disraeli...
Kyle Wheeler
m3m0ryh0l3
Offline Send Email
Jul 6, 2006
7:01 am
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help