次の方法で共有


Number.Mod

構文

Number.Mod(
    number as nullable number,
    divisor as nullable number,
    optional precision as nullable number
) as nullable number

バージョン情報

divisor による number の整数除算から得られた剰余を返します。 numberまたはdivisornull場合、この関数はnullを返します。

  • number:被除数です。
  • divisor:序数です。
  • precision: (省略可能) 整数除算の有効桁数。 このパラメーターには、Double または Decimal が指定できます。 既定値は Precision.Double です。

例 1

5 を 3 で除算した場合の剰余を求めます。

使用方法

Number.Mod(5, 3)

出力

2

例 2

Double精度とDecimal精度の両方を使用して、10.5 を 0.2 で除算した場合の剰余を見つけます。

使用方法

let
    Dividend = 10.5,
    Divisor = 0.2,

    #"Use Double Precision" = Number.Mod(Dividend, Divisor, Precision.Double),
    #"Use Decimal Precision" = Number.Mod(Dividend, Divisor, Precision.Decimal),

    // Convert to text to inspect precision
    #"Double To Text" = Number.ToText(#"Use Double Precision", "G"),
    #"Decimal To Text" = Number.ToText(#"Use Decimal Precision", "G"),
    
    #"Display Result" = [
        DoublePrecision = #"Double To Text",
        DecimalPrecision = #"Decimal To Text"
    ]

in
    #"Display Result"

出力

[
    DoublePrecision = "0.0999999999999994",
    DecimalPrecision = "0.1"
]