aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Kummerlaender2019-10-27 22:09:27 +0100
committerAdrian Kummerlaender2019-10-27 22:09:27 +0100
commit1b9ac6e7aee3cf63495a65c2d7dbf79a0be23d7d (patch)
tree85240a8479771f6f0b45136f1d99e0e19ea3cfbb
parent89f60f39a226bef5ccd8c52dbd57891c3a4d74c7 (diff)
downloadboltzgen-1b9ac6e7aee3cf63495a65c2d7dbf79a0be23d7d.tar
boltzgen-1b9ac6e7aee3cf63495a65c2d7dbf79a0be23d7d.tar.gz
boltzgen-1b9ac6e7aee3cf63495a65c2d7dbf79a0be23d7d.tar.bz2
boltzgen-1b9ac6e7aee3cf63495a65c2d7dbf79a0be23d7d.tar.lz
boltzgen-1b9ac6e7aee3cf63495a65c2d7dbf79a0be23d7d.tar.xz
boltzgen-1b9ac6e7aee3cf63495a65c2d7dbf79a0be23d7d.tar.zst
boltzgen-1b9ac6e7aee3cf63495a65c2d7dbf79a0be23d7d.zip
Verify precision parameter
-rw-r--r--boltzgen/kernel/target/precision.py17
1 files changed, 9 insertions, 8 deletions
diff --git a/boltzgen/kernel/target/precision.py b/boltzgen/kernel/target/precision.py
index 45f84cf..d22e922 100644
--- a/boltzgen/kernel/target/precision.py
+++ b/boltzgen/kernel/target/precision.py
@@ -1,15 +1,16 @@
-class cpp:
+class common:
@classmethod
def get_float_type(self, precision):
- return {
- 'single': 'float',
- 'double': 'double'
- }.get(precision)
+ if precision not in ['single', 'double']:
+ raise Exception("Precision must be either 'single' or 'double'")
-class cl:
- @classmethod
- def get_float_type(self, precision):
return {
'single': 'float',
'double': 'double'
}.get(precision)
+
+class cpp(common):
+ pass
+
+class cl(common):
+ pass