Project

General

Profile

Feature #526

Fn to test if an integer is a power of 2

Added by John Abbott about 10 years ago. Updated about 10 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
New Function
Start date:
08 Apr 2014
Due date:
% Done:

100%

Estimated time:
0.50 h
Spent time:

Description

It would be handy sometimes to have a function which says whether an integer is a power of 2; perhaps if its absolute value is a power of 2.

GMP does not have a direct fn for this.

History

#1 Updated by John Abbott about 10 years ago

  • Status changed from New to Feedback
  • % Done changed from 0 to 90

I have implemented in IntOperations both for BigInt and MachineInt.

Also added doc and some tests.

The fn says whether value is positive and is a power of 2.

#2 Updated by John Abbott about 10 years ago

  • Status changed from Feedback to Closed
  • % Done changed from 90 to 100

Also available in: Atom PDF