Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikipediaThe Free Encyclopedia
Search

Modulo

From Wikipedia, the free encyclopedia
(Redirected fromModulo operation)
This article is about the binary operationmod(a,n). For the(modn) notation, seeModular arithmetic. For other uses, seeModulo (disambiguation).
Computational operation

Incomputing andmathematics, themodulo operation returns theremainder or signed remainder of adivision, after one number is divided by another, the latter being called themodulus of the operation.

Given two positive numbersa andn,a modulon (often abbreviated asa modn) is the remainder of theEuclidean division ofa byn, wherea is thedividend andn is thedivisor.[1]

For example, the expression "5 mod 2" evaluates to 1, because 5 divided by 2 has aquotient of 2 and a remainder of 1, while "9 mod 3" would evaluate to 0, because 9 divided by 3 has a quotient of 3 and a remainder of 0.

Although typically performed witha andn both beingintegers, many computing systems now allow other types of numeric operands. The range of values for an integer modulo operation ofn is 0 ton − 1.a mod 1 is always 0.

When exactly one ofa orn is negative, the basic definition breaks down, andprogramming languages differ in how these values are defined.

Variants of the definition

[edit]

Inmathematics, the result of themodulo operation is anequivalence class, and any member of the class may be chosen asrepresentative; however, the usual representative is theleast positive residue, the smallest non-negative integer that belongs to that class (i.e., the remainder of theEuclidean division).[2] However, other conventions are possible. Computers and calculators have various ways of storing and representing numbers; thus their definition of the modulo operation depends on theprogramming language or the underlyinghardware.

In nearly all computing systems, the quotientq and the remainderr ofa divided byn0{\displaystyle n\neq 0} satisfy the following conditions:

qZa=nq+r(n0)|r|<|n|{\displaystyle {\begin{aligned}&q\in \mathbb {Z} \\&a=nq+r\quad (n\neq 0)\\&|r|<|n|\end{aligned}}}1

This still leaves a sign ambiguity if the remainder is non-zero: two possible choices for the remainder occur, one negative and the other positive; that choice determines which of the two consecutive quotients must be used to satisfy equation (1). In number theory, the positive remainder is always chosen, but in computing, programming languages choose depending on the language and the signs ofa orn.[a] StandardPascal andALGOL 68, for example, give a positive remainder (or 0) even for negative divisors, and some programming languages, such as C90, leave it to the implementation when either ofn ora is negative (see the table under§ In programming languages for details). Some systems leavea modulo 0 undefined, though others define it asa.

If both the dividend and divisor are positive, then the truncated, floored, and Euclidean definitions agree.If the dividend is positive and the divisor is negative, then the truncated and Euclidean definitions agree.If the dividend is negative and the divisor is positive, then the floored and Euclidean definitions agree.If both the dividend and divisor are negative, then the truncated and floored definitions agree.

However, truncated division satisfies the identity(a)/b=(a/b)=a/(b){\displaystyle ({-a})/b={-(a/b)}=a/({-b})}.[5][6]

Notation

[edit]
This section is about the binarymod operation. For the(mod m) notation, seecongruence relation.

Some calculators have amod() function button, and many programming languages have a similar function, expressed asmod(a,n), for example. Some also support expressions that use "%", "mod", or "Mod" as a modulo or remainderoperator, such asa % n ora mod n.

For environments lacking a similar function, any of the three definitions above can be used.

Common pitfalls

[edit]

When the result of a modulo operation has the sign of the dividend (truncated definition), it can lead to surprising mistakes.

For example, to test if an integer isodd, one might be inclined to test if the remainder by 2 is equal to 1:

boolis_odd(intn){returnn%2==1;}

But in a language where modulo has the sign of the dividend, that is incorrect, because whenn (the dividend) is negative and odd,n mod 2 returns −1, and the function returns false.

One correct alternative is to test that the remainder is not 0 (because remainder 0 is the same regardless of the signs):

boolis_odd(intn){returnn%2!=0;}

Or with the binary arithmetic:

boolis_odd(intn){returnn&1;}

Performance issues

[edit]

Modulo operations might be implemented such that a division with a remainder is calculated each time. For special cases, on some hardware, faster alternatives exist. For example, the modulo ofpowers of 2 can alternatively be expressed as abitwise AND operation (assumingx is a positive integer, or using a non-truncating definition):

x % 2n == x & (2n - 1)

Examples:

x % 2 == x & 1
x % 4 == x & 3
x % 8 == x & 7

In devices and software that implement bitwise operations more efficiently than modulo, these alternative forms can result in faster calculations.[7]

Compiler optimizations may recognize expressions of the formexpression % constant whereconstant is a power of two and automatically implement them asexpression & (constant-1), allowing the programmer to write clearer code without compromising performance. This simple optimization is not possible for languages in which the result of the modulo operation has the sign of the dividend (includingC), unless the dividend is of anunsigned integer type. This is because, if the dividend is negative, the modulo will be negative, whereasexpression & (constant-1) will always be positive. For these languages, the equivalencex % 2n == x < 0 ? x | ~(2n - 1) : x & (2n - 1) has to be used instead, expressed using bitwise OR, NOT and AND operations.

Optimizations for general constant-modulus operations also exist by calculating the division first using theconstant-divisor optimization.

Properties (identities)

[edit]
See also:Modular arithmetic § Properties

Some modulo operations can be factored or expanded similarly to other mathematical operations. This may be useful incryptography proofs, such as theDiffie–Hellman key exchange. The properties involving multiplication, division, and exponentiation generally require thata andn are integers.

  • Identity:
  • Inverse:
  • Distributive:
    • (a +b) modn = [(a modn) + (b modn)] modn.
    • ab modn = [(a modn)(b modn)] modn.
  • Division (definition):a/b modn = [(a modn)(b−1 modn)] modn, when the right hand side is defined (that is whenb andn arecoprime), and undefined otherwise.
  • Inverse multiplication:[(ab modn)(b−1 modn)] modn =a modn.

In programming languages

[edit]
Modulo operators in various programming languages
LanguageOperatorIntegerFloating-pointDefinition
ABAPMODYesYesEuclidean[8]
ActionScript%YesYesTruncated[9]
AdamodYesNoFloored[10]
remYesNoTruncated[10]
ALGOL 68÷×,÷*,,%*,mod[b]YesNoEuclidean[11]
AMPLmodYesNoTruncated
APL|[c]YesYesFloored
AppleScriptmodYesYesTruncated
AutoLISPremYesYesTruncated
AWK%YesYesTruncated (same asfmod in C)[12]
BASICModYesNoVaries by implementation
bc%YesNoTruncated
C
C++
%,divYesNoTruncated[d]
fmod (C)
std::fmod (C++)
NoYesTruncated[15]
remainder (C)
std::remainder (C++)
NoYesRounded[16]
C#%YesYesTruncated[17]
Math.IEEERemainderNoYesRounded[18]
Clarion%YesNoTruncated
CleanremYesNoTruncated
ClojuremodYesNoFloored[19]
remYesNoTruncated[20]
COBOLFUNCTION MODYesNoFloored[21]
FUNCTION REMYesYesTruncated[21]
CoffeeScript%YesNoTruncated
%%YesNoFloored[22]
ColdFusion%,MODYesNoTruncated
Common Intermediate Languagerem (signed)YesYesTruncated[23]
rem.un (unsigned)YesNoN/a
Common LispmodYesYesFloored[24]
remYesYesTruncated[24]
Crystal%,moduloYesYesFloored
remainderYesYesTruncated
CSSmod()YesYesFloored[25]
rem()YesYesTruncated[26]
D%YesYesTruncated[27]
Dart%YesYesEuclidean[28]
remainder()YesYesTruncated[29]
Eiffel\\YesNoTruncated
Elixirrem/2YesNoTruncated[30]
Integer.mod/2YesNoFloored[31]
ElmmodByYesNoFloored[32]
remainderByYesNoTruncated[33]
ErlangremYesNoTruncated
math:fmod/2NoYesTruncated (same as C)[34]
EuphoriaremainderYesYesTruncated[35]
modYesYesFloored[36]
F#%YesYesTruncated (same as C#)[37]
Math.IEEERemainderNoYesRounded[18]
FactormodYesYesTruncated[38]
remYesYesEuclidean[39]
FileMakerModYesNoFloored
ForthmodYesNoImplementation defined
fm/modYesNoFloored
sm/remYesNoTruncated
FortranmodYesYesTruncated
moduloYesYesFloored
FrinkmodYesNoFloored
Full BASICMODYesYesFloored[40]
REMAINDERYesYesTruncated[41]
GLSL%YesNoUndefined[42]
modNoYesFloored[43]
GameMaker Studio (GML)mod,%YesNoTruncated
GDScript (Godot)%YesNoTruncated[44]
posmodYesNoEuclidean[45]
fmodNoYesTruncated[46]
fposmodNoYesEuclidean[47]
Go%YesNoTruncated[48]
math.ModNoYesTruncated[49]
big.Int.ModYesNoEuclidean[50]
big.Int.RemYesNoTruncated[51]
Groovy%YesNoTruncated
HaskellmodYesNoFloored[52]
remYesNoTruncated[52]
Data.Fixed.mod' (GHC)NoYesFloored
Haxe%YesYesTruncated[53]
HLSL%YesYesUndefined[54]
J|[c]YesNoFloored
Java%YesYesTruncated
Math.floorModYesNoFloored
JavaScript
TypeScript
%YesYesTruncated
JuliamodYesYesFloored[55]
%,remYesYesTruncated[56]
Kotlin%,remYesYesTruncated[57]
modYesYesFloored[58]
ksh%YesNoTruncated (same as POSIXsh)
fmodNoYesTruncated
LabVIEWmodYesYesTruncated
LibreOfficeMODYesYesFloored[59]
LogoMODULOYesNoFloored
REMAINDERYesNoTruncated
Lua 5%YesYesFloored
Lua 4mod(x,y)YesYesTruncated
Liberty BASICMODYesNoTruncated
Mathcadmod(x,y)YesNoFloored
Maplee mod m (by default),modp(e, m)YesNoEuclidean
mods(e, m)YesNoRounded
frem(e, m)YesYesRounded
MathematicaMod[a, b]YesNoFloored
MATLABmodYesYesFloored[60]
remYesYesTruncated[61]
MaximamodYesNoFloored
remainderYesNoTruncated
Maya Embedded Language%YesNoTruncated
Microsoft ExcelMODYesYesFloored[62]
MinitabMODYesNoFloored
Modula-2MODYesNoFloored
REMYesNoTruncated
MUMPS#YesNoFloored
Netwide Assembler (NASM,NASMX)%,div (unsigned)YesNoN/a
%% (signed)YesNoImplementation-defined[63]
NimmodYesNoTruncated
OberonMODYesNoFloored-like[e]
Objective-C%YesNoTruncated (same as C99)
Object Pascal,DelphimodYesNoTruncated
OCamlmodYesNoTruncated[64]
mod_floatNoYesTruncated[65]
Occam\YesNoTruncated
Pascal (ISO-7185 and -10206)modYesNoEuclidean-like[f]
Perl%YesNoFloored[g]
POSIX::fmodNoYesTruncated
PHP%YesNoTruncated[67]
fmodNoYesTruncated[68]
PICBASIC Pro\\YesNoTruncated
PL/ImodYesNoFloored (ANSI PL/I)
PowerShell%YesNoTruncated
Programming Code (PRC)MATH.OP - 'MOD; (\)'YesNoUndefined
ProgressmoduloYesNoTruncated
Prolog (ISO 1995)modYesNoFloored
remYesNoTruncated
PureBasic%,Mod(x,y)YesNoTruncated
PureScript`mod`YesNoEuclidean[69]
Pure Data%YesNoTruncated (same as C)
modYesNoFloored
Python%YesYesFloored[70]
math.fmodNoYesTruncated[71]
math.remainderNoYesRounded[72]
Q#%YesNoTruncated[73]
R%%YesYesFloored[74]
RacketmoduloYesNoFloored
remainderYesNoTruncated
Raku%NoYesFloored
RealBasicMODYesNoTruncated
ReasonmodYesNoTruncated
Rexx//YesYesTruncated
RPG%REMYesNoTruncated
Ruby%,modulo()YesYesFloored
remainder()YesYesTruncated
Rust%YesYesTruncated[75]
rem_euclid()YesYesEuclidean[76]
SASMODYesNoTruncated
Scala%YesYesTruncated
SchememoduloYesNoFloored
remainderYesNoTruncated
SchemeR6RSmodYesNoEuclidean[77]
mod0YesNoRounded[77]
flmodNoYesEuclidean
flmod0NoYesRounded
ScratchmodYesYesFloored
Seed7modYesYesFloored
remYesYesTruncated
SenseTalkmoduloYesNoFloored
remYesNoTruncated
sh (POSIX) (includesbash,mksh, &c.)%YesNoTruncated (same as C)[78]
Smalltalk\\YesYesFloored[79]: sec. 5.6.2.9 
rem:YesYesTruncated[79]: sec. 5.6.2.30 
Snap!modYesNoFloored
Spin//YesNoFloored
Solidity%YesNoTruncated[80]
SQL (SQL:1999)mod(x,y)YesNoTruncated
SQL (SQL:2011)%YesNoTruncated
Standard MLmodYesNoFloored
Int.remYesNoTruncated
Real.remNoYesTruncated
Statamod(x,y)YesNoEuclidean
Swift%YesNoTruncated[81]
remainder(dividingBy:)NoYesRounded[82]
truncatingRemainder(dividingBy:)NoYesTruncated[83]
Tcl%YesNoFloored
fmod()NoYesTruncated (same as C)
tcsh%YesNoTruncated
Torque%YesNoTruncated
TuringmodYesNoFloored
Verilog (2001)%YesNoTruncated
VHDLmodYesNoFloored
remYesNoTruncated
VimL%YesNoTruncated
Visual BasicModYesNoTruncated
WebAssemblyi32.rem_u,i64.rem_u (unsigned)YesNoN/a[84]
i32.rem_s,i64.rem_s (signed)YesNoTruncated[84]
x86 assemblyIDIVYesNoTruncated
XBase++%YesYesTruncated
Mod()YesYesFloored
Zig%,@remYesYesTruncated[85]
@modYesYesFloored
Z3 theorem proverdiv,modYesNoEuclidean

