[Overview][Constants][Types][Classes][Procedures and functions][Index] Reference for unit 'math' (#rtl)

log2

Return 2-based logarithm

Declaration

Source position: math.pp line 358

function log2(

  x: Float

):Float;

Description

Log2 returns the 2-base logarithm of X.

Errors

If x is less than or equal to 0 an 'invalid fpu operation' error will occur.

See also

ldexp

  

Return (2 to the power p) times x

lnxp1

  

Return natural logarithm of 1+X

log10

  

Return 10-Based logarithm.

logn

  

Return N-based logarithm.

Example

Program Example22;

{ Program to demonstrate the log2 function. }

Uses math;

begin
  Writeln(Log2(2):8:4);
  Writeln(Log2(4):8:4);
  Writeln(Log2(8):8:4);
  Writeln(Log2(1):8:4);
  Writeln(Log2(0.5):8:4);
  Writeln(Log2(0.25):8:4);
  Writeln(Log2(0.125):8:4);
end.

Documentation generated on: Nov 16 2015