Skip to content

Commit 7e78aca

Browse files
fixup! feat(const_eval): impl. fract
1 parent 057f41f commit 7e78aca

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

naga/src/proc/constant_evaluator.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -955,7 +955,11 @@ impl<'a> ConstantEvaluator<'a> {
955955
})
956956
}
957957
crate::MathFunction::Fract => {
958-
component_wise_float!(self, span, [arg], |e| { Ok([e.fract()]) })
958+
component_wise_float!(self, span, [arg], |e| {
959+
// N.B., Rust's definition of `fract` is `e - e.trunc()`, so we can't use that
960+
// here.
961+
Ok([e - e.floor()])
962+
})
959963
}
960964
crate::MathFunction::Trunc => {
961965
component_wise_float!(self, span, [arg], |e| { Ok([e.trunc()]) })

0 commit comments

Comments
 (0)