Skip to content

errors when you get close to our floating point cutoff #1320

Closed
@alexcjohnson

Description

@alexcjohnson

If you make this plot, the range gets corrupted and nothing shows:

var trace1 = {
  x: [1, 2, 3, 4, 5],
  y: [
    30.326883631078317,
    31.130257299167397,
    1.7976931348623157e+303,
    1.6976931348623157e+304, // 1.79... does not fail, just disappears
    1.7976931348623157e+308 // this one always disappears
  ],
  mode: 'markers',
  type: 'scatter'
};

var data = [trace1];

Plotly.newPlot('myDiv', data);

The cutoff comes from FP_SAFE: Number.MAX_VALUE / 10000 so this issue has several parts:

  • make sure that no input numbers can corrupt the range calculations (or anything else about the plot)
  • perhaps it would be better to clip out-of-range numbers, rather than discarding them? I'm imagining cases where some program generates Number.MAX_VALUE as some sort of error condition or infinity value.
  • see if we can increase FP_SAFE closer to Number.MAX_VALUE without breaking plotting or interactions (pay attention to log axes too in this whole thing)

cc @cldougl

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugsomething broken

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions