Skip to content

Commit e7f05b7

Browse files
committed
Reenable fma
1 parent 4578701 commit e7f05b7

File tree

2 files changed

+24
-4
lines changed

2 files changed

+24
-4
lines changed

include/boost/units/cmath.hpp

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,6 @@ fdim BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit,Y>& q1,
231231
return quantity_type::from_value(fdim BOOST_PREVENT_MACRO_SUBSTITUTION (q1.value(),q2.value()));
232232
}
233233

234-
#if 0
235234

236235
template<class Unit1,class Unit2,class Unit3,class Y>
237236
inline
@@ -256,7 +255,30 @@ fma BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit1,Y>& q1,
256255
return quantity_type::from_value(fma BOOST_PREVENT_MACRO_SUBSTITUTION (q1.value(),q2.value(),q3.value()));
257256
}
258257

259-
#endif
258+
template<class Unit, class Y>
259+
inline
260+
BOOST_CONSTEXPR
261+
quantity<Unit,Y>
262+
fma BOOST_PREVENT_MACRO_SUBSTITUTION (const Y& q1,
263+
const quantity<Unit,Y>& q2,
264+
const quantity<Unit,Y>& q3)
265+
{
266+
using std::fma;
267+
return quantity<Unit,Y>::from_value(fma(q1,q2.value(),q3.value()));
268+
}
269+
270+
template<class Unit, class Y>
271+
inline
272+
BOOST_CONSTEXPR
273+
quantity<Unit,Y>
274+
fma BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit, Y>& q1,
275+
const Y& q2,
276+
const quantity<Unit,Y>& q3)
277+
{
278+
using std::fma;
279+
return quantity<Unit,Y>::from_value(fma(q1.value(),q2,q3.value()));
280+
}
281+
260282

261283
template<class Unit,class Y>
262284
inline

test/test_cmath.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,7 @@ int main()
107107
BOOST_CONSTEXPR_OR_CONST bu::quantity<bu::area> A1(4.0*bu::square_meters),
108108
A2(L1*L2+A1);
109109

110-
#if 0
111110
BOOST_TEST((bu::fma)(L1,L2,A1) == A2);
112-
#endif
113111

114112
BOOST_TEST((bu::fmax)(E4,E5) == E5);
115113
BOOST_TEST((bu::fmin)(E4,E5) == E4);

0 commit comments

Comments
 (0)