Skip to content

define a clean and efficient way to handle floating point precision errors in the model #220

@AteZenmo

Description

@AteZenmo

In the model, a lot of places there are hard checks on negative values (sometimes positive as well). Sometimes due to floating point precision errors, these are breached by numbers like -1e-18. This is not an error in our model/code itself. Checks like these are mostly solved now by manual writing a check at that location like if(x < 0 && x > -0.0000001) x = 0; Often the amount of zeros varies at the different places it is used.
This not very clean, and it would be better if we created a default way to handle this, so it works the same everywhere. This should become a function or whatever in the J_GlobalParameters or something like that class in the engine, so it can be accessed everywhere in the model using J_GlobalParameters.precisionCheck(x) or something.

-> Find the best solution for this, and implement it in the model at all the seperate locations it is done now.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions