ClickHouse supports IEEE 754 floating-point numbers in 32-bit and 64-bit precision.
64-bit double-precision floating point. This is the default for number in TypeScript and float in Python.
class SensorData(BaseModel): temperature: float # Float64 humidity: float # Float6432-bit single-precision floating point. Use when storage is critical and reduced precision is acceptable.
from typing import Annotatedfrom moose_lib import ClickhouseSize class Coordinates(BaseModel): latitude: Annotated[float, ClickhouseSize(4)] # Float32 longitude: Annotated[float, ClickhouseSize(4)] # Float32| ClickHouse Type | TypeScript Helper | TypeScript Verbose | Python |
|---|---|---|---|
Float32 | Float32 | number & tags.Type<"float"> |
Annotated[float, ClickhouseSize(4)]Float64 | Float64 or number | number | float |
Prefer Float64 for most calculations—it's the default and provides better precision. Only use Float32 when storage savings are critical and you can tolerate ~7 digits of precision instead of ~15.
Floating-point numbers have inherent precision limitations. For financial calculations or when exact decimal representation is required, use Decimal types instead.