Zeroclickinfo-goodies: Calculator modulo operation

Created on 9 Apr 2016  Â·  8Comments  Â·  Source: duckduckgo/zeroclickinfo-goodies

https://duckduckgo.com/?q=(10%5E100)+%25+10&ia=answer

(10^100) % 10 should be 0.
I am not sure why the answer is wrong. Is the symbol % represent the modulo operation?

Bug

Most helpful comment

@wheatdog @fzzr- @mintsoft @philipmiesbauer Okay, drum roll... Here's the super complicated code to add the % and mod forms (:wink:):

screenshot from 2016-04-11 18 37 13

And now you can do:

screenshot from 2016-04-11 18 44 26

and

screenshot from 2016-04-11 18 44 56

Enjoy!

All 8 comments

@wheatdog Hehe, I imagine it has something to do with the way it handles large numbers :wink:

You'll be pleased to know that on the re-write (#1927) this issue is fixed:

screenshot from 2016-04-09 10 19 53

It doesn't support % notation atm, though it would be fairly trivial to add in - I'm not sure if it has meaning outside of programming (apart from percent), so I am unfortunately biased.

@duckduckgo/duckduckhack-contributors Anyone know of any other uses? Even if we don't support the infix-operator form, we will always have the function :smile:

Modulo is a quite common function in maths as well. There is 3 main
notations I have come across.

mod(a; b)
a mod b
a % b

I think all of them would be nice to add to the calculator.

On Sat, Apr 9, 2016, 10:26 Ben Moon [email protected] wrote:

@wheatdog https://github.com/wheatdog Hehe, I imagine it has something
to do with the way it handles large numbers [image: :wink:]

You'll be pleased to know that on the re-write (#1927
https://github.com/duckduckgo/zeroclickinfo-goodies/pull/1927) this
issue is fixed:

[image: screenshot from 2016-04-09 10 19 53]
https://cloud.githubusercontent.com/assets/8598426/14402966/afc83120-fe3c-11e5-84df-0441e8f0558f.png

It doesn't support % notation atm, though it would be fairly trivial to
add in - I'm not sure if it has meaning outside of programming (apart from
percent), so I am unfortunately biased.

@duckduckgo/duckduckhack-contributors
https://github.com/orgs/duckduckgo/teams/duckduckhack-contributors
Anyone know of any other uses? Even if we don't support the infix-operator
form, we will always have the function [image: :smile:]

—
You are receiving this because you are on a team that was mentioned.
Reply to this email directly or view it on GitHub
https://github.com/duckduckgo/zeroclickinfo-goodies/issues/2850#issuecomment-207752040

@philipmiesbauer Thanks for chiming in!

I think the first and third forms are fine, easily doable; the second would work (treating it as an operator) but I'm not sure how well it would play with _other_ infix 'functions' (though it should be fine - we use a full grammar). Updates will be on #2848 - so keep an eye out there :dolphin:

@GuiltyDolphin Great to hear that! Where can I use the re-write version of calculator? or it is not public right now.

@wheatdog it's not in a directly accessible location currently; however we hope it get it merged pretty soon!

@GuiltyDolphin @wheatdog I'm closing this because it's not likely that we'd not merge the rewrite now :)

Oh crazy world!

@wheatdog @fzzr- @mintsoft @philipmiesbauer Okay, drum roll... Here's the super complicated code to add the % and mod forms (:wink:):

screenshot from 2016-04-11 18 37 13

And now you can do:

screenshot from 2016-04-11 18 44 26

and

screenshot from 2016-04-11 18 44 56

Enjoy!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

GuiltyDolphin picture GuiltyDolphin  Â·  12Comments

GuiltyDolphin picture GuiltyDolphin  Â·  15Comments

atomic1fire picture atomic1fire  Â·  15Comments

rushsteve1 picture rushsteve1  Â·  13Comments

nickrsan picture nickrsan  Â·  29Comments