
This simplifies src/runtime/math.go, which I eventually want to remove entirely by moving the given functionality into the compiler.
14 строки
275 Б
Go
14 строки
275 Б
Go
package main
|
|
|
|
// Test how intrinsics are lowered: either as regular calls to the math
|
|
// functions or as LLVM builtins (such as llvm.sqrt.f64).
|
|
|
|
import "math"
|
|
|
|
func mySqrt(x float64) float64 {
|
|
return math.Sqrt(x)
|
|
}
|
|
|
|
func myTrunc(x float64) float64 {
|
|
return math.Trunc(x)
|
|
}
|