Skip to content

Commit b042910

Browse files
committed
Make power a promoted real type
1 parent 24e59fd commit b042910

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

include/boost/math/distributions/logistic.hpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,8 @@ namespace boost { namespace math {
147147
return result;
148148
}
149149

150-
RealType power = (x - location) / scale;
150+
using promoted_real_type = typename policies::evaluation<RealType, Policy>::type;
151+
promoted_real_type power = (static_cast<promoted_real_type>(x) - static_cast<promoted_real_type>(location)) / static_cast<promoted_real_type>(scale);
151152
return logistic_sigmoid(power, Policy());
152153
}
153154

@@ -248,7 +249,9 @@ namespace boost { namespace math {
248249
{
249250
return result;
250251
}
251-
RealType power = (location - x) / scale;
252+
253+
using promoted_real_type = typename policies::evaluation<RealType, Policy>::type;
254+
promoted_real_type power = (static_cast<promoted_real_type>(location) - static_cast<promoted_real_type>(x)) / static_cast<promoted_real_type>(scale);
252255
return logistic_sigmoid(power, Policy());
253256
}
254257

0 commit comments

Comments
 (0)