Skip to content

Conversation

@sreeramsanjay
Copy link

@sreeramsanjay sreeramsanjay commented Aug 14, 2024

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

  • Add appropriate test(s) to the automatic suite
  • Use make pretty to reformat the code with black
  • Use make check to statically check the code using Pyre and Pylint
  • Send PR from a dedicated branch without unrelated edits
  • Ensure compatibility with this project's MIT license

@mlin
Copy link
Collaborator

mlin commented Mar 2, 2025

@sreeramsanjay Sorry for the very slow uptake on this!

  1. The serialization of a float to a string with six decimal places is required by the WDL spec (at least in a command placeholder). Are there other contexts where the serialization could be done differently consistent with the spec?
  2. Can you supply a test case where reading a float with an exponent isn't working? I think it should generally, but specific bugs/oversights are possible certainly.

@mlin mlin added the question Further information is requested label Mar 2, 2025
@sreeramsanjay
Copy link
Author

@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#

@mlin
Copy link
Collaborator

mlin commented Mar 19, 2025 via email

@sreeramsanjay
Copy link
Author

@mlin yes, I tried and it's the same error.

@mlin
Copy link
Collaborator

mlin commented Mar 23, 2025

@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 1.0e-30 instead of 1e-30 then it's recognized as expected.

Code options we'll consider:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

question Further information is requested

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants