Skip to content

Commit

Permalink
adding three_sum2 version of three_sum
Browse files Browse the repository at this point in the history
  • Loading branch information
Ravenwater committed Aug 13, 2024
1 parent b4aa6df commit db552b7
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions include/universal/native/error_free_ops.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,9 @@ namespace sw { namespace universal {
/// <summary>
/// three_sum computes the relationship a + b + c = s + r
/// </summary>
/// <param name="a">input</param>
/// <param name="b">input</param>
/// <param name="c">input value, output residual</param>
/// <param name="a">input, output sum</param>
/// <param name="b">input, output residual</param>
/// <param name="c">input value</param>
inline void three_sum(volatile double& a, volatile double& b, volatile double& c) {
volatile double t1, t2, t3;

Expand All @@ -126,6 +126,19 @@ namespace sw { namespace universal {
b = two_sum(t2, t3, c);
}

/// <summary>
/// three_sum2 computes the relationship a + b + c = s + r
/// </summary>
/// <param name="a">input, output sum</param>
/// <param name="b">input, output residual</param>
/// <param name="c">input</param>
inline void three_sum2(volatile double& a, volatile double& b, volatile double& c) {
double t1, t2, t3;
t1 = two_sum(a, b, t2);
a = two_sum(c, t1, t3);
b = t2 + t3;
}


// Split

Expand Down

0 comments on commit db552b7

Please sign in to comment.