Skip to content

floating poind rounding error leads to assertion failure #302

Open
@hartmans

Description

On master commit ed1b2b2
I get a crash with an assertion failure at line 1112 in paragraph.py, the assertion failes calling container.advance2(descender)
The problem is that the container has just enough height left, but there's a floating point rounding error:

(Pdb) p float(container.remaining_height) + descender
-5.329070518200751e-15

I'd prefer not to share the source files, although we could talk about doing so privately if it's really necessary.
However, whenever there's a chance of a floating point comparison needing exact equality, you need to account for rounding error like the above.
I think the appropriate fix would either be in advance2 or in the equality operators of the dimension objects depending on how global of a fix you want.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugcrashrinohtype aborts due to an uncaught exception

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions