Powershell - Round down to nearest whole number

后端 未结 4 1008
無奈伤痛
無奈伤痛 2021-02-05 02:20

What\'s the best way to round down to nearest whole number in Powershell?

I am trying [math]::truncate but its not giving me predictable results.

Example:

<
4条回答
  •  旧巷少年郎
    2021-02-05 03:07

    The Math::Floor function combined with [decimal] declaration should give you the results you want.

    [Math]::Floor([decimal](17.27975/0.1))

    returns = 172

提交回复
热议问题