C Programming / conditional op. (math) Question... - Honda Motorcycles - FireBlades.org
Off-Topic Discussion of anything that doesn't fit anywhere else. If it's related to motorcycles in any way, DO NOT post it here. Post it in General Discussion or a more specific forum.

User Tag List

 
LinkBack Thread Tools
post #1 of 11 Old 11-22-2004, 5:05 PM Thread Starter
Supporting Member
 
SomeStrangeGuy's Avatar
 
Join Date: 05-23-2001
Location: Around here.
Posts: 4,302
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Quoted: 0 Post(s)
Reputation Power: 34
                 
C Programming / conditional op. (math) Question...

This question is on an exam I currently posess, except nowhere in the lecture notes or book (or web) can I find anything useful.

I'm not looking for the answer, but the necessary information to find my way there.


Quote:
Originally Posted by Question:
The mathematical operation min(x,y) can be represented by the conditional
expression

(x < y) ? x : y

In similar fashion, using only conditional expressions, describe the
mathematical operations:

min(x, y, z) and max(x,y,z,w)
If anyone has anything or relevant links, notes, etc. - I'd be very appreciative.

I'm sure someone out there is looking at this and laughing right now. I should be too...but a serious lack of sleep is causing simple tasks to get quite complex .


Thanks in advance..
SomeStrangeGuy is offline  
Sponsored Links
Advertisement
 
post #2 of 11 Old 11-22-2004, 5:41 PM
 
sheepofblue's Avatar
 
Join Date: 07-13-2004
Location: Huntsville AL
Posts: 14,224
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Quoted: 0 Post(s)
Reputation Power: 48
                     
Send a message via AIM to sheepofblue
Re: C Programming / conditional op. (math) Question...

Quote:
Originally Posted by SomeStrangeGuy
This question is on an exam I currently posess, except nowhere in the lecture notes or book (or web) can I find anything useful.

I'm not looking for the answer, but the necessary information to find my way there.




If anyone has anything or relevant links, notes, etc. - I'd be very appreciative.

I'm sure someone out there is looking at this and laughing right now. I should be too...but a serious lack of sleep is causing simple tasks to get quite complex .


Thanks in advance..
(x < y) ? ((x < z) ? x : z) : ((y < z) ? y : z) similar with reversed signage for max

Not sure the effect if x=y or variations using the min function as the man page does not state the behaviour.

Must obey the sheep dog
sheepofblue is offline  
post #3 of 11 Old 11-22-2004, 7:17 PM Thread Starter
Supporting Member
 
SomeStrangeGuy's Avatar
 
Join Date: 05-23-2001
Location: Around here.
Posts: 4,302
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Quoted: 0 Post(s)
Reputation Power: 34
                 
Re: C Programming / conditional op. (math) Question...

Damn...thanks
..manpage? oh damn, gotta find my shell acct. again...
SomeStrangeGuy is offline  
Sponsored Links
Advertisement
 
post #4 of 11 Old 11-22-2004, 10:12 PM
 
sheepofblue's Avatar
 
Join Date: 07-13-2004
Location: Huntsville AL
Posts: 14,224
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Quoted: 0 Post(s)
Reputation Power: 48
                     
Send a message via AIM to sheepofblue
Re: C Programming / conditional op. (math) Question...

Actually the function defined is not the C function specified in the man pages, that function only has one argument.

Must obey the sheep dog
sheepofblue is offline  
post #5 of 11 Old 11-22-2004, 10:32 PM Thread Starter
Supporting Member
 
SomeStrangeGuy's Avatar
 
Join Date: 05-23-2001
Location: Around here.
Posts: 4,302
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Quoted: 0 Post(s)
Reputation Power: 34
                 
Re: C Programming / conditional op. (math) Question...

Quote:
Originally Posted by sheepofblue
Actually the function defined is not the C function specified in the man pages, that function only has one argument.
'tis ok...I think I finally found what I needed, in the appendix of an old Sam's book on C.

No worries, I will not be coding anything for a livelihood anytime soon, I limit my math skills to subnetting calculations and load balancing equations...pretty much stops there.


..actually sometimes I do get confused @ Krispy Kreme too, and have to count how many are already in the box so I know how many to tell the donut chick without the infamous "uh, how many more" line (which in professional donut handler speak means: "uh, Im just going to eat them all when I get in the car anyways..").
SomeStrangeGuy is offline  
post #6 of 11 Old 11-22-2004, 11:11 PM
 
sheepofblue's Avatar
 
