Skip to content

Ugly zero on tick labels #31

@cchalmers

Description

@cchalmers

The majorTicksHelper function generates an ugly near zero number if zero is in the middle of the interval:

map floatShow $ linearMajorTicks 6 (-1, 1)
[-1.2,-0.9,-0.6,-0.3,1.110223e-16,0.3,0.6,0.9,1.2]

It looks like R deals with this by arbitrarily cutting off at 1e-14 (https://github.com/wch/r-source/blob/trunk/src/library/base/R/pretty.R#L35). I think doing integer arithmetic for the range and then converting back to Double is a better way. (which also means we can get rid of the hacky floatShow function.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions