11 · Boundaries and floating-point precision
Exact endpoints, zero-width intervals, very narrow intervals, and one-micro-unit overflows verify clipping decisions at numerical boundaries.
Run the example
from forestploter import read_forest_data
from forestploter.gallery_cases import plot_boundary_precision
df = read_forest_data("11_boundary_precision.xlsx", sheet_name="Forest")
result = plot_boundary_precision(df)
result.save("11_boundary_precision.png", dpi=300)
Plot function used by the gallery and tests
def plot_boundary_precision(df: ForestInput) -> ForestPlotResult:
"""Plot case 11: exact boundaries and floating-point precision."""
columns = (
ForestColumn("scenario", "Numerical scenario", "text", 2.6),
ForestColumn("position", "Expected position", "text", 1.2),
ForestColumn("interval_display", "Estimate [95% CI]", "numeric", 2.2, "right"),
ForestColumn("ci", "High-precision axis", "ci", 3.5, "center"),
)
return forest(
df,
columns=columns,
ref_line=0.0,
ideal_line=0.333333,
xlim=(-1.0, 1.0),
ticks_at=(-1.0, -0.333333, 0.0, 0.333333, 1.0),
arrow_lab=("Lower", "Higher"),
title="Exact limits, zero-width intervals, and floating-point precision",
figure_width=12.5,
)