-
Notifications
You must be signed in to change notification settings - Fork 63
Added support for float input in scientific notation and removed float rounding. #711
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
base: main
Are you sure you want to change the base?
Conversation
|
@sreeramsanjay Sorry for the very slow uptake on this!
|
|
@mlin A float with an exponent is throwing an error with the JSON input file. The same is working when passing it as an argument but not with the JSON file(-i). |
|
@sreeramsanjay did you try making your input JSON
```json
{
"floatToPrint": 1e-30
}
```
(without quotes around the number literal)
…On Tue, Mar 18, 2025 at 4:18 PM ssram ***@***.***> wrote:
@mlin <https://github.com/mlin> A float with an exponent is throwing an
error with the JSON input file. The same is working when passing it as an
argument but not with the JSON file(-i).
$ miniwdl run float-test.wdl -i float-input.json
check JSON input; couldn't construct Float? from "1e-30" (in floatToPrint)
refer: https://github.com/sreeramsanjay/wdl/tree/main#
—
Reply to this email directly, view it on GitHub
<#711 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AACXBRXU4YKICIOW63J7E232VDHXNAVCNFSM6AAAAABMQ5EZ2KVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDOMZVGE2TENZQGA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
[image: sreeramsanjay]*sreeramsanjay* left a comment
(chanzuckerberg/miniwdl#711)
<#711 (comment)>
@mlin <https://github.com/mlin> A float with an exponent is throwing an
error with the JSON input file. The same is working when passing it as an
argument but not with the JSON file(-i).
$ miniwdl run float-test.wdl -i float-input.json
check JSON input; couldn't construct Float? from "1e-30" (in floatToPrint)
refer: https://github.com/sreeramsanjay/wdl/tree/main#
—
Reply to this email directly, view it on GitHub
<#711 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AACXBRXU4YKICIOW63J7E232VDHXNAVCNFSM6AAAAABMQ5EZ2KVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDOMZVGE2TENZQGA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
|
@mlin yes, I tried and it's the same error. |
|
@sreeramsanjay Thanks, I tracked that down to a longstanding quirk in PyYAML (which miniwdl uses to read the input file, JSON in theory being a subset of YAML): yaml/pyyaml#173 . As a workaround, if you write Code options we'll consider:
|
Motivation
There is no support for floating-point inputs with scientific notation in the current implementation of miniWDL. Float values are rounded to 6 decimal points only; for example, floats smaller than 0.000001 are rounded to 0.0. Adding support for float input in scientific notation and removing float rounding using repr method to keep the input float value as is.
NOTE: floats smaller than 0.0001 will be return in scientific notations.
Approach
...
Checklist
make prettyto reformat the code with blackmake checkto statically check the code using Pyre and Pylint