Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there any processing logic related to NaN? #294

Open
zhaosonggo opened this issue Feb 15, 2022 · 1 comment
Open

Is there any processing logic related to NaN? #294

zhaosonggo opened this issue Feb 15, 2022 · 1 comment

Comments

@zhaosonggo
Copy link

No description provided.

@stig
Copy link
Collaborator

stig commented Feb 15, 2022

Yes. The writer detects NaNs and errors here:

} else if (isnan([number doubleValue])) {
self.error = @"NaN is not a valid number in JSON";
return NO;
}

For the parser there really is no special handling: there's no way to represent NaN in the JSON grammar, and this parser implements the grammar accurately. Loss of floating-point precision for big numbers is the only issue I am aware of.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants