diff --git a/src/f32/scalar/vec4a.rs b/src/f32/scalar/vec4a.rs index bf36ff90..3b526133 100644 --- a/src/f32/scalar/vec4a.rs +++ b/src/f32/scalar/vec4a.rs @@ -729,13 +729,27 @@ impl Vec4A { } } - /// Returns a vector containing the fractional part of the vector, e.g. `self - - /// self.floor()`. + /// Returns a vector containing the fractional part of the vector as `self - self.trunc()`. + /// + /// Note that this differs from the GLSL implementation of `fract` which returns + /// `self - self.floor()`. /// /// Note that this is fast but not precise for large numbers. #[inline] #[must_use] pub fn fract(self) -> Self { + self - self.trunc() + } + + /// Returns a vector containing the fractional part of the vector as `self - self.floor()`. + /// + /// Note that this differs from the Rust implementation of `fract` which returns + /// `self - self.trunc()`. + /// + /// Note that this is fast but not precise for large numbers. + #[inline] + #[must_use] + pub fn fract_gl(self) -> Self { self - self.floor() }