Skip to content

Floating point precision #8

Description

@nagarabh

Hi Samuele,

Was using your code for experiments and found a failing case. Thought I should let you know.

In the shot.h file you have used these floating point defines
#define DEG_45_TO_RAD 0.78539816339744830961566084581988f
#define DEG_90_TO_RAD 1.5707963267948966192313216916398f
#define DEG_135_TO_RAD 2.3561944901923449288469825374596f
#define DEG_168_TO_RAD 2.7488935718910690836548129603696f

but in the function SHOTDescriptor::interpolateSingleChannel in shot.cpp you use 1e-30 as the width of imprecise region at e.g. line 705. This causes an error for inclination values close to pi/2 degree and cause the assertion on 724 to be falsified.

See https://en.wikipedia.org/wiki/IEEE_754#/media/File:IEEE754.svg for relation between floating point values and their precision. In the given case the imprecise should be about 1e-6 or use double precision constants and imprecise region of 1e-15.

Best regards,
Abhishek

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