Home » Developing U++ » U++ TheIDE and Library: Releases and ChangeLogs » Quiz: What is wrong with this code?
Re: Quiz: What is wrong with this code? [message #3953 is a reply to message #3951] |
Tue, 11 July 2006 09:15   |
|
luzr wrote on Mon, 10 July 2006 17:16 |
struct Rect_ {
.....
Pt CenterPoint() const { return Pt((left + right) / 2, (top + bottom) / 2); }
.....
};
...should compute the central point of Rect...
(...fixed).
Mirek
|
Interesting.. looks fine to me..
Normaly computation of center point looks like:
top + (bottom - top) / 2
but it evaluates to:
top + bottom / 2 - top / 2 =
top / 2 + bottom /2 =
(top + bottom) / 2
Is that bug related to const modifier??
|
|
|
Goto Forum:
Current Time: Thu Jun 26 11:36:46 CEST 2025
Total time taken to generate the page: 0.04427 seconds
|