CKTIS / C#
System.Math: referencia práctica
System.Math: referencia práctica: Math proporciona funciones numéricas estáticas para tipos numéricos integrados.
Versión: .NET API; verified on .NET 10.0.14
Sintaxis
System.Math /* select a documented member or constructor */Math proporciona funciones numéricas estáticas para tipos numéricos integrados.
Úsalo para límites, potencias, raíces y redondeos eligiendo conscientemente la sobrecarga.
Float y double pueden producir NaN o infinito y tienen error de representación; el dinero suele requerir decimal.
Math.Clamp exige min menor o igual que max y Abs del menor valor con signo puede lanzar OverflowException.
El programa completo usa realmente System.Math; su stdout esperado exacto es 10.
Ejemplos
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));
Resultado
10
El programa completo usa realmente `System.Math`; su stdout esperado exacto es `10`.