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

Added blocks to prevent automatic scientific notation or infinity con… #48

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

esophagoose
Copy link

I noticed a bug in where this: (tedit 5E888720) parsed to [Symbol("tedit"), inf]

This is because the parser tries to convert to a float and there's many expressions that are valid for the constructor of the Python float. It was determining "5E888720" as 5*e^888720. This PR blocks the float conversions that aren't part of the S-expression spec. According to Wikipedia, valid s-expression datatypes are:

Lists and pairs: (1 () (2 . 3) (4))
Symbols: with-hyphen ?@!$ |a symbol with spaces|
Strings: "Hello, world!"
Integers: -9876543210
Floating-point numbers: -0.0 6.28318 6.022e23

I also added unit tests

@jd-boyd
Copy link
Owner

jd-boyd commented Nov 30, 2023

Since you reference Wikipedia, could you please add a link to the referenced page in a comment.

Also, would you mind adding test cases for the wikipedia float examples used: -0.0 6.28318 6.022e23

I that that you will find the last one doesn't work with your approach to fixing this and it probably should.

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

Successfully merging this pull request may close these issues.

2 participants