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

 
 

bug #9808: mid function implementation might be wrong

Submitted by:  Adrien Cordonnier <adrien>
Submitted on:  Thu 29 Jul 2004 05:31:05 AM UTC  
 
Category: Game EngineSeverity: 3 - Normal
Item Group: Incorrect BehaviourStatus: Wont Fix
Privacy: PublicAssigned to: None
Open/Closed: ClosedRelease: 0.6.0
Operating System: AllPlanned Release: 0.6.0

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

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 File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 2 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Fri 10 Aug 2007 03:46:23 AM UTCgrumbelStatusNone=>Wont Fix
      Open/ClosedOpen=>Closed

    Back to the top


    Powered by Savane 3.1-cleanup1