In addition, many computer systems provide adivmod functionality, which produces the quotient and the remainder at the same time. Examples include thex86 architecture'sIDIV instruction, the C programming language'sdiv() function, andPython'sdivmod() function.

Generalizations

[edit]

Modulo with offset

[edit]

Sometimes it is useful for the result ofa modulon to lie not between 0 andn − 1, but between some numberd andd +n − 1. In that case,d is called anoffset andd = 1 is particularly common.

There does not seem to be a standard notation for this operation, so let us tentatively usea moddn. We thus have the following definition:[86]x =a moddn just in casedxd +n − 1 andx modn =a modn. Clearly, the usual modulo operation corresponds to zero offset:a modn =a mod0n.

The operation of modulo with offset is related to thefloor function as follows:amoddn=anadn.{\displaystyle a\operatorname {mod} _{d}n=a-n\left\lfloor {\frac {a-d}{n}}\right\rfloor .}

To see this, letx=anadn{\textstyle x=a-n\left\lfloor {\frac {a-d}{n}}\right\rfloor }. We first show thatx modn =a modn. It is in general true that(a +bn) modn =a modn for all integersb; thus, this is true also in the particular case whenb=adn{\textstyle b=-\!\left\lfloor {\frac {a-d}{n}}\right\rfloor }; but that means thatxmodn=(anadn)modn=amodn{\textstyle x{\bmod {n}}=\left(a-n\left\lfloor {\frac {a-d}{n}}\right\rfloor \right)\!{\bmod {n}}=a{\bmod {n}}}, which is what we wanted to prove. It remains to be shown thatdxd +n − 1. Letk andr be the integers such thatad =kn +r with0 ≤rn − 1 (seeEuclidean division). Thenadn=k{\textstyle \left\lfloor {\frac {a-d}{n}}\right\rfloor =k}, thusx=anadn=ank=d+r{\textstyle x=a-n\left\lfloor {\frac {a-d}{n}}\right\rfloor =a-nk=d+r}. Now take0 ≤rn − 1 and addd to both sides, obtainingdd +rd +n − 1. But we've seen thatx =d +r, so we are done.

The modulo with offseta moddn is implemented inMathematica asMod[a, n, d] .[86]

Implementing other modulo definitions using truncation

[edit]

Despite the mathematical elegance of Knuth's floored division and Euclidean division, it is generally much more common to find a truncated division-based modulo in programming languages. Leijen provides the following algorithms for calculating the two divisions given a truncated integer division:

