# Parquet float column values 0.1 + 0.2 != 0.3 after round-trip due to floating-point rounding in schema

- **ID:** `data/parquet-float-precision-loss-rounding`
- **Domain:** data
- **Category:** type_error
- **Verification:** ai_generated
- **Fix Rate:** 75%

## Root Cause

Parquet uses FLOAT (32-bit) or DOUBLE (64-bit) types; when writing float values, binary representation causes precision loss, and reading back may introduce additional rounding errors in aggregation or comparison.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| PyArrow 12.0 | active | — | — |
| Spark 3.4 | active | — | — |
| Parquet 2.0 | active | — | — |

## Workarounds

1. **Use DOUBLE instead of FLOAT for high-precision columns: pd.read_parquet('file.parquet', dtype_backend='pyarrow') and cast to float64.** (80% success)
   ```
   Use DOUBLE instead of FLOAT for high-precision columns: pd.read_parquet('file.parquet', dtype_backend='pyarrow') and cast to float64.
   ```
2. **Apply a tolerance when comparing float values: if abs(a - b) < 1e-9: treat as equal.** (90% success)
   ```
   Apply a tolerance when comparing float values: if abs(a - b) < 1e-9: treat as equal.
   ```

## Dead Ends

- **Using Decimal type in Parquet schema to store all floats** — Decimal type can reduce precision loss but introduces performance overhead and may not be supported by all readers. (60% fail)
- **Rounding values to a fixed number of decimal places before writing** — Rounding can mask the issue but does not eliminate floating-point errors; comparisons still fail for edge cases. (70% fail)
