summaryrefslogtreecommitdiff
path: root/libgo/go/math/cmplx/abs.go
diff options
context:
space:
mode:
authorbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2011-12-07 12:13:23 +0000
committerbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2011-12-07 12:13:23 +0000
commit007670eddc01d11ff1dcc4229c10c7755e48dca9 (patch)
tree0373601b01fbd7966bc4a6e634699aef2af18fbd /libgo/go/math/cmplx/abs.go
parentec6f02586a7b4bef66a49febd0b491471668d8f7 (diff)
downloadgcc-007670eddc01d11ff1dcc4229c10c7755e48dca9.tar.gz
2011-12-07 Basile Starynkevitch <basile@starynkevitch.net>
MELT branch merged with trunk rev 182077 using svnmerge git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@182079 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgo/go/math/cmplx/abs.go')
-rw-r--r--libgo/go/math/cmplx/abs.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/libgo/go/math/cmplx/abs.go b/libgo/go/math/cmplx/abs.go
new file mode 100644
index 00000000000..f3cd1073ed2
--- /dev/null
+++ b/libgo/go/math/cmplx/abs.go
@@ -0,0 +1,12 @@
+// Copyright 2010 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// Package cmplx provides basic constants and mathematical functions for
+// complex numbers.
+package cmplx
+
+import "math"
+
+// Abs returns the absolute value (also called the modulus) of x.
+func Abs(x complex128) float64 { return math.Hypot(real(x), imag(x)) }