[PATCH v12 2/3] cmdline: add floating point support

Burakov, Anatoly anatoly.burakov at intel.com
Fri Feb 27 12:00:53 CET 2026


On 2/26/2026 7:19 PM, Stephen Hemminger wrote:
> On Thu, 26 Feb 2026 16:44:49 +0000
> Anatoly Burakov <anatoly.burakov at intel.com> wrote:
> 
>> +	if (type == RTE_FLOAT_SINGLE)
>> +		dres = (double)strtof(srcbuf, &end);
>> +	else if (type == RTE_FLOAT_DOUBLE)
>> +		dres = strtod(srcbuf, &end);
>> +	else
>> +		return -1;
>> +
> 
> You could use strtod for both.
> The conversion from double to float could happen in caller.

I did have that previously, but parsing a float as double then 
converting it to float yields slightly different result than parsing it 
as a float directly. Unit tests expose the difference.

-- 
Thanks,
Anatoly


More information about the dev mailing list