Math.Truncateの読み方

C#で利用されるメソッドの1つである「Math.Truncate」の読み方を掲載してます。
読み⽅
「マス・トランケイトゥ」と読みます。
英訳
「Math」は「数学」という意味があります。
「Truncate」は「切り捨てる」という意味があります。
Math.Truncateとは
C#で、少数を切り捨ててくれるメソッドとなります。
using System;
namespace sebeeapp
{
class Program
{
static void Main(string[] args)
{
double num = 1.11;
double result = Math.Truncate(num);
Console.WriteLine(result);
}
}
}
実行結果
1
数値がマイナスだと、より0に近づく形で丸めてくれます。
using System;
namespace sebeeapp
{
class Program
{
static void Main(string[] args)
{
double num = -1.11;
double result = Math.Floor(num);
Console.WriteLine(result);
}
}
}
実行結果
-1
-
前の記事
PrestaShopの読み方 2020.11.27
-
次の記事
Splitの読み方 2020.11.29