| 862 | } |
| 863 | |
| 864 | Value expr_binary_op(const std::vector<Value> &args, long double (*ldop)(long double, long double), int64_t (*iop)(int64_t, int64_t), bool long_only = false) { |
| 865 | try { |
| 866 | if (!long_only && !args[0].isDecimal() && !args[1].isDecimal()) { |
| 867 | return Value(iop(args[0].asSignedLong(), args[1].asSignedLong())); |
| 868 | } else { |
| 869 | return Value(ldop(args[0].asLongDouble(), args[1].asLongDouble())); |
| 870 | } |
| 871 | } catch (const std::exception &) { |
| 872 | return Value(); |
| 873 | } |
| 874 | } |
| 875 | |
| 876 | Value expr_plus(const std::vector<Value> &args) { |
| 877 | return expr_binary_op(args, [](long double a, long double b) {return a + b;}, [](int64_t a, int64_t b) {return a + b;}); |
no test coverage detected