Notices
Results 1 to 5 of 5

Thread: Maximum of two values

  1. #1 Maximum of two values 
    New Member
    Join Date
    Dec 2009
    Posts
    1
    I know this is probably a pretty stupid question, but I'm a programmer and I'm trying to describe a function which does a math calculation in a mathematical format. Stripped of all but the relevant portion, this is what I'm trying to describe:

    Code:
    if (x-y) < 0 then 0 else (x-y)
    Is there a mathematical symbol or set of symbols used to represent that? Thanks and sorry for bothering you with such a simple question. (I don't know how to phrase this as a good Google search)


    Reply With Quote  
     

  2.  
     

  3. #2  
    Forum Freshman
    Join Date
    Jan 2010
    Posts
    12
    yes..it's math symbol..


    Reply With Quote  
     

  4. #3 Re: Maximum of two values 
    Suspended
    Join Date
    Oct 2009
    Posts
    92
    Quote Originally Posted by VentureFree
    I know this is probably a pretty stupid question, but I'm a programmer and I'm trying to describe a function which does a math calculation in a mathematical format. Stripped of all but the relevant portion, this is what I'm trying to describe:

    Code:
    if (x-y) < 0 then 0 else (x-y)
    Is there a mathematical symbol or set of symbols used to represent that? Thanks and sorry for bothering you with such a simple question. (I don't know how to phrase this as a good Google search)
    That's not really clear what happening there

    Code:
    if (x-y) < 0 then z= 0 else z=(x-y)
    Would make more sense.

    There is a special function in C to do that in a shorthand notation.
    Code:
    z = (x > y) ? 0 : (x-y);
    Reply With Quote  
     

  5. #4  
    Forum Professor river_rat's Avatar
    Join Date
    Jun 2006
    Location
    South Africa
    Posts
    1,517
    Else just try max(x-y, 0)

    The standard notation is
    As is often the case with technical subjects we are presented with an unfortunate choice: an explanation that is accurate but incomprehensible, or comprehensible but wrong.
    Reply With Quote  
     

  6. #5  
    Forum Freshman
    Join Date
    Oct 2008
    Posts
    11
    smokey's method is the way I prefer to do it. But if you're set on a mathematical function try:

    Reply With Quote  
     

Bookmarks
Bookmarks
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •