github.com/aykevl/tinygo@v0.5.0/testdata/math.go (about)

     1  package main
     2  
     3  import "math"
     4  
     5  func main() {
     6  	for _, n := range []float64{0.3, 1.5, 2.6, -1.1, -3.1, -3.8} {
     7  		println("n:", n)
     8  		println("  asin:     ", math.Asin(n))
     9  		println("  asinh:    ", math.Asinh(n))
    10  		println("  acos:     ", math.Acos(n))
    11  		println("  acosh:    ", math.Acosh(n))
    12  		println("  atan:     ", math.Atan(n))
    13  		println("  atanh:    ", math.Atanh(n))
    14  		println("  atan2:    ", math.Atan2(n, 0.2))
    15  		println("  cbrt:     ", math.Cbrt(n))
    16  		println("  ceil:     ", math.Ceil(n))
    17  		println("  cos:      ", math.Cos(n))
    18  		println("  cosh:     ", math.Cosh(n))
    19  		println("  erf:      ", math.Erf(n))
    20  		println("  erfc:     ", math.Erfc(n))
    21  		println("  exp:      ", math.Exp(n))
    22  		println("  expm1:    ", math.Expm1(n))
    23  		println("  exp2:     ", math.Exp2(n))
    24  		println("  floor:    ", math.Floor(n))
    25  		f, e := math.Frexp(n)
    26  		println("  frexp:    ", f, e)
    27  		println("  hypot:    ", math.Hypot(n, n*2))
    28  		println("  ldexp:    ", math.Ldexp(n, 2))
    29  		println("  log:      ", math.Log(n))
    30  		println("  log1p:    ", math.Log1p(n))
    31  		println("  log10:    ", math.Log10(n))
    32  		println("  log2:     ", math.Log2(n))
    33  		println("  max:      ", math.Max(n, n+1))
    34  		println("  min:      ", math.Min(n, n+1))
    35  		println("  mod:      ", math.Mod(n, n+1))
    36  		i, f := math.Modf(n)
    37  		println("  modf:     ", i, f)
    38  		println("  pow:      ", math.Pow(n, n))
    39  		println("  remainder:", math.Remainder(n, n+0.2))
    40  		println("  sin:      ", math.Sin(n))
    41  		println("  sinh:     ", math.Sinh(n))
    42  		println("  tan:      ", math.Tan(n))
    43  		println("  tanh:     ", math.Tanh(n))
    44  		println("  trunc:    ", math.Trunc(n))
    45  	}
    46  }