llModPow

Summary

Function: integer llModPow( integer a, integer b, integer c );
0.0 Forced Delay
10.0 Energy

Returns an integer that is a raised to the b power, mod c. ( (a**b)%c )

• integer a
• integer b
• integer c

Examples

integer x = llModPow(13743, 14200, 10000); // = 1
integer y = llModPow(0xc734abfa, 0x8371b314, 0xffffffff); // = -1481328730, corresponding to unsigned value of 2813638566

Notes

  • Internally, the parameters are considered unsigned integers. This means it's possible to get extra range by using negative values or hexadecimal, and interpreting the result as such as well.
  • This function used to have a forced delay of 1.0 and precision issues before an update in January 2025.[1]

Deep Notes

Footnotes

  1. ^ Reported 3 November 2024, fixed in January 2025: https://feedback.secondlife.com/scripting-bugs/p/getting-wrong-results-from-llmodpow

Signature

function integer llModPow( integer a, integer b, integer c );