A robot-support configuration review can select decimal.Decimal as a TOML parser's float converter and still receive ordinary Python integers. The converter has a specific input domain. Choosing it does not turn every numeric-looking value, every number, or the whole configuration into Decimal objects.
An original offline fixture makes that boundary visible with six invented settings. None is read from equipment, assigned a physical unit, or sent to a controller. The test examines parsing and downstream representation only. Its interpreter reports Python 3.14.7; the official Python reference pages displayed 3.14.10 when checked.
Keep the source spellings distinct
The synthetic document contains gain = 0.1, count = 3, offset = 3.0, exponent = 1e2, enabled = true, and serial = "3.0", each on its own line. These names are diagnostic labels rather than an application schema. In particular, the word gain does not identify a tested or recommended robot setting.
The source intentionally includes both three and three-point-zero, an exponent form without a decimal point, and quoted text that resembles a number. They allow the fixture to distinguish lexical value categories from a reader's impression of the value. Saving the original text avoids reconstructing those spellings from the parsed objects later.
Instrument the conversion hook
Define a callback that appends its string argument to a fresh list and then returns Decimal(argument). Pass that function as parse_float to tomllib.loads. The list records exactly three callback inputs in this run: '0.1', '3.0', and '1e2'.
The Python tomllib reference defines parse_float as the converter for each TOML float's string. Its conversion table separately maps integers to int, booleans to bool, and strings to str. The documented hook is therefore narrower than a whole-document numeric normalization pass. [Python tomllib reference](https://docs.python.org/3.14/library/tomllib.html).
Inspect values and types together
In the returned dictionary, gain, offset, and exponent are Decimal instances. Their string representations in the receipt are 0.1, 3.0, and 1E+2. The integer field count remains an int with value three. enabled remains a bool, and serial remains a str containing the text 3.0.
The absent callback inputs matter as much as the three recorded ones. There is no callback event for the integer count, the boolean, or the quoted string in this fixture. A report that lists only the final displayed values would omit that evidence about which source values actually passed through the requested conversion function.
Check the exponent case explicitly
The value 1e2 reaches the float converter despite containing no decimal point. It becomes Decimal('1E+2'), representing one hundred. Classifying source values by searching only for a dot would miss this observed path.
The TOML 1.0.0 specification defines a float using a fractional part, an exponent part, or both. It describes integers, strings, and booleans as separate value categories. This article uses that version because the checked tomllib reference identifies its parser as supporting TOML 1.0.0; it does not claim support for every newer syntax revision. [TOML 1.0.0 specification](https://toml.io/en/v1.0.0).
Equal numeric values can retain different types
For the parsed count and offset, the comparison offset == count is true in the local run. Yet their concrete types differ: offset is Decimal and count is int. Numeric equality alone therefore cannot establish that the conversion hook processed both fields or that the resulting dictionary has one uniform numeric type.
A separate control document contains only count = 3.0. Parsing that text with Decimal as the hook yields a Decimal for count. The field name has not changed, but the source spelling's value category has. This control connects the result to the token being parsed rather than attributing the original integer result to a special rule for a field named count.
Distinguish decimal text from a converted binary float
Parsing the original document with tomllib's default converter produces a Python float for gain. In the executed fixture, its exact integer ratio is 3602879701896397 divided by 36028797018963968. The Decimal-hook path instead produces Decimal('0.1'), whose stored coefficient is one and whose exponent is minus one.
Another check converts that already parsed default float with Decimal.from_float. Its result is not equal to Decimal('0.1'). The later conversion preserves the existing float's exact value; it does not recover the original decimal input by guessing how the source was written.
The Decimal reference distinguishes construction from strings and conversion from floats. Here, the recorded comparison concerns one deliberately chosen literal and its two parsing paths. It does not establish a measurement error, controller tolerance, preferred physical unit, or accuracy improvement in a robot. [Python Decimal reference](https://docs.python.org/3.14/library/decimal.html).
Test the next representation boundary
The fixture then passes the Decimal-containing dictionary to json.dumps with its default options. That call raises TypeError, reporting that a Decimal object is not JSON serializable. The failed serialization is retained as an actual result, rather than presented as a successful export merely because TOML parsing succeeded.
No replacement serializer is selected in this example. Encoding Decimal as a string, converting it to float, or defining an application-specific numeric representation would create different output contracts. A support tool must decide what its recipient expects before claiming that one conversion choice preserves all relevant information across formats.
Keep parsing separate from configuration validation
The six-field fixture has no required-field rules, bounds, unit checks, device compatibility checks, or update authorization. Successful parsing demonstrates a returned data structure for the supplied valid text. It does not establish that a configuration is suitable for any real system.
For a useful review receipt, retain the original text identity, parser version, hook inputs, resulting concrete types, selected value comparisons, and the next operation's result. Those observations explain exactly where conversion occurred and where a later consumer rejected the chosen representation.
Sources were checked November 19, 2026 UTC. All settings, callback observations, controls, and serialization results are original offline editorial work. The accompanying AI-generated illustration contrasts an integer token with a float token; it is not an equipment configuration screen or evidence of an approved parameter update.