| 1 | // Copyright ©2015 The Gonum Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style |
| 3 | // license that can be found in the LICENSE file. |
| 4 | |
| 5 | //go:build (!amd64 && !arm64) || noasm || gccgo || safe |
| 6 | // +build !amd64,!arm64 noasm gccgo safe |
| 7 | |
| 8 | package math32 |
| 9 | |
| 10 | import ( |
| 11 | "math" |
| 12 | ) |
| 13 | |
| 14 | // Sqrt returns the square root of x. |
| 15 | // |
| 16 | // Special cases are: |
| 17 | // |
| 18 | // Sqrt(+Inf) = +Inf |
| 19 | // Sqrt(±0) = ±0 |
| 20 | // Sqrt(x < 0) = NaN |
| 21 | // Sqrt(NaN) = NaN |
| 22 | func Sqrt(x float32) float32 { |
| 23 | // FIXME(kortschak): Direct translation of the math package |
| 24 | // asm code for 386 fails to build. |
| 25 | return float32(math.Sqrt(float64(x))) |
| 26 | } |