Skip to content

Commit

Permalink
Update fuzzy.c
Browse files Browse the repository at this point in the history
Replace the `abs` function (works with integer values) with the `fabs` function (works with floating and double values)
  • Loading branch information
ecodiv committed Sep 20, 2023
1 parent 0b17673 commit 7d9b746
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/raster/r.fuzzy.set/fuzzy.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include <grass/glocale.h>
#include "local_proto.h"
#include <math.h>

float fuzzy(FCELL cell)
{
Expand Down Expand Up @@ -42,7 +43,7 @@ float fuzzy(FCELL cell)
}

if (type == SSHAPE) {
m = pow(2, exp(2 * abs(shape)));
m = pow(2, exp(2 * fabs(shape)));
return (shape < 0) ? 1 - pow(cos(x * PI2), m) : pow(sin(x * PI2), m);
}

Expand Down

0 comments on commit 7d9b746

Please sign in to comment.