Processing math: 100%

SCULIB_POWER2

Calculate next highest power of 2

Description:

Given a number, returns that number or the next highest number that is a power of 2, and returns the power itself. If N<1, GEN_POWER2 is returned as -1, and NP2 is returned as 0.

Invocation

I = SCULIB_POWER2 (N, NP2)

Arguments

N = INTEGER (Given)
The number in question.
NP2 = INTEGER (Returned)
The next number that is a power of 2. Returns 0 if N is less than 1.

Returned Value

SCULIB_POWER2 = INTEGER (Returned)
The power of 2. ie NP2=2SCULIB_POWER2. Returns -1 if N is less than 1.

Copyright

Copyright ©1992,1999 Particle Physics and Astronomy Research Council. All Rights Reserved.