Skip to content

Commit

Permalink
avoid float
Browse files Browse the repository at this point in the history
  • Loading branch information
koendv committed Nov 4, 2023
1 parent b332cc4 commit 3b07bef
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/ftoa.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ static uint64_t multiply(uint64_t x, uint32_t y)

static int k_comp(int n)
{
float ds = n * 0.30103f;
int k = (int)ds;
/* k = n * log(2); */
int32_t k = (int32_t)n * 97879 / 325147;
return n < 0 ? k - 1 : k;
}

Expand Down

0 comments on commit 3b07bef

Please sign in to comment.