-
Notifications
You must be signed in to change notification settings - Fork 171
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
Support Formal Front-End of Float Type Data #470
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
d462c96
Complete float literal and token part
Alexius-Huang 6cba315
Support PutFloat instruction
Alexius-Huang e1cbef0
Rescue test case for JSON parse in float format
Alexius-Huang a05cf14
Rescue some case for float type data
Alexius-Huang 10f8a0a
Fix errors and refactor the float expression parsing part
Alexius-Huang d151ecd
Fix the comment in expression.go
Alexius-Huang 19972aa
Rebase master
Alexius-Huang 3f86f8c
Merge branch 'master' into feature/issue-379-float-type-front-end
st0012 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,10 +2,10 @@ package vm | |
|
||
import ( | ||
"math" | ||
"strconv" | ||
|
||
"github.com/goby-lang/goby/vm/classes" | ||
"github.com/goby-lang/goby/vm/errors" | ||
"strconv" | ||
) | ||
|
||
// FloatObject represents an inexact real number using the native architecture's double-precision floating point | ||
|
@@ -438,7 +438,7 @@ func (f *FloatObject) numericComparison(t *thread, rightObject Object, operation | |
// toString returns the object's value as the string format, in non | ||
// exponential format (straight number, without exponent `E<exp>`). | ||
func (f *FloatObject) toString() string { | ||
return strconv.FormatFloat(f.value, 'f', -1, 64) | ||
return strconv.FormatFloat(f.value, 'f', -1, 64) // fmt.Sprintf("%f", f.value) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is the comment intended? |
||
} | ||
|
||
// toJSON just delegates to toString | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Based on this code, expresions with spaces on the sides of the dot will be parsed as floats (eg.
2 . 3
).If this is intended (other scripting languages forbid it), I think it should be documented with a test case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually currently Goby doesn't recognize white space, so it's not just float has this issue, like:
But this shouldn't be too hard to solve I think, already have a rough idea. But that won't be included in this PR.