fract function

double fract(
  1. double x
)

GLSL's fract: the part of x above its floor, in [0, 1) for negative x too.

Implementation

double fract(double x) => x - x.floor();