"Fossies" - the Fresh Open Source Software Archive

Member "go/src/math/cmplx/abs.go" (9 Sep 2020, 420 Bytes) of package /windows/misc/go1.14.9.windows-386.zip:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Go source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. See also the last Fossies "Diffs" side-by-side code changes report for "abs.go": 1.14.7_vs_1.15.

    1 // Copyright 2010 The Go 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 // Package cmplx provides basic constants and mathematical functions for
    6 // complex numbers.
    7 package cmplx
    8 
    9 import "math"
   10 
   11 // Abs returns the absolute value (also called the modulus) of x.
   12 func Abs(x complex128) float64 { return math.Hypot(real(x), imag(x)) }