# An example of using the FYL2X instruction
#
# 对数函数
#
# 虽然FPU的对数函数只提供以2为底数的对数运算,但是可以使用其他对数底数执行计算。
#
# 使用底数为2的对数来计算其他底数的对数,可以使用下面的方程式:
# log (base b) X = (1/log(base 2) b) * log(base 2) X
#
.section .data
value:
.float 12.0
base:
.float 0.0
.section .bss
.lcomm result, 4
.section .text
.globl main
main:
nop
finit
fld1
flds base
fyl2x
fld1
fdivp
flds value
fyl2x
fsts result
movl $1, %eax
movl $0, %ebx
int $0x80
# gcc -g -o 11 11-log.s -m32
#