您的位置:首页 > 其它

log2

2016-05-25 00:00 246 查看
摘要: log2

log2

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

Y = log2(X)
[F,E] = log2(X)

Description

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

[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.

Examples

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

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
More About

expand all
Tips
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.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  log2