PR #123862
tensorflow/tensorflow · Core Math · Open · 3 files changed
tf.math.floordiv returned erroneous finite values when dividing by negative infinity (-inf) due to a missing IEEE 754 boundary guard in the C++ Eigen kernel.
Checkout Pull Request
Inspect the full commit history and diff locally from upstream tensorflow/tensorflow.
$gh pr checkout 123862 --repo tensorflow/tensorflowtf.math.floordiv returned erroneous finite values when dividing by negative infinity (-inf) due to a missing IEEE 754 boundary guard in the C++ Eigen kernel.
File-by-File Modification Breakdown (3)
- +37 / -5
tensorflow/core/kernels/cwise_ops.h
Core C++ Eigen kernel implementation and boundary guards
- +115 / -8
tensorflow/core/kernels/mlir_generated/op_definitions/floor_div_float.mlir.tmpl
Core C++ Eigen kernel implementation and boundary guards
- +40 / -0
tensorflow/python/kernel_tests/math_ops/cwise_ops_binary_test.py
Python/XLA regression test suite verifying edge-case behavior
Changed Files (3)
1. Introduction & Motivation
Floor division is pervasive in indexing, quantization, and bucketization pipelines. When dividing finite values by , IEEE 754 floating-point rules dictate signed-zero or domain-consistent results, yet TensorFlow's C++ FloorDiv functor lacked an explicit check and produced spurious finite integers [1].
2. Mathematical & IEEE 754 Formulation
For any finite and divisor :
3. References
- IEEE Computer Society, IEEE Std 754-2019: Standard for Floating-Point Arithmetic, Section 6.1 (Infinity Arithmetic).