Skip to content

conversion from NaN to integer (invalid operation) #34

Closed
@mlubin

Description

This line:
https://github.com/oxfordcontrol/osqp/blob/2aeaebb3a3f8f718e16373caccb0c5a8e091a004/src/osqp.c#L343
will attempt to convert NaN to a c_int in the case that work->settings->check_termination equals zero, which is a valid value according to:
https://github.com/oxfordcontrol/osqp/blob/2aeaebb3a3f8f718e16373caccb0c5a8e091a004/include/types.h#L167

This conversion from NaN to integer is required to trigger an invalid operation exception according to the IEEE 754-2008 standard. On most systems this is silently ignored, but on others, under certain compiler settings, this causes the program to crash.

I was able to work around the issue by wrapping the offending line with if (work->settings->check_termination > 0) {}, but I don't understand the context of the code to know if this is correct.

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions