Сделал 1е Задание по Битовым операциям
This commit is contained in:
parent
baa0509a01
commit
060d43dbcf
4 changed files with 51 additions and 0 deletions
13
BitwiseOperations/1Ex/pow.c
Normal file
13
BitwiseOperations/1Ex/pow.c
Normal file
|
@ -0,0 +1,13 @@
|
|||
#include "pow.h"
|
||||
|
||||
double bitwisePow(double number, int exponent) {
|
||||
double result = 1;
|
||||
|
||||
while (exponent != 0) {
|
||||
if (exponent & 1) result *= number;
|
||||
number *= number;
|
||||
exponent >>= 1;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue