-
Notifications
You must be signed in to change notification settings - Fork 68
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
Fully featured support for float #3
Comments
Is this supported in the java implementation in Bazel? Fine to add, but something to keep in mind as a potential compatibility issue. |
Is anyone looking into this one? I was thinking about taking a stab at it. @ndmitchell I'm assuming we are looking into it being a proper double precision floating-point number (aka |
I don't think anyone is looking at it right now. Patch most welcome! Yep, plan would be |
Summary: ... to simplify implementation of [floats in starlark-rust](facebook/starlark-rust#3). Pull Request resolved: #3 Reviewed By: blackm00n Differential Revision: D30990124 Pulled By: ndmitchell fbshipit-source-id: c365e39f44eb86ce173d2b04247a98d848f689e3
Summary: ... to simplify implementation of [floats in starlark-rust](facebook/starlark-rust#3). Pull Request resolved: facebookincubator/gazebo#3 Reviewed By: blackm00n Differential Revision: D30990124 Pulled By: ndmitchell fbshipit-source-id: c365e39f44eb86ce173d2b04247a98d848f689e3
A quick update on how I'm going with this. The main implementation is done. Lexer, parser, Judging by
I'm going to continue working on the above. |
Thanks for the info - sounds great! Note that 100% conformance with float.star is not necessary, or sometimes even a good idea - we tend to aim for https://github.com/bazelbuild/starlark/blob/master/spec.md#contents, which is mostly but not 100% equivalent.
|
I've removed I've extracted With the above the missing bits are:
I think implementing these as a separate update is a good idea. I'll clean up the code a bit and prepare a pull request so we can discuss the actual implementation. |
Summary: Addresses: #3 Spec: https://github.com/bazelbuild/starlark/blob/689f54426951638ef5b7c41a14d8fc48e65c5f77/spec.md#floating-point-numbers Changes: - adds lexer support for float literal - adds `/` and `/=` operators for division - adds floats and division operators support to parser - adds `float` function - updates int arithmetic and comparisons to account for the other operand being float - implements `SimpleValue` for float (backed by `f64`) - adds `assert_lt` implementation (required for some conformance tests) - adds `float.star` from starlark-go (with some formatting for easier nonconformant line removal) Known issues: - `str` for floats doesn't conform to the spec - string interpolation is not implemented for floats Pull Request resolved: #34 Reviewed By: krallin Differential Revision: D31345070 Pulled By: ndmitchell fbshipit-source-id: 510b0533375265187db26534c1d4683a0f2cf49a
Summary: Addresses: #3 Spec: https://github.com/bazelbuild/starlark/blob/689f54426951638ef5b7c41a14d8fc48e65c5f77/spec.md#string-interpolation Changes: - adds `float::write_{decimal,scientific,compact}` functions for various kinds of string interpolation for floats - makes `Display for StarlarkFloat` use `write_compact` (as per spec) - makes string interpolation use `write_*` functions Pull Request resolved: #39 Reviewed By: krallin Differential Revision: D31645493 Pulled By: ndmitchell fbshipit-source-id: d47272d4bf301085544acfcfbaf17f1c2577f692
@ndmitchell is there anything left here or should we close this issue? |
Closed - thanks a lot! |
From the spec:
We don't yet support floating point numbers.
The text was updated successfully, but these errors were encountered: