Skip to main content

This is documentation for Caché & Ensemble. See the InterSystems IRIS version of this content.Opens in a new tab

For information on migrating to InterSystems IRISOpens in a new tab, see Why Migrate to InterSystems IRIS?

Round

指定された小数点位置で丸められた数を返します。

Synopsis

Round(expression[,numdecimalplaces])

引数

expression 丸めを行う数値式。
numdecimalplaces オプション — 丸める小数点以下の桁数を指定します。省略した場合、整数に丸められた expression が返されます。

概要

Round 関数では、5 以上は常に切り上げられます。先頭のゼロや末尾のゼロは削除されます。

Round では以下に丸めた expression を返します。

  • 引数 numdecimalplaces が省略されるか、0 が指定されるか、空の文字列 ("") または負の整数が指定された場合、整数。

  • (末尾のゼロが削除された) 指定の小数点以下の桁数。numdecimalplaces の小数点以下の値は、整数に切り捨てられます。

  • 引数 numdecimalplaces が実際の小数点以下の桁数より多いか等しい場合、(末尾のゼロが削除された) 実際の小数点以下の桁数。

以下の例は Round 関数を使用して、数値を小数点 3 桁に丸めます。

Dim MyVar, pi
pi = 3.14159
MyVar = Round(pi,3) ' MyVar contains 3.142.
Println MyVar

関連項目

FeedbackOpens in a new tab