mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
core: replace IS_FP_SAME macro by inline function
No reason to keep this as a macro - a function is easier to read, type safe and easier to debug. Moreover, give it the more appropriate name "nearly_equal()". After all, it precisely does NOT check floating points for equality. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
5db4a95a26
commit
61701509b0
9 changed files with 28 additions and 25 deletions
|
@ -161,7 +161,7 @@ static enum number_type parse_float(const char *buffer, double *res, const char
|
|||
if (errno || *endp == buffer)
|
||||
return NEITHER;
|
||||
if (**endp == ',') {
|
||||
if (IS_FP_SAME(val, rint(val))) {
|
||||
if (nearly_equal(val, rint(val))) {
|
||||
/* we really want to send an error if this is a Subsurface native file
|
||||
* as this is likely indication of a bug - but right now we don't have
|
||||
* that information available */
|
||||
|
@ -604,7 +604,7 @@ static void fahrenheit(char *buffer, temperature_t *temperature)
|
|||
|
||||
switch (integer_or_float(buffer, &val)) {
|
||||
case FLOATVAL:
|
||||
if (IS_FP_SAME(val.fp, 32.0))
|
||||
if (nearly_equal(val.fp, 32.0))
|
||||
break;
|
||||
if (val.fp < 32.0)
|
||||
temperature->mkelvin = C_to_mkelvin(val.fp);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue