Skip to content

XPath: Empty string should be NaN, not zero #2256

@koalo

Description

@koalo

In my understanding of '4.4 Number functions' of XML Path Language (XPath) Version 1.0:

a string that consists of optional whitespace followed by an optional minus sign followed
by a Number followed by whitespace is converted to the IEEE 754 number that is nearest
(according to the IEEE 754 round-to-nearest rule) to the mathematical value represented
by the string; any other string is converted to NaN

I would expect that an empty string is converted to NaN.

Currently, libyang converts it into 0 (see

num = strtold(str, &ptr);
which uses strtold that returns 0 without error for an empty string).

Do you agree or do I read the standard wrong again (as in #2140 that is remotely related)?

Metadata

Metadata

Assignees

No one assigned

    Labels

    is:bugBug description.status:completedFrom the developer perspective, the issue was solved (bug fixed, question answered,...)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions