The Go Programming Language

Source file src/pkg/math/fdim.go

     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 math
     6	
     7	// Fdim returns the maximum of x-y or 0.
     8	func Fdim(x, y float64) float64 {
     9		if x > y {
    10			return x - y
    11		}
    12		return 0
    13	}
    14	
    15	// Fmax returns the larger of x or y.
    16	func Fmax(x, y float64) float64 {
    17		if x > y {
    18			return x
    19		}
    20		return y
    21	}
    22	
    23	// Fmin returns the smaller of x or y.
    24	func Fmin(x, y float64) float64 {
    25		if x < y {
    26			return x
    27		}
    28		return y
    29	}

release.r60.3. Except as noted, this content is licensed under a Creative Commons Attribution 3.0 License.