Commit 2cd7f855 authored by Vesa Oikonen's avatar Vesa Oikonen
Browse files

fabsf() to fabs() in order to prevent compiler warning in macOS

parent 72eef11c
......@@ -343,33 +343,34 @@ int test_floatGetWithUnit(
ret=floatGetWithUnit(str, &v, NULL); if(verbose>2) printf(" -> %g\n", v);
if(ret==0 || !isnan(v)) return(4);
// below fabs() used instead of fabsf() because compiler converts values to doubles
strcpy(str, "1.2345"); if(verbose>1) printf("str := '%s'\n", str);
ret=floatGetWithUnit(str, &v, NULL); if(verbose>2) printf(" -> %g\n", v);
if(ret!=0 || fabsf(v-1.2345)>1.0E-006) return(11);
if(ret!=0 || fabs(v-1.2345)>1.0E-006) return(11);
strcpy(str, "1,2345"); if(verbose>1) printf("str := '%s'\n", str);
ret=floatGetWithUnit(str, &v, NULL); if(verbose>2) printf(" -> %g\n", v);
if(ret!=0 || fabsf(v-1.2345)>1.0E-006) return(12);
if(ret!=0 || fabs(v-1.2345)>1.0E-006) return(12);
strcpy(str, "+1.2345E4"); if(verbose>1) printf("str := '%s'\n", str);
ret=floatGetWithUnit(str, &v, NULL); if(verbose>2) printf(" -> %g\n", v);
if(ret!=0 || fabsf(v-12345)>1.0E-006) return(13);
if(ret!=0 || fabs(v-12345.0)>1.0E-006) return(13);
strcpy(str, "-1,2345E4"); if(verbose>1) printf("str := '%s'\n", str);
ret=floatGetWithUnit(str, &v, NULL); if(verbose>2) printf(" -> %g\n", v);
if(ret!=0 || fabsf(v-(-12345))>1.0E-006) return(14);
if(ret!=0 || fabs(v-(-12345.0))>1.0E-006) return(14);
strcpy(str, "1.2345 sec"); if(verbose>1) printf("str := '%s'\n", str);
ret=floatGetWithUnit(str, &v, &unit);
if(verbose>2) printf(" -> %g %s\n", v, unitName(unit));
if(ret!=0 || fabsf(v-1.2345)>1.0E-006 || unit!=UNIT_SEC) return(21);
if(ret!=0 || fabs(v-1.2345)>1.0E-006 || unit!=UNIT_SEC) return(21);
strcpy(str, "1,2345 viallinen"); if(verbose>1) printf("str := '%s'\n", str);
ret=floatGetWithUnit(str, &v, &unit);
if(verbose>2) printf(" -> %g %s\n", v, unitName(unit));
if(ret!=0 || fabsf(v-1.2345)>1.0E-006 || unit!=UNIT_UNKNOWN) return(22);
if(ret!=0 || fabs(v-1.2345)>1.0E-006 || unit!=UNIT_UNKNOWN) return(22);
strcpy(str, "+1.2345E4 min"); if(verbose>1) printf("str := '%s'\n", str);
ret=floatGetWithUnit(str, &v, &unit); if(verbose>2) printf(" -> %g\n", v);
if(ret!=0 || fabsf(v-12345)>1.0E-006 || unit!=UNIT_MIN) return(23);
if(ret!=0 || fabs(v-12345.0)>1.0E-006 || unit!=UNIT_MIN) return(23);
strcpy(str, "-1,2345E4 1/min"); if(verbose>1) printf("str := '%s'\n", str);
ret=floatGetWithUnit(str, &v, &unit); if(verbose>2) printf(" -> %g\n", v);
if(ret!=0 || fabsf(v-(-12345))>1.0E-006 || unit!=UNIT_PER_MIN) return(24);
if(ret!=0 || fabs(v-(-12345.0))>1.0E-006 || unit!=UNIT_PER_MIN) return(24);
statusSet(status, __func__, __FILE__, __LINE__, 0);
return(0);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment