2
2
// Use of this source code is governed by a BSD-style
3
3
// license that can be found in the LICENSE file.
5
// func Modf(x float64) (int float64, frac float64)
5
// func Modf(f float64) (int float64, frac float64)
7
FMOVD x+0(FP), F0 // F0=x
8
FMOVD F0, F1 // F0=x, F1=x
7
FMOVD f+0(FP), F0 // F0=f
8
FMOVD F0, F1 // F0=f, F1=f
9
9
FSTCW -2(SP) // save old Control Word
11
11
ORW $0x0c00, AX // Rounding Control set to truncate
12
12
MOVW AX, -4(SP) // store new Control Word
13
13
FLDCW -4(SP) // load new Control Word
14
FRNDINT // F0=trunc(x), F1=x
14
FRNDINT // F0=trunc(f), F1=f
15
15
FLDCW -2(SP) // load old Control Word
16
FSUBD F0, F1 // F0=trunc(x), F1=x-trunc(x)
17
FMOVDP F0, i+8(FP) // F0=x-trunc(x)
16
FSUBD F0, F1 // F0=trunc(f), F1=f-trunc(f)
17
FMOVDP F0, int+8(FP) // F0=f-trunc(f)
18
FMOVDP F0, frac+16(FP)