Skip to content

Commit

Permalink
util: Fix copysign redefinition
Browse files Browse the repository at this point in the history
  • Loading branch information
jschueller committed Oct 25, 2024
1 parent 29211f4 commit a64f72c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/util/nlopt-util.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,13 @@
#endif

#ifndef HAVE_COPYSIGN
#if !defined(__cplusplus) && __STDC_VERSION__ < 199901
/* not quite right for y == -0, but good enough for us */
# define copysign(x, y) ((y) < 0 ? -fabs(x) : fabs(x))
#elif !defined(__cplusplus) && __STDC_VERSION__ < 199901
#else
extern double copysign(double x, double y); /* may not be declared in C89 */
#endif
#endif

#ifdef __cplusplus
extern "C" {
Expand Down

0 comments on commit a64f72c

Please sign in to comment.