Skip to content

cwltool truncates float and double inputs to 0 (zero) when they're smaller than 0.000001 (1e-06) #2104

Open
@sebitz

Description

@sebitz

test_tool.cwl:

class: CommandLineTool
inputs:
  float:
    type: float
    default: 1e-6
    inputBinding:
      position: 1
  double:
    type: double
    default: 9.999e-7
    inputBinding:
      position: 2
outputs:
  numbers: stdout
baseCommand: [ printf, '%s\n' ]
stdout: my_numbers.txt

Running cwltool --disable-color --debug test_tool.cwl >test_tool.out.json 2>test_tool.err.txt produces my_numbers.txt. However, it contains:

0.000001
0

Whereas I expected it to look like this:

1e-06
9.999e-07

The results are the same regardless of whether numbers are in scientific or decimal notation, I use type: float or type: double in the CommandLineTool, or whether I pass inputs in a json or yaml file. Curiously enough, it seems to behave correctly if I pass the numbers on the command line, e.g., cwltool test_tool.cwl --float 1e-6 --double 9.999e-7 or ...--float 0.000006 --double 0.0000009999 gives

1e-06
9.999e-07

From test_tool.err.txt I can see that the command line bindings are correct (i.e., datum: 9.999e-07 and datum: 1e-06). However, the command line that was executed is printf %s\n 0.000001 0 instead of printf %s\n 0.000001 0.0000009999.

This happens both with cwltool version 3.1.20241217163858 (see test_tool.err.txt) and 3.1.20250110105449 (latest at the time of writing).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions