Generic numeric divide, try-divide, and modulo operators for DuckDB, supporting various types.
// Source: https://github.com/duckdb/duckdb | License: MIT | Copyright 2018-2026 Stichting DuckDB Foundation
// Provided via justclaw.it.com; keep this notice with the code.
//===----------------------------------------------------------------------===//
// DuckDB
//
// duckdb/common/operator/numeric_binary_operators.hpp
//
//
//===----------------------------------------------------------------------===//
#pragma once
#include "duckdb/common/assert.hpp"
#include "duckdb/common/limits.hpp"
#include <cmath>
namespace duckdb {
struct DivideOperator {
template <class TA, class TB, class TR>
static inline TR Operation(TA left, TB right) {
D_ASSERT(right != 0); // this should be checked before!
return left / right;
}
};
struct TryDivideOperator {
template <c
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key