/* Euclidean and Floored divmod, in the style of C's ldiv() */typedefstruct{/* This structure is part of the C stdlib.h, but is reproduced here for clarity */longintquot;longintrem;}ldiv_t;/* Euclidean division */inlineldiv_tldivE(longnumer,longdenom){/* The C99 and C++11 languages define both of these as truncating. */longq=numer/denom;longr=numer%denom;if(r<0){if(denom>0){q=q-1;r=r+denom;}else{q=q+1;r=r-denom;}}return(ldiv_t){.quot=q,.rem=r};}/* Floored division */inlineldiv_tldivF(longnumer,longdenom){longq=numer/denom;longr=numer%denom;if((r>0&&denom<0)||(r<0&&denom>0)){q=q-1;r=r+denom;}return(ldiv_t){.quot=q,.rem=r};}

For both cases, the remainder can be calculated independently of the quotient, but not vice versa. The operations are combined here to save screen space, as the logical branches are the same.

See also

[edit]

Notes

[edit]
  1. ^Mathematically, these two choices are but two of the infinite number of choices available forthe inequality satisfied by a remainder.
  2. ^The revised report uses boldface to distinguish between keywords and identifiers, but permits other formats, including capitalization (e.g.MOD).
  3. ^abArgument order reverses, i.e.,α|ω computesωmodα{\displaystyle \omega {\bmod {\alpha }}}, the remainder when dividingω byα.
  4. ^C99 andC++11 define the behavior of% to be truncated.[13] The standards before then leave the behavior implementation-defined.[14]
  5. ^Divisor must be positive, otherwise undefined.
  6. ^As discussed by Boute, ISO Pascal's definitions ofdiv andmod do not obey the Division Identity ofD =d · (D /d) +D %d, and are thus fundamentally broken.
  7. ^Perl usually uses arithmetic modulo operator that is machine-independent. For examples and exceptions, see the Perl documentation on multiplicative operators.[66]

References

[edit]
  1. ^Weisstein, Eric W."Congruence".Wolfram MathWorld. Retrieved2020-08-27.
  2. ^Caldwell, Chris."residue".Prime Glossary. RetrievedAugust 27, 2020.
  3. ^Knuth, Donald. E. (1972).The Art of Computer Programming. Addison-Wesley.
  4. ^Boute, Raymond T. (April 1992)."The Euclidean definition of the functions div and mod".ACM Transactions on Programming Languages and Systems.14 (2). ACM Press (New York, NY, USA):127–144.doi:10.1145/128861.128862.hdl:1854/LU-314490.S2CID 8321674.
  5. ^Peterson, Doctor (5 July 2001)."Mod Function and Negative Numbers".Math Forum - Ask Dr. Math. Archived fromthe original on 2019-10-22. Retrieved22 October 2019.
  6. ^"Ada 83 LRM, Sec 4.5: Operators and Expression Evaluation".archive.adaic.com. Retrieved2025-03-03.
  7. ^Horvath, Adam (July 5, 2012)."Faster division and modulo operation - the power of two".
  8. ^"ABAP Keyword Documentation".help.sap.com. 2024. Retrieved2026-01-18.
  9. ^"Operators - Adobe ActionScript® 3 (AS3) API Reference".help.adobe.com. Retrieved2026-01-19.
  10. ^abISO/IEC 8652:2012 - Information technology — Programming languages — Ada.ISO,IEC. 2012. sec. 4.5.5 Multiplying Operators.
  11. ^Revised Report on the Algorithmic Language Algol 68.IFIP WG2.1. 1973. sec. 10.2.3.3.n.
  12. ^"awk".pubs.opengroup.org. Retrieved2026-01-19.
  13. ^"C99 specification (ISO/IEC 9899:TC2)"(PDF). 2005-05-06. sec. 6.5.5 Multiplicative operators. Retrieved16 August 2018.
  14. ^ISO/IEC 14882:2003: Programming languages – C++.International Organization for Standardization (ISO),International Electrotechnical Commission (IEC). 2003. sec. 5.6.4.the binary % operator yields the remainder from the division of the first expression by the second. .... If both operands are nonnegative then the remainder is nonnegative; if not, the sign of the remainder is implementation-defined
  15. ^ISO/IEC 9899:1990: Programming languages – C.ISO,IEC. 1990. sec. 7.5.6.4.Thefmod function returns the valuex - i * y, for some integeri such that, ify is nonzero, the result has the same sign asx and magnitude less than the magnitude ofy.
  16. ^ISO/IEC 9899:1999: Programming languages — C.ISO,IEC. 1999. sec. 7.12.10.2.Theremainder functions compute the remainderx REMy required by IEC 60559.
  17. ^"Expressions - C# language specification".learn.microsoft.com. Retrieved2026-01-19.
  18. ^abdotnet-bot."Math.IEEERemainder(Double, Double) Method (System)".Microsoft Learn. Retrieved2022-10-04.
  19. ^"clojure.core - Clojure v1.10.3 API documentation".clojure.github.io. Retrieved2022-03-16.
  20. ^"clojure.core - Clojure v1.10.3 API documentation".clojure.github.io. Retrieved2022-03-16.
  21. ^abISO/IEC JTC 1/SC 22/WG 4 (January 2023).ISO/IEC 1989:2023 – Programming language COBOL.ISO.
  22. ^CoffeeScript operators
  23. ^ISO/IEC JTC 1/SC 22 (February 2012).ISO/IEC 23271:2012 — Information technology — Common Language Infrastructure (CLI).ISO. §§ III.3.55–56.
  24. ^ab"CLHS: Function MOD, REM".www.lispworks.com. Retrieved2026-01-20.
  25. ^"mod() - CSS: Cascading Style Sheets | MDN".developer.mozilla.org. 2024-06-22. Retrieved2024-10-23.
  26. ^"rem() - CSS: Cascading Style Sheets | MDN".developer.mozilla.org. 2024-10-15. Retrieved2024-10-23.
  27. ^"Expressions - D Programming Language".dlang.org. Retrieved2021-06-01.
  28. ^"operator % method - num class - dart:core library - Dart API".api.dart.dev. Retrieved2021-06-01.
  29. ^"remainder method - num class - dart:core library - Dart API".api.dart.dev. Retrieved2021-06-01.
  30. ^"Kernel — Elixir v1.11.3".hexdocs.pm. Retrieved2021-01-28.
  31. ^"Integer — Elixir v1.11.3".hexdocs.pm. Retrieved2021-01-28.
  32. ^"Basics - core 1.0.5".package.elm-lang.org. Retrieved2022-03-16.
  33. ^"Basics - core 1.0.5".package.elm-lang.org. Retrieved2022-03-16.
  34. ^"Erlang -- math".erlang.org. Retrieved2021-06-01.
  35. ^"OpenEuphoria: Euphoria v4.0".openeuphoria.org. Retrieved2026-01-20.
  36. ^"OpenEuphoria: Euphoria v4.0".openeuphoria.org. Retrieved2026-01-20.
  37. ^"18. The F# Library FSharp.Core.dll - F# Language Specification".fsharp.github.io. Retrieved2026-01-19.
  38. ^"mod ( x y -- z ) - Factor Documentation".docs.factorcode.org. Retrieved2026-01-21.
  39. ^"rem ( x y -- z ) - Factor Documentation".docs.factorcode.org. Retrieved2026-01-21.
  40. ^ANSI (28 January 1987).Programming Languages — Full BASIC. New York: American National Standards Institute. § 5.4.4.X modulo Y, i.e., X-Y*INT(X/Y).
  41. ^ANSI (28 January 1987).Programming Languages — Full BASIC. New York: American National Standards Institute. § 5.4.4.The remainder function, i.e., X-Y*IP(X/Y).
  42. ^"GLSL Language Specification, Version 4.50.7"(PDF). section 5.9 Expressions.If both operands are non-negative, then the remainder is non-negative. Results are undefined if one or both operands are negative.
  43. ^"GLSL Language Specification, Version 4.50.7"(PDF). section 8.3 Common Functions.
  44. ^"int".Godot Engine documentation. Retrieved2026-01-19.
  45. ^"@GlobalScope".Godot Engine documentation. Retrieved2026-01-19.
  46. ^"@GlobalScope".Godot Engine documentation. Retrieved2026-01-19.
  47. ^"@GlobalScope".Godot Engine documentation. Retrieved2026-01-19.
  48. ^"The Go Programming Language Specification - The Go Programming Language".go.dev. Retrieved2022-02-28.
  49. ^"math package - math - pkg.go.dev".pkg.go.dev. Retrieved2022-02-28.
  50. ^"big package - math/big - pkg.go.dev".pkg.go.dev. Retrieved2022-02-28.
  51. ^"big package - math/big - pkg.go.dev".pkg.go.dev. Retrieved2024-04-12.
  52. ^ab"6 Predefined Types and Classes".www.haskell.org. Retrieved2022-05-22.
  53. ^"Binary Operators".Haxe - The Cross-platform Toolkit. Retrieved2026-01-20.
  54. ^"Operators".Microsoft. 30 June 2021. Retrieved2021-07-19.The % operator is defined only in cases where either both sides are positive or both sides are negative. Unlike C, it also operates on floating-point data types, as well as integers.
  55. ^"Mathematics · The Julia Language".docs.julialang.org. Retrieved2021-11-20.
  56. ^"Mathematics · The Julia Language".docs.julialang.org. Retrieved2021-11-20.
  57. ^"rem - Kotlin Programming Language".Kotlin. Retrieved2021-05-05.
  58. ^"mod - Kotlin Programming Language".Kotlin. Retrieved2021-05-05.
  59. ^"Mathematical Functions".help.libreoffice.org. Retrieved2026-01-21.
  60. ^"mod - Remainder after division (modulo operation) - MATLAB".www.mathworks.com. Archived fromthe original on 2026-01-15. Retrieved2026-01-21.
  61. ^"rem - Remainder after division - MATLAB".www.mathworks.com. Archived fromthe original on 2026-01-01. Retrieved2026-01-21.
  62. ^"MOD function - Microsoft Support".support.microsoft.com. Retrieved2026-01-21.
  63. ^"Chapter 3: The NASM Language".NASM - The Netwide Assembler version 2.15.05.
  64. ^"OCaml library : Stdlib".ocaml.org. Retrieved2022-02-19.
  65. ^"OCaml library : Stdlib".ocaml.org. Retrieved2022-02-19.
  66. ^Perl documentation
  67. ^"PHP: Arithmetic Operators - Manual".www.php.net. Retrieved2021-11-20.
  68. ^"PHP: fmod - Manual".www.php.net. Retrieved2021-11-20.
  69. ^"EuclideanRing".
  70. ^"6. Expressions".Python documentation. Retrieved2026-01-21.
  71. ^"math — Mathematical functions".Python documentation. Retrieved2026-01-21.
  72. ^"math — Mathematical functions".Python documentation. Retrieved2026-01-21.
  73. ^QuantumWriter."Expressions".docs.microsoft.com. Retrieved2018-07-11.
  74. ^"R: Arithmetic Operators".search.r-project.org. Retrieved2022-12-24.
  75. ^"Operator expressions - The Rust Reference".doc.rust-lang.org. Retrieved2026-01-21.
  76. ^"F32 - Rust".
  77. ^abr6rs.org
  78. ^"Shell Command Language".pubs.opengroup.org. Retrieved2021-02-05.
  79. ^abANSI INCITS 319-1998 (R2002): Information Technology - Programming Languages - Smalltalk.American National Standards Institute (ANSI). 1998.
  80. ^"Solidity Documentation".docs.soliditylang.org. Retrieved2024-10-17.
  81. ^"Apple Developer Documentation".developer.apple.com. Retrieved2021-11-20.
  82. ^"Apple Developer Documentation".developer.apple.com. Retrieved2021-11-20.
  83. ^"Apple Developer Documentation".developer.apple.com. Retrieved2021-11-20.
  84. ^abRossberg, Andreas, ed. (19 April 2022)."WebAssembly Core Specification: Version 2.0".World Wide Web Consortium. § 4.3.2 Integer Operations.
  85. ^"Zig Documentation".Zig Programming Language. Retrieved2022-12-18.
  86. ^ab"Mod".Wolfram Language & System Documentation Center.Wolfram Research. 2020. RetrievedApril 8, 2020.

External links

[edit]
Retrieved from "https://en.wikipedia.org/w/index.php?title=Modulo&oldid=1336830408"
Categories:
Hidden categories:

[8]ページ先頭

©2009-2026 Movatter.jp