bkietz commented on a change in pull request #7748:
URL: https://github.com/apache/arrow/pull/7748#discussion_r472240168



##########
File path: cpp/src/arrow/compute/kernels/scalar_arithmetic.cc
##########
@@ -186,6 +187,42 @@ struct MultiplyChecked {
   }
 };
 
+struct Divide {
+  template <typename T, typename Arg0, typename Arg1>
+  static constexpr enable_if_floating_point<T> Call(KernelContext*, Arg0 left,
+                                                    Arg1 right) {
+    return left / right;

Review comment:
       This is true, but division by zero can result in `SIGFPE` if 
[`feenableexcept()`](http://www.gnu.org/savannah-checkouts/gnu/libc/manual/html_node/Control-Functions.html)
 or a hardware exception if 
[`_control87()`](https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/control87-controlfp-control87-2)
 are used. For example:
   
   ```sh
   g++ -lm -xc++ - <<!
   #include <fenv.h>
   int main(int argc, char* argv[]) {
     feenableexcept(FE_ALL_EXCEPT);
     return static_cast<int>(1.0 / 0.0);
   }
   !
   ./a.out # abort
   ```
   
   These are rare, so maybe we don't need to support them (or at least restrict 
this check to the checked division kernel), but they do represent a potential 
crash when dividing by `0.0`. @pitrou ?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to