1 // Copyright 2009-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.
8 Floating-point mod function.
11 // Mod returns the floating-point remainder of x/y.
12 // The magnitude of the result is less than y and its
13 // sign agrees with that of x.
21 func Mod(x
, y
float64) float64 {
22 return libc_fmod(x
, y
)
26 func libc_fmod(float64, float64) float64
28 func mod(x
, y
float64) float64 {
29 if y
== 0 ||
IsInf(x
, 0) ||
IsNaN(x
) ||
IsNaN(y
) {
45 r
= r
- Ldexp(y
, rexp
-yexp
)