diff --git a/source/blender/blenlib/intern/noise.cc b/source/blender/blenlib/intern/noise.cc
index 65a6f102a7bd01c305d690a01e810908da939315..3dd6863cb60ea83f9961424d46f3cff4ca60dd11 100644
--- a/source/blender/blenlib/intern/noise.cc
+++ b/source/blender/blenlib/intern/noise.cc
@@ -379,8 +379,9 @@ BLI_INLINE float noise_grad(uint32_t hash, float x, float y, float z, float w)
 
 BLI_INLINE float floor_fraction(float x, int &i)
 {
-  i = int(x) - ((x < 0) ? 1 : 0);
-  return x - i;
+  float x_floor = math::floor(x);
+  i = int(x_floor);
+  return x - x_floor;
 }
 
 BLI_INLINE float perlin_noise(float position)