tsmall whitespace changes - numtools - perform numerical operations on vectors … | |
git clone git://src.adamsgaard.dk/numtools | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit 3c29d668d8915f8bc94f4f7c6de66e182083a84d | |
parent 99dea624765baf7ba50b2fb3531c3ef7ea581685 | |
Author: Anders Damsgaard <[email protected]> | |
Date: Thu, 2 Sep 2021 22:32:09 +0200 | |
small whitespace changes | |
Diffstat: | |
M rangetest.c | 11 +++-------- | |
1 file changed, 3 insertions(+), 8 deletions(-) | |
--- | |
diff --git a/rangetest.c b/rangetest.c | |
t@@ -25,18 +25,16 @@ launch(char *cmd, char *cmd0, double val) | |
if ((c = strstr(cmd0, VALUESTR)) == NULL) | |
errx(1, VALUESTR " not found in cmd"); | |
- | |
if (strlcpy(cmd, cmd0, PATH_MAX) >= PATH_MAX) | |
err(1, "cmd too long"); | |
- | |
sprintf(cmd + (c - cmd0), "%g%s >/dev/null", val, c + strnlen(VALUESTR… | |
if (system(cmd)) { | |
fprintf(stderr, "%g\n", val); | |
return 1; | |
- } else { | |
+ } else | |
printf("%g\n", val); | |
- return 0; | |
- } | |
+ | |
+ return 0; | |
} | |
static void | |
t@@ -48,16 +46,13 @@ binary_search(char *cmd, char *cmd0, double minv, double m… | |
minfail = launch(cmd, cmd0, minv); | |
maxfail = launch(cmd, cmd0, maxv); | |
- | |
if (minfail && maxfail) | |
errx(2, "both min_val and max_val runs errored"); | |
- | |
else if (!minfail && !maxfail) | |
errx(3, "both min_val and max_val ran successfully"); | |
while (minv <= maxv && iter < maxiter) { | |
val = minv + 0.5 * (maxv - minv); | |
- | |
if (launch(cmd, cmd0, val)) { | |
if (maxfail) { | |
maxv = val; |