"Fossies" - the Fresh Open Source Software Archive

Member "go/src/math/abs.go" (9 Sep 2020, 363 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.

    1 // Copyright 2009 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 math
    6 
    7 // Abs returns the absolute value of x.
    8 //
    9 // Special cases are:
   10 //  Abs(┬▒Inf) = +Inf
   11 //  Abs(NaN) = NaN
   12 func Abs(x float64) float64 {
   13     return Float64frombits(Float64bits(x) &^ (1 << 63))
   14 }