The following example is the implementation of the Arcsin function (the inverse of sin) taken from the standard Go library. |
|
package main
|
|
import (
"fmt"
)
|
|
func Asin(x float64) float64
|
|
func main() {
fmt.Println(Asin(1))
}
|
This |
#include "textflag.h"
|
In this example, we use the |
TEXT ·Asin(SB),NOSPLIT,$0-16
|
To implement the Arcsin function on a |
FMOVD x+0(FP), F0
FMOVD F0, F1
|
FMULD F0, F0
|
|
|
FLD1
|
|
FSUBRDP F0, F1
|
|
FSQRT
|
|
FPATAN
|
|
FMOVDP F0, ret+8(FP)
|
RET
|
Next example: Sync Atomic.