You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

18 lines
366 B

  1. #include "logarithmicFunctions.h"
  2. #include <stdio.h>
  3. #include <stdlib.h>
  4. #include <math.h>
  5. double* logarithm_two_integer(int base, int num){
  6. if(base <= 1 || num <= 0){
  7. return NULL;
  8. }
  9. double* result = (double*)malloc(sizeof(double));
  10. if (result == NULL) {
  11. return NULL;
  12. }
  13. *result = log(num) / log(base);
  14. return result;
  15. }