log2 函数

来源:互联网 发布:python 延时1秒 编辑:程序博客网 时间:2024/06/01 16:31

log2 函数

Base 2 logarithm and dissect floating-point numbers into exponent and mantissa

2位基底的对数和解析浮点数值到指数和尾数。

Syntax

语法

Y = log2(X)

[F,E] = log2(X)

Description

描述

Y = log2(X) computes the base 2 logarithm of the elements of X. 

Y=log2(X)计算X的元素以2为基底的对数。

[F,E] = log2(X) returns arrays F and E. Argument F is an array of real values, usually in the range 0.5 <= abs(F) < 1. For real X, F satisfies the equation: X = F.*2.^E. Argument E is an array of integers that, for real X, satisfy the equation: X = F.*2.^E.

[F,E]=log2(X)返回阵列FE。自变量F是一个实数的阵列,通常在区间0.5 <= abs(F) < 1。实数XF满足方程:X=F.*2.^E。自变量E是一个整数阵列,实际X,满足方程:X=F.*2.^E

Remarks

备注

This function corresponds to the ANSI C function frexp() and the IEEE floating-point standard function logb(). Any zeros in X produce F = 0 and E = 0. 

函数相当于ANSI C函数frexp()IEEE浮点标准函数logb()X中的任何零,结果F=0E=0

Examples

例如

For IEEE arithmetic, the statement [F,E] = log2(X) yields the values: 

计算IEEE运算,算式[F,E]=log2(X)得到的值:

X  F E

1  1/2 1

pi  pi/4  2

-3  -3/4 2

eps  1/2  -51

Realmax 1-eps/2 1024

realmin  1/2  -1021

原创粉丝点击