Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

2
  • 2
    For those who just want something that works: define mod(x,base){oldscale=scale; scale=0; result=x%base; scale=oldscale; return result } Commented Oct 12, 2014 at 12:16
  • @HelloWorld: Mind that this will produce the remainder, not the modulo result. For positive operands this doesn't matter but you'll get different results for bc <<< "mod(-3, 5)" and python <<< "print(-3 % 5)". Commented Dec 15, 2021 at 14:17