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.
7 // Modf returns integer and fractional floating-point numbers
8 // that sum to f. Both values have the same sign as f.
12 // Modf(±Inf) = ±Inf, NaN
13 // Modf(NaN) = NaN, NaN
14 func Modf(f float64) (int float64, frac float64) {
21 func modf(f float64) (int float64, frac float64) {
28 return f, f // Return -0, -0 when f == -0
34 e := uint(x>>shift)&mask - bias
36 // Keep the top 12+e bits, the integer part; clear the rest.
38 x &^= 1<<(64-12-e) - 1
40 int = Float64frombits(x)