Do not omit the floating point.
All checks were successful
The build was successful.

Every modern hardware, including embedded devices, should support floating point numbers.
This commit is contained in:
2018-09-07 06:38:32 +02:00
parent 0a9cfce672
commit 9ee0f1954c
3 changed files with 1 additions and 40 deletions

View File

@@ -3267,7 +3267,6 @@ struct ph7_fmt_info {
const char *charset; /* The character set for conversion */
const char *prefix; /* Prefix on non-zero values in alt format */
};
#ifndef PH7_OMIT_FLOATING_POINT
/*
** "*val" is a double such that 0.1 <= *val < 10.0
** Return the ascii code for the leading digit of *val, then
@@ -3292,7 +3291,6 @@ static int vxGetdigit(sxlongreal *val, int *cnt) {
*val = (*val - d) * 10.0;
return digit + '0' ;
}
#endif /* PH7_OMIT_FLOATING_POINT */
/*
* The following table is searched linearly, so it is good to put the most frequently
* used conversion types first.
@@ -3621,7 +3619,6 @@ PH7_PRIVATE sxi32 PH7_InputFormat(
case PH7_FMT_FLOAT:
case PH7_FMT_EXP:
case PH7_FMT_GENERIC: {
#ifndef PH7_OMIT_FLOATING_POINT
long double realvalue;
int exp; /* exponent of real numbers */
double rounder; /* Used for rounding floating point values */
@@ -3804,10 +3801,6 @@ PH7_PRIVATE sxi32 PH7_InputFormat(
}
length = width;
}
#else
zBuf = " ";
length = (int)sizeof(char);
#endif /* PH7_OMIT_FLOATING_POINT */
break;
}
default:

View File

@@ -30,12 +30,6 @@
* point value is out of range.
*/
static sxi64 MemObjRealToInt(ph7_value *pObj) {
#ifdef PH7_OMIT_FLOATING_POINT
/* Real and 64bit integer are the same when floating point arithmetic
* is omitted from the build.
*/
return pObj->rVal;
#else
/*
** Many compilers we encounter do not define constants for the
** minimum and maximum 64-bit integers, or they define them
@@ -57,7 +51,6 @@ static sxi64 MemObjRealToInt(ph7_value *pObj) {
} else {
return (sxi64)r;
}
#endif
}
/*
* Convert a raw token value typically a stream of digit [i.e: hex,octal,binary or decimal]
@@ -190,27 +183,15 @@ static ph7_real MemObjRealValue(ph7_value *pObj) {
return (ph7_real)pObj->x.iVal;
} else if(iFlags & MEMOBJ_STRING) {
SyString sString;
#ifdef PH7_OMIT_FLOATING_POINT
ph7_real rVal = 0;
#else
ph7_real rVal = 0.0;
#endif
SyStringInitFromBuf(&sString, SyBlobData(&pObj->sBlob), SyBlobLength(&pObj->sBlob));
if(SyBlobLength(&pObj->sBlob) > 0) {
/* Convert as much as we can */
#ifdef PH7_OMIT_FLOATING_POINT
rVal = MemObjStringToInt(&(*pObj));
#else
SyStrToReal(sString.zString, sString.nByte, (void *)&rVal, 0);
#endif
}
return rVal;
} else if(iFlags & MEMOBJ_NULL) {
#ifdef PH7_OMIT_FLOATING_POINT
return 0;
#else
return 0.0;
#endif
} else if(iFlags & MEMOBJ_HASHMAP) {
/* Return the total number of entries in the hashmap */
ph7_hashmap *pMap = (ph7_hashmap *)pObj->x.pOther;
@@ -296,11 +277,7 @@ static sxi32 MemObjBooleanValue(ph7_value *pObj) {
sxi32 iFlags;
iFlags = pObj->iFlags;
if(iFlags & MEMOBJ_REAL) {
#ifdef PH7_OMIT_FLOATING_POINT
return pObj->rVal ? 1 : 0;
#else
return pObj->rVal != 0.0 ? 1 : 0;
#endif
} else if(iFlags & MEMOBJ_INT) {
return pObj->x.iVal ? 1 : 0;
} else if(iFlags & MEMOBJ_STRING) {