[arrayfire] 228/408: Binary operations with floating point scalars default to single precision

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Mon Sep 21 19:12:03 UTC 2015


This is an automated email from the git hooks/post-receive script.

ghisvail-guest pushed a commit to branch debian/sid
in repository arrayfire.

commit 345c57974d96f665eb3c9adf7dbe8c0a9237cd8b
Author: Pavan Yalamanchili <pavan at arrayfire.com>
Date:   Tue Aug 11 12:04:58 2015 -0400

    Binary operations with floating point scalars default to single precision
    
    - When arrays are double precision, they keep using double precision
---
 src/api/cpp/array.cpp | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/api/cpp/array.cpp b/src/api/cpp/array.cpp
index 15fdfd2..5c86dd7 100644
--- a/src/api/cpp/array.cpp
+++ b/src/api/cpp/array.cpp
@@ -857,6 +857,12 @@ af::dtype implicit_dtype(af::dtype scalar_type, af::dtype array_type)
     if (array_type == f64 || array_type == c64 ||
         array_type == f32 || array_type == c32 ) return array_type;
 
+    // Default to single precision by default when multiplying with scalar
+    if ((scalar_type == f64 || scalar_type == c64) &&
+        (array_type  != f64 && array_type  != c64)) {
+        return f32;
+    }
+
     // Punt to C api for everything else
     return scalar_type;
 }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/arrayfire.git



More information about the debian-science-commits mailing list