Skip to content

Commit 24e59fd

Browse files
committed
Remove double negatives and now excess using statements
1 parent 79ab23f commit 24e59fd

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

include/boost/math/distributions/logistic.hpp

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,8 @@ namespace boost { namespace math {
146146
{
147147
return result;
148148
}
149-
BOOST_MATH_STD_USING
150-
RealType power = -(location - x) / scale;
149+
150+
RealType power = (x - location) / scale;
151151
return logistic_sigmoid(power, Policy());
152152
}
153153

@@ -197,7 +197,6 @@ namespace boost { namespace math {
197197
template <class RealType, class Policy>
198198
BOOST_MATH_GPU_ENABLED inline RealType quantile(const logistic_distribution<RealType, Policy>& dist, const RealType& p)
199199
{
200-
BOOST_MATH_STD_USING
201200
RealType location = dist.location();
202201
RealType scale = dist.scale();
203202

@@ -220,13 +219,12 @@ namespace boost { namespace math {
220219
return policies::raise_overflow_error<RealType>(function,"probability argument is 1, must be >0 and <1",Policy());
221220
}
222221

223-
return location - scale * -logit(p, Policy());
222+
return location + scale * logit(p, Policy());
224223
} // RealType quantile(const logistic_distribution<RealType, Policy>& dist, const RealType& p)
225224

226225
template <class RealType, class Policy>
227226
BOOST_MATH_GPU_ENABLED inline RealType cdf(const complemented2_type<logistic_distribution<RealType, Policy>, RealType>& c)
228227
{
229-
BOOST_MATH_STD_USING
230228
RealType location = c.dist.location();
231229
RealType scale = c.dist.scale();
232230
RealType x = c.param;
@@ -250,7 +248,7 @@ namespace boost { namespace math {
250248
{
251249
return result;
252250
}
253-
RealType power = -(x - location) / scale;
251+
RealType power = (location - x) / scale;
254252
return logistic_sigmoid(power, Policy());
255253
}
256254

@@ -293,7 +291,6 @@ namespace boost { namespace math {
293291
template <class RealType, class Policy>
294292
BOOST_MATH_GPU_ENABLED inline RealType quantile(const complemented2_type<logistic_distribution<RealType, Policy>, RealType>& c)
295293
{
296-
BOOST_MATH_STD_USING
297294
RealType scale = c.dist.scale();
298295
RealType location = c.dist.location();
299296
constexpr auto function = "boost::math::quantile(const complement(logistic_distribution<%1%>&), %1%)";
@@ -316,7 +313,7 @@ namespace boost { namespace math {
316313
return policies::raise_overflow_error<RealType>(function,"probability argument is 0, but must be >0 and <1",Policy());
317314
}
318315

319-
return location + scale * -logit(q, Policy());
316+
return location - scale * logit(q, Policy());
320317
}
321318

322319
template <class RealType, class Policy>

0 commit comments

Comments
 (0)