blob: 10eecd90e299202efdc3a0c88f62b72e779b599a [file] [log] [blame]
Brad Fitzpatrick51947442016-03-01 22:57:46 +00001// Copyright 2010 The Go Authors. All rights reserved.
Charles L. Dorianc28bd542010-07-12 11:30:11 -07002// Use of this source code is governed by a BSD-style
3// license that can be found in the LICENSE file.
4
Rob Pike8bca1482014-08-12 17:04:45 -07005#include "textflag.h"
Keith Randall1f796632013-08-12 10:25:18 -07006
Charles L. Dorianc28bd542010-07-12 11:30:11 -07007// func Log10(x float64) float64
Keith Randall1f796632013-08-12 10:25:18 -07008TEXT ·Log10(SB),NOSPLIT,$0
Charles L. Dorianc28bd542010-07-12 11:30:11 -07009 FLDLG2 // F0=log10(2)
10 FMOVD x+0(FP), F0 // F0=x, F1=log10(2)
11 FYL2X // F0=log10(x)=log2(x)*log10(2)
Russ Cox07720b62013-03-22 12:57:55 -040012 FMOVDP F0, ret+8(FP)
Charles L. Dorianc28bd542010-07-12 11:30:11 -070013 RET
14
15// func Log2(x float64) float64
Keith Randall1f796632013-08-12 10:25:18 -070016TEXT ·Log2(SB),NOSPLIT,$0
Charles L. Dorianc28bd542010-07-12 11:30:11 -070017 FLD1 // F0=1
18 FMOVD x+0(FP), F0 // F0=x, F1=1
19 FYL2X // F0=log2(x)
Russ Cox07720b62013-03-22 12:57:55 -040020 FMOVDP F0, ret+8(FP)
Charles L. Dorianc28bd542010-07-12 11:30:11 -070021 RET