File tree Expand file tree Collapse file tree 1 file changed +2
-17
lines changed
Expand file tree Collapse file tree 1 file changed +2
-17
lines changed Original file line number Diff line number Diff line change @@ -195,14 +195,7 @@ namespace fun {
195195 * @return false
196196 */
197197 constexpr auto operator ==(const Z& other) const -> bool {
198- if (this ->_den == Z (1 ) || other == Z (0 )) {
199- return this ->_num == other;
200- }
201- auto lhs{*this };
202- auto rhs{other};
203- std::swap (lhs._den , rhs);
204- lhs.normalize2 ();
205- return lhs._num == lhs._den * rhs;
198+ return this ->_den == Z (1 ) && this ->_num == other;
206199 }
207200
208201 /* *
@@ -264,15 +257,7 @@ namespace fun {
264257 * @return false
265258 */
266259 constexpr auto operator ==(const Fraction& other) const -> bool {
267- if (this ->_den == other._den ) {
268- return this ->_num == other._num ;
269- }
270- auto lhs{*this };
271- auto rhs{other};
272- std::swap (lhs._den , rhs._num );
273- lhs.normalize2 ();
274- rhs.normalize2 ();
275- return lhs._num * rhs._den == lhs._den * rhs._num ;
260+ return this ->_num == other._num && this ->_den == other._den ;
276261 }
277262
278263 /* *
You can’t perform that action at this time.
0 commit comments