step-examples/12-13-writer-pathology/Wr006.stp
Sources
- OCCT forum "coordinate 1.5 became 1.4999999999998"
- bug-reporter language: "round-trip lost precision"
Sender
Writers that store coordinates in single-precision (float32) internally but emit double-precision strings, or use printf("%.15g") on values that were 1.5 represented as 1.4999999999998 due to prior arithmetic
Description
Coordinates that were entered as exact rationals or simple decimals (1.0, 1.5, 0.25) appear in the emitted file as nearly-but-not-exactly the original (1.4999999999998, 0.25000000000004). The defect is invisible per-value but accumulates across round-trips: a vertex stamped from STEP→kernel→STEP→kernel drifts microns per cycle. Bug-reporter language: "coordinate 1.5 became 1.4999999999998 after re-export", "precision lost on round-trip", "model creeps after every save".
Reproducer recipe
a CARTESIAN_POINT with coordinates `(1.4999999999998,2.5000000000003,0.99999999999996)` claiming to represent `(1.5, 2.5, 1.0)`.
Expected kernel behavior
Heal and accept: normalize internal storage to sufficient precision to preserve the input on round-trip within the spec's REAL precision; coerce emit to the smallest representation that recovers the internal value exactly.
Notes
Discoverable only by comparing pre- and post-round-trip files; the file as observed is plausible.
Expected validation
occt=empty/empty gmsh=empty ifc=schema_n/a
Byte assertions
matches(rb'\d\.\d{12,}')matches(rb'\.999999')
Tier-3 assertions
load == "ok"
Live oracle output
No live oracle data — run _run_corpus to populate.
Fixture content
Show fixture bytes (with defect highlighting)
1ISO-10303-21; 2/* Wr006: floating-point precision degradation â near-integer coordinates */ 3HEADER; 4FILE_DESCRIPTION(('Wr006 - floating-point precision degradation on round-trip'),'2;1'); 5FILE_NAME('Wr006.stp','2026-06-20T00:00:00',('auto-generated'),(''), 6 'auto-generated','',''); 7FILE_SCHEMA(('AUTOMOTIVE_DESIGN { 1 0 10303 214 3 1 1 }')); 8ENDSEC; 9DATA; 10/* Defect: coordinates are slightly off their intended exact values */ 11/* Intended (1.5, 2.5, 1.0) but emitted with float32 round-trip drift */ 12#1=CARTESIAN_POINT('drifted-pt',(1.4999999999998,2.5000000000003,0.99999999999996)); 13/* Additional near-zero coordinate to show the pattern */ 14#2=CARTESIAN_POINT('near-zero',(0.00000000000002,0.49999999999998,0.25000000000004)); 15#3=GEOMETRIC_CURVE_SET('precision-degraded',(#1,#2)); 16ENDSEC; 17END-ISO-10303-21;