CKTIS / C#
System.Math: praktična referenca
System.Math: praktična referenca: Math pruža statičke brojčane funkcije za ugrađene brojčane tipove.
Verzija: .NET API; verified on .NET 10.0.14
Sintaksa
System.Math /* select a documented member or constructor */Math pruža statičke brojčane funkcije za ugrađene brojčane tipove.
Koristite ga za ograničavanje, potencije, korijene i zaokruživanje uz svjestan izbor preopterećenja.
Float i double mogu dati NaN ili beskonačnost i imaju pogreške prikaza; novac obično zahtijeva decimal.
Math.Clamp zahtijeva min najviše max, a Abs najmanje signed vrijednosti može baciti OverflowException.
Cijeli program doista koristi System.Math; točno očekivani stdout jest 10.
Primjeri
using System;
using System.Buffers;
using System.Collections.Concurrent;
using System.Collections.Frozen;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Text;
using System.Text.Json;
using System.Text.Json.Nodes;
using System.Text.Json.Serialization;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Channels;
using System.Threading.Tasks;
using Number = System.Int32;
Console.WriteLine(Math.Clamp(12, 0, 10));
Rezultat
10
Cijeli program doista koristi `System.Math`; točno očekivani stdout jest `10`.