CKTIS / C#
System.Math: practical reference
System.Math: practical reference: Math provides static numeric functions for built-in number types.
Version: .NET API; verified on .NET 10.0.14
Syntax
System.Math /* select a documented member or constructor */Math provides static numeric functions for built-in number types.
Use it for clamping, powers, roots, and rounding with deliberate overload selection.
Float and double can produce NaN or infinity and have representation error; monetary values usually need decimal.
Math.Clamp requires min no greater than max, and Abs of the smallest signed value can throw OverflowException.
The complete program actually uses System.Math; its exact expected stdout is 10.
Examples
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));
Result
10
The complete program actually uses `System.Math`; its exact expected stdout is `10`.