bugPingus - Bugs: bug #9808, mid function implementation might...

 
 

bug #9808: mid function implementation might be wrong

Submitter:  Adrien Cordonnier <adrien>
Submitted:  Thu 29 Jul 2004 05:31:05 AM UTC
   
 
Category:  Game Engine Severity:  3 - Normal
Item Group:  Incorrect Behaviour Status:  Wont Fix
Privacy:  Public Assigned to:  None
Open/Closed:  Closed Release:  0.6.0
Operating System:  All Planned Release:  0.6.0
* Mandatory Fields

Add a New Comment Rich Markup
   

Thu 29 Jul 2004 05:31:05 AM UTC, original submission:  

In math.hxx, I think the mid() function might return the middle value among the three args but 1/3 of the case it doesn't (a>b>c & a>c>b).

template<class T>
T mid (const T& a, const T& b, const T& c)
{
  return max((a), min((b), (c)));
}

might be replaced by :

template<class T>
T mid (const T& a, const T& b, const T& c)
{
  return min(max(min(a, b), c), max(min(a, c), b));
}

Adrien Cordonnier <adrien>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by grumbel (Updated the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2007-08-10 grumbel StatusNone Wont Fix
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-4b48.
    Corresponding source code