Commit 9056422b authored by GILLES Sebastien's avatar GILLES Sebastien
Browse files

Exercice 39 solution now compiles...

parent 68026796
...@@ -184,9 +184,9 @@ IntT operator*(const PowerOfTwoApprox<IntT>& approx, IntT coefficient) ...@@ -184,9 +184,9 @@ IntT operator*(const PowerOfTwoApprox<IntT>& approx, IntT coefficient)
bool is_overflow { false }; bool is_overflow { false };
// static_cast for the sake of `short` case: short + short -> int! // static_cast for the sake of `short` case: short + short -> int!
IntT ret = static_cast<IntT>(times_power_of_2<IntT>(is_overflow, IntT ret = static_cast<IntT>(times_power_of_2(is_overflow,
approx.Numerator() * coefficient, approx.Numerator() * coefficient,
-approx.Exponent())); -approx.Exponent()));
if (is_overflow) if (is_overflow)
{ {
...@@ -438,7 +438,6 @@ void TestDisplaySum<IntT>::Display(int Nbits, double value1, IntT coefficient1, ...@@ -438,7 +438,6 @@ void TestDisplaySum<IntT>::Display(int Nbits, double value1, IntT coefficient1,
// Ugly trick to circumvent the fact we can't add a new argument to operator* to get the value of `overflow` // Ugly trick to circumvent the fact we can't add a new argument to operator* to get the value of `overflow`
// boolean. Fortunately we'll see a bit later how to deal properly with this. // boolean. Fortunately we'll see a bit later how to deal properly with this.
bool is_overflow { false };
if (approx == std::numeric_limits<IntT>::max()) if (approx == std::numeric_limits<IntT>::max())
is_overflow = true; is_overflow = true;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment