Skip to content

Commit

Permalink
reduced maximum float precision
Browse files Browse the repository at this point in the history
  • Loading branch information
mickjc750 committed Aug 2, 2021
1 parent 6c45082 commit 79343ff
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions autotest/autotest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
#define FLOAT_TST_MIN 1E-5
#define FLOAT_TST_MAX 1E5

#define FLOAT_PREC_MAX 8

struct cmdopt_struct
{
bool i;
Expand Down Expand Up @@ -435,7 +437,7 @@ static void test_f(void)
if(rand()&1 && opts.prec)
{
strcat(fmt_buf, ".");
sprintf(&fmt_buf[strlen(fmt_buf)], "%i", 1+rand()%width);
sprintf(&fmt_buf[strlen(fmt_buf)], "%i", 1+rand()%FLOAT_PREC_MAX);
};

strcat(fmt_buf, "f");
Expand Down Expand Up @@ -492,7 +494,7 @@ static void test_e(void)
if(rand()&1 && opts.prec)
{
strcat(fmt_buf, ".");
sprintf(&fmt_buf[strlen(fmt_buf)], "%i", 1+rand()%width);
sprintf(&fmt_buf[strlen(fmt_buf)], "%i", 1+rand()%FLOAT_PREC_MAX);
};

strcat(fmt_buf, "e");
Expand Down Expand Up @@ -549,7 +551,7 @@ static void test_g(void)
if(rand()&1 && opts.prec)
{
strcat(fmt_buf, ".");
sprintf(&fmt_buf[strlen(fmt_buf)], "%i", 1+rand()%width);
sprintf(&fmt_buf[strlen(fmt_buf)], "%i", 1+rand()%FLOAT_PREC_MAX);
};

strcat(fmt_buf, "g");
Expand Down

0 comments on commit 79343ff

Please sign in to comment.