Skip to content

Commit

Permalink
Troubleshoot MacOS bug
Browse files Browse the repository at this point in the history
  • Loading branch information
mattiaisgro committed Dec 19, 2024
1 parent b11e341 commit 8de24cc
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/core/real_analysis.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
#include "./constants.h"
#include "./error.h"

#include <iostream>


namespace theoretica {

Expand Down Expand Up @@ -424,6 +426,8 @@ namespace theoretica {
/// the `fyl2x` instruction will be used.
inline real log2(real x) {

std::cout << "Computing binary logarithm..." << std::endl;

if(x <= 0) {

if(x == 0) {
Expand All @@ -437,10 +441,13 @@ namespace theoretica {

#ifdef THEORETICA_X86

std::cout << "Using x86 Assembly..." << std::endl;

// Approximate the binary logarithm of x by
// exploiting x86 Assembly instructions
return fyl2x(x, 1.0);
#else
std::cout << "Using fallback implementation..." << std::endl;

// Domain reduction to [1, +inf)
if(x < 1)
Expand All @@ -452,6 +459,8 @@ namespace theoretica {
while(x > (1 << i))
i++;

TH_DEBUG(i);

// Domain reduction to [1, 2]
x /= (1 << i);

Expand Down

0 comments on commit 8de24cc

Please sign in to comment.