Disponible

amalgame-math

sqrt / sin / cos / pow / log, constantes, IsPrime.

Vue d'ensemble

Fonctions mathématiques classiques en flottants : trigonométrie, exponentielle/logarithme, puissances, arrondis. Constantes : π, e, τ, √2, ln 2, ln 10. Utilitaires entiers (GCD, LCM, IsPrime). Couche fine au-dessus de libm.

Caractéristiques

  • ✓Trigonométrie : Sin, Cos, Tan, Asin, Acos, Atan, Atan2, Sinh, Cosh, Tanh
  • ✓Exponentiation : Exp, Log, Log2, Log10, Pow, Sqrt, Cbrt
  • ✓Constantes : Math.PI(), E(), TAU(), SQRT2(), LN2(), LN10(), INF()
  • ✓Entiers : AbsI, PowI, MinI, MaxI, ClampI, Gcd, Lcm, IsPrime
  • ✓Arrondis et contrôles : Floor, Ceil, Round, Trunc, IsNaN, IsInf, IsFinite, ApproxEq
  • ✓Wrapper minimaliste autour de libm

Exemple

Exemple minimal d'utilisation — recopiable tel quel après l'install.

amc package add math

import Amalgame.Math

class Program {
    public static void Main() {
        let h: float = Math.Sqrt(Math.Pow(3.0, 2.0) + Math.Pow(4.0, 2.0))
        Console.WriteLine(String_FromFloat(h))                          // 5
        Console.WriteLine(String_FromInt(Math.Gcd(48, 18)))             // 6
        Console.WriteLine(String_FromFloat(Math.Sin(Math.PI() / 2.0)))  // 1
        if (Math.IsPrime(97)) {
            Console.WriteLine("97 is prime")
        }
    }
}

En bref

Packages liés