summaryrefslogtreecommitdiffstats
path: root/eval
diff options
context:
space:
mode:
authorHåvard Pettersen <havardpe@oath.com>2020-06-12 13:58:31 +0000
committerHåvard Pettersen <havardpe@oath.com>2020-06-12 13:58:31 +0000
commit578afec2b3d31273d0717295107b76e1907c7141 (patch)
tree23a5bb533d80924dae3c5df24c4a261a1cc1e9c0 /eval
parentf4f2fa8f1596ff212e63f2b075c006986d6eb098 (diff)
even better Inv handling, and testing
Diffstat (limited to 'eval')
-rw-r--r--eval/src/tests/eval/inline_operation/inline_operation_test.cpp1
-rw-r--r--eval/src/vespa/eval/eval/inline_operation.h3
2 files changed, 2 insertions, 2 deletions
diff --git a/eval/src/tests/eval/inline_operation/inline_operation_test.cpp b/eval/src/tests/eval/inline_operation/inline_operation_test.cpp
index d43743d9f68..8895bd4bcbd 100644
--- a/eval/src/tests/eval/inline_operation/inline_operation_test.cpp
+++ b/eval/src/tests/eval/inline_operation/inline_operation_test.cpp
@@ -67,6 +67,7 @@ TEST(InlineOperationTest, op1_lambdas_are_recognized) {
EXPECT_EQ(as_op1("elu(a)"), &Elu::f);
//-------------------------------------------
EXPECT_EQ(as_op1("1/a"), &Inv::f);
+ EXPECT_EQ(as_op1("1.0/a"), &Inv::f);
}
TEST(InlineOperationTest, op1_lambdas_are_recognized_with_different_parameter_names) {
diff --git a/eval/src/vespa/eval/eval/inline_operation.h b/eval/src/vespa/eval/eval/inline_operation.h
index 1d3cb559b4a..fccf1874242 100644
--- a/eval/src/vespa/eval/eval/inline_operation.h
+++ b/eval/src/vespa/eval/eval/inline_operation.h
@@ -23,8 +23,7 @@ template <> struct InlineOp1<Exp> {
};
template <> struct InlineOp1<Inv> {
InlineOp1(op1_t) {}
- template <typename A> constexpr auto operator()(A a) const { return (1.0/a); }
- constexpr auto operator()(float a) const { return (1.0f/a); }
+ template <typename A> constexpr auto operator()(A a) const { return (A{1}/a); }
};
template <> struct InlineOp1<Sqrt> {
InlineOp1(op1_t) {}