HP Forums
a modulo b [solved] - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: HP Prime (/forum-5.html)
+--- Thread: a modulo b [solved] (/thread-14185.html)



a modulo b [solved] - Aistoipok - 12-17-2019 06:17 PM

Hello,

I'd want to obtain a mod b by typing a% b but it doesn't work (syntax error)

[edit] I have to typing a %% b


RE: a modulo b [solved] - cyrille de brébisson - 12-18-2019 06:20 AM

hello,

The modulo command is MOD and is used as an operator, not a function, hence the syntax is:
9 MOD 4 (returns 1)...

% is for percentages and is a function as in %(5,40) = 2 (40 percent of 5 is 2)...

Cyrille


RE: a modulo b [solved] - ijabbott - 12-18-2019 08:15 AM

In CAS mode, n %% m enters a number as a member of an arithmetical ring. Strangely, it gets pretty-printed as %%(n,m) on the left of the display in textbook display mode, but results are always displayed as n' %% m on the right of the display (where n' is the member of the ring congruent to n). Trying to enter the number as %%(n,m) produces a syntax error.