Join Date: 07-13-2004
Location: Huntsville AL
Posts: 14,224
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Quoted: 0 Post(s)
Reputation Power: 48
                     
Send a message via AIM to sheepofblue
Re: C Programming / conditional op. (math) Question...

Quote:
Originally Posted by SomeStrangeGuy
'tis ok...I think I finally found what I needed, in the appendix of an old Sam's book on C.

No worries, I will not be coding anything for a livelihood anytime soon, I limit my math skills to subnetting calculations and load balancing equations...pretty much stops there.
wasn't my first answer correct? Just curious, of course when you get to the real world you will find a lot of coding standards specify never to use the evil trinary operator.

And calculations are your friend

Must obey the sheep dog
sheepofblue is offline  
post #7 of 11 Old 11-22-2004, 11:23 PM Thread Starter
Supporting Member
 
SomeStrangeGuy's Avatar
 
Join Date: 05-23-2001
Location: Around here.
Posts: 4,302
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Quoted: 0 Post(s)
Reputation Power: 34
                 
Re: C Programming / conditional op. (math) Question...

Quote:
Originally Posted by sheepofblue
wasn't my first answer correct? Just curious, of course when you get to the real world you will find a lot of coding standards specify never to use the evil trinary operator.

And calculations are your friend
Yes it was actually...you've led by example and I reasearched it further Sorry I neglected to state that before Thanks!

calculations = blech.
SomeStrangeGuy is offline  
post #8 of 11 Old 11-23-2004, 12:12 AM
 
stegen's Avatar
 
Join Date: 12-29-2001
Location: La Crosse, Wi
Age: 38
Posts: 3,301
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Quoted: 0 Post(s)
Reputation Power: 22
   
Re: C Programming / conditional op. (math) Question...

Quote:
Originally Posted by sheepofblue
(x < y) ? ((x < z) ? x : z) : ((y < z) ? y : z) similar with reversed signage for max

Not sure the effect if x=y or variations using the min function as the man page does not state the behaviour.
damn, thats what i was gonna say.
stegen is offline  
post #9 of 11 Old 11-23-2004, 12:13 AM Thread Starter
Supporting Member
 
SomeStrangeGuy's Avatar
 
Join Date: 05-23-2001
Location: Around here.
Posts: 4,302
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Quoted: 0 Post(s)
Reputation Power: 34
                 
Re: C Programming / conditional op. (math) Question...

Quote:
Originally Posted by stegen
damn, thats what i was gonna say.
...I didn't know you knew max too?
SomeStrangeGuy is offline  
post #10 of 11 Old 11-23-2004, 9:51 AM
 
Join Date: 01-28-2003
Posts: 6,318
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Quoted: 0 Post(s)
Reputation Power: 0
                 
Re: C Programming / conditional op. (math) Question...

Quote:
Originally Posted by sheepofblue
when you get to the real world you will find a lot of coding standards specify never to use the evil trinary operator.

:

Yea, I was looking up the answer to this when I found myself asking "Why the eff would anyone do this? You can't read it for chit!".
Heavy-Dee is offline  
post #11 of 11 Old 11-23-2004, 12:10 PM
 
sheepofblue's Avatar
 
Join Date: 07-13-2004
Location: Huntsville AL
Posts: 14,224
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Quoted: 0 Post(s)
Reputation Power: 48
                     
Send a message via AIM to sheepofblue
Re: C Programming / conditional op. (math) Question...

Quote:
Originally Posted by Heavy-Dee
Yea, I was looking up the answer to this when I found myself asking "Why the eff would anyone do this? You can't read it for chit!".
That is what people say whent they read my linked list scheduling algorithms

Must obey the sheep dog
sheepofblue is offline  
Reply

  Lower Navigation
Go Back   Honda Motorcycles - FireBlades.org > Other > Off-Topic

Quick Reply
Message:
Options

Register Now



In order to be able to post messages on the Honda Motorcycles - FireBlades.org forums, you must first register.
Please enter your desired user name, your email address and other required details in the form below.

User Name:
Password
Please enter a password for your user account. Note that passwords are case-sensitive.

Password:


Confirm Password:
Email Address
A valid e-mail address is REQUIRED. You will not have access to any site features until you activate your account using the activation e-mail that is sent to this address.

Email Address:
OR

Log-in










Thread Tools
Show Printable Version Show Printable Version
Email this Page Email this Page



Posting Rules  
You may post new threads
You may post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

 
For the best viewing experience please update your browser to Google Chrome