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 Asin(x float64) float64
      8 TEXT Asin(SB),NOSPLIT,$0
      9 	FMOVD   x+0(FP), F0  // F0=sin(x)
     10 	FMOVD   F0, F1       // F0=sin(x), F1=sin(x)
     11 	FMULD   F0, F0       // F0=sin(x)*sin(x), F1=sin(x)
     12 	FLD1                 // F0=1, F1=sin(x)*sin(x), F2=sin(x)
     13 	FSUBRDP F0, F1       // F0=1-sin(x)*sin(x) (=cos(x)*cos(x)), F1=sin(x)
     14 	FSQRT                // F0=cos(x), F1=sin(x)
     15 	FPATAN               // F0=arcsin(sin(x))=x
     16 	FMOVDP  F0, ret+8(FP)
     17 	RET
     18 
     19 // func Acos(x float64) float64
     20 TEXT Acos(SB),NOSPLIT,$0
     21 	FMOVD   x+0(FP), F0  // F0=cos(x)
     22 	FMOVD   F0, F1       // F0=cos(x), F1=cos(x)
     23 	FMULD   F0, F0       // F0=cos(x)*cos(x), F1=cos(x)
     24 	FLD1                 // F0=1, F1=cos(x)*cos(x), F2=cos(x)
     25 	FSUBRDP F0, F1       // F0=1-cos(x)*cos(x) (=sin(x)*sin(x)), F1=cos(x)
     26 	FSQRT                // F0=sin(x), F1=cos(x)
     27 	FXCHD   F0, F1       // F0=cos(x), F1=sin(x)
     28 	FPATAN               // F0=arccos(cos(x))=x
     29 	FMOVDP	F0, ret+8(FP)
     30 	RET
     31