- Scilabヘルプ
- Elementary Functions
- bitwise
- Complex
- Discrete mathematics
- elementarymatrices
- Exponential
- Floating point
- Integer representation
- matrixmanipulation
- matrixoperations
- searchandsort
- setoperations
- signalprocessing
- Trigonometry
- &, &&
- ind2sub
- iscolumn
- isempty
- isequal
- ismatrix
- isrow
- isscalar
- issquare
- isvector
- modulo
- ndims
- |, ||
- size
- sub2ind
Please note that the recommended version of Scilab is 2026.0.0. This page might be outdated.
See the recommended documentation of this function
modulo
左オペランド符号を有するモジュロm剰余演算
pmodulo
正のモジュロmユークリッド剰余演算
呼出し手順
i = modulo(n,m)
i = pmodulo(n,m)
引数
- m, n
- エンコードされた整数, 実数または多項式の スカラー, ベクトル, またはハイパー行列 (ハイパー行列は多項式ではサポートされません). - mおよび- nは, 同じ型である必要があります. yが整数型の場合,(int8およびint16のように) 異なるエンコード長とすることが可能です. どちらもスカラーでない場合、yは同じ大きさとする 必要があります.
- i
- nと同じ型(および整数型)の スカラー, ベクトル, 行列またはハイパー行列.- iは,- mまたは- nの 大きい方の大きさとなります.
説明
modulo は,
            i= n (modulo m),
            すなわち, nをmで
            割った剰余を計算します.
i = n - m .* int (n ./ m).
            この式で,
            n または mが負の場合,
            答えが負となる可能性があります.
pmodulo は,
            i = n - |m| .* floor (n ./ |m|)
            を計算します.答えは正またはゼロとなります.
|  | mが1つ以上の値0を含む場合,modulo(x,m)およびpmodulo(x,m)はゼロ割を発生します.mhが実数型の場合,
            この例外はieee()モードに基づき処理されます.
            エンコードされた整数の場合,常にエラーを発生します. | 
例
n = [1,2,10,15]; m = [2,2,3,5]; modulo(n,m) modulo(-3, 9) modulo(10, -4) pmodulo(-3, 9) pmodulo(10, -6) pmodulo(-10, -6) // エンコードされた整数 modulo( int8(-13), int16(-7)) pmodulo(int8(-13), int16(-7)) modulo( int8(-13), int16([-7 5])) pmodulo(int8(-13), int16([-7 5])) modulo( int8([-13 8]), int16(-7)) pmodulo(int8([-13 8]), int16(-7)) modulo( int8([-13 8]), int16([-7 5])) pmodulo(int8([-13 8]), int16([-7 5])) // ハイパー行列 m = grand(2,2,2,"uin",-100,100) n = grand(2,2,2,"uin",-10 ,10); n(n==0) = 1 modulo(m, 5) pmodulo(m,5) modulo(51, n) pmodulo(51,n) modulo(m, n) pmodulo(m,n) // 多項式 modulo( %z^2+1, %z) pmodulo(%z^2+1, %z)
履歴
| Version | Description | 
| 5.5.0 | エンコードされた整数およびエンコードされた整数または実数の ハイパー行列に拡張されました. | 
| Report an issue | ||
| << isvector | Elementary Functions | ndims >> |