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
Priority:  5 - 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

Post a Comment

Add a New Comment Rich Markup
   

Discussion

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>

 

Attached Files

This item currently has no attached files.

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

Attach Files:
   
   
Comment:
   

 

Dependencies

This item does not depend on any other items.

No items depend on this one.

 

Mail Notification Carbon-Copy List

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

    Votes

    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.

     

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

    History

    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.16-2753.
    Corresponding source code