Skip to content

Commit

Permalink
λ
Browse files Browse the repository at this point in the history
  • Loading branch information
eggrobin committed Dec 31, 2024
1 parent ea8a155 commit de2cba2
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions numerics/sin_cos.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,14 @@
}
}
// To analyse it near x = 5:
#define UNDER_OSACA_HYPOTHESES(statement) \
do { \
#define UNDER_OSACA_HYPOTHESES(expression) \
[] { \
constexpr double x = 5; \
/* To avoid inconsistent definitions, constexpr code can be used as */ \
/* needed. */ \
constexpr double abs_x = x > 0 ? x : -x; \
statement; \
} while (false)
return (expression); \
}()
#endif

#define OSACA_EVALUATE_CONDITIONS 1
Expand Down Expand Up @@ -137,7 +137,7 @@ static bool OSACA_loop_terminator = false;
#define OSACA_IF(condition) \
if constexpr (bool OSACA_CONDITION_QUALIFIER OSACA_computed_condition = \
(condition); \
[] { UNDER_OSACA_HYPOTHESES(return (condition)); }())
UNDER_OSACA_HYPOTHESES(condition))

#if OSACA_EVALUATE_CONDITIONS
#define OSACA_CONDITION_QUALIFIER volatile
Expand Down Expand Up @@ -171,8 +171,8 @@ static bool OSACA_loop_terminator = false;
#define OSACA_RETURN_COS(result) return (result)
#endif

#define UNDER_OSACA_HYPOTHESES(statement) \
do { \
#define UNDER_OSACA_HYPOTHESES(expression) \
[] { \
constexpr bool UseHardwareFMA = true; \
constexpr double θ = 0.1; \
/* From argument reduction. */ \
Expand All @@ -193,8 +193,8 @@ static bool OSACA_loop_terminator = false;
/* Not NaN is the only part that matters; used at the end of the */ \
/* top-level functions to determine whether to call the slow path. */ \
constexpr double value = 1; \
{ statement; } \
} while (false)
return expression; \
}()


namespace principia {
Expand Down

0 comments on commit de2cba2

Please sign in to comment.