CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com

# Thread: Maximum and minimum using mathematical formules.

1. Junior Member
Join Date
Sep 2017
Posts
2

## Maximum and minimum using mathematical formules.

Hey guys .. I need some help.. I need to find the maximum of two numbers using mathematical formules. I found two of them : ((a+b) + abs(a-b))/2; and int(a > b) * a + int(b > a) * b; .. Can you help me please with a third ? Thanks.

2. ## Re: Maximum and minimum using mathematical formules.

Why?

Consider

a ^ ((a ^ b) & -(a < b)) where ^ is xor

3. Member
Join Date
Feb 2017
Posts
509

## Re: Maximum and minimum using mathematical formules.

Originally Posted by aiwa
Can you help me please with a third ?

http://forums.codeguru.com/showthrea...60201-Question

If you don't understand the replies in a thread you've started please don't just abandon it. Instead engage in a discussion so you can clarify what you mean and those trying to help can clarify what they mean. That's how you learn at a forum.
Last edited by wolle; October 7th, 2017 at 09:59 AM.

#### Posting Permissions

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