Home | History | Annotate | Download | only in math
      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 #include "textflag.h"
      6 
      7 // func Log1p(x float64) float64
      8 TEXT Log1p(SB),NOSPLIT,$0
      9 	FMOVD   $(2.928932188134524e-01), F0
     10 	FMOVD   x+0(FP), F0  // F0=x, F1=1-sqrt(2)/2 = 0.29289321881345247559915564
     11 	FABS                 // F0=|x|, F1=1-sqrt(2)/2
     12 	FUCOMPP F0, F1       // compare F0 to F1
     13 	FSTSW   AX
     14 	FLDLN2               // F0=log(2)
     15 	ANDW    $0x0100, AX
     16 	JEQ     use_fyl2x    // jump if F0 >= F1
     17 	FMOVD   x+0(FP), F0  // F0=x, F1=log(2)
     18 	FYL2XP1              // F0=log(1+x)=log2(1+x)*log(2)
     19 	FMOVDP  F0, ret+8(FP)
     20 	RET
     21 use_fyl2x:
     22 	FLD1                 // F0=1, F2=log(2)
     23 	FADDD   x+0(FP), F0  // F0=1+x, F1=log(2)
     24 	FYL2X                // F0=log(1+x)=log2(1+x)*log(2)
     25 	FMOVDP  F0, ret+8(FP)
     26 	RET
     27 
     28