github.com/xushiwei/go@v0.0.0-20130601165731-2b9d83f45bc9/src/pkg/math/log1p_386.s (about) 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 // func Log1p(x float64) float64 6 TEXT ·Log1p(SB),7,$0 7 FMOVD $(2.928932188134524e-01), F0 8 FMOVD x+0(FP), F0 // F0=x, F1=1-sqrt(2)/2 = 0.29289321881345247559915564 9 FABS // F0=|x|, F1=1-sqrt(2)/2 10 FUCOMPP F0, F1 // compare F0 to F1 11 FSTSW AX 12 FLDLN2 // F0=log(2) 13 ANDW $0x0100, AX 14 JEQ use_fyl2x // jump if F0 >= F1 15 FMOVD x+0(FP), F0 // F0=x, F1=log(2) 16 FYL2XP1 // F0=log(1+x)=log2(1+x)*log(2) 17 FMOVDP F0, ret+8(FP) 18 RET 19 use_fyl2x: 20 FLD1 // F0=1, F2=log(2) 21 FADDD x+0(FP), F0 // F0=1+x, F1=log(2) 22 FYL2X // F0=log(1+x)=log2(1+x)*log(2) 23 FMOVDP F0, ret+8(FP) 24 RET 25