![](/i/fill.gif) |
![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Assume I'm a complete idiot - what do max and min do in functions, and what
is the syntax?
--
Tom Melly
tom### [at] tomandlu co uk
http://www.tomandlu.co.uk
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
In article <39a58c39@news.povray.org>, "Tom Melly"
<tom### [at] tomandlu force9 co uk> wrote:
> Assume I'm a complete idiot - what do max and min do in functions,
> and what is the syntax?
They take two parameters. Min returns the lesser(minimum) of the two,
and max returns the greater(maximum) of the two. The order of the
parameters does not matter.
--
Christopher James Huff
Personal: chr### [at] mac com, http://homepage.mac.com/chrishuff/
TAG: chr### [at] tag povray org, http://tag.povray.org/
<><
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
"Chris Huff" <chr### [at] mac com> wrote in message
news:chrishuff-53993B.16221524082000@news.povray.org...
> In article <39a58c39@news.povray.org>, "Tom Melly"
> <tom### [at] tomandlu force9 co uk> wrote:
>
> > Assume I'm a complete idiot - what do max and min do in functions,
> > and what is the syntax?
>
> They take two parameters. Min returns the lesser(minimum) of the two,
> and max returns the greater(maximum) of the two. The order of the
> parameters does not matter.
Many thanks - I guessed this after posting but wasn't sure. I was initially
confused by looking up min and max in my dictionary of mathematics which
went on about horizontal tangents to a curve. Ah well.
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Chris Huff wrote:
> They take two parameters. Min returns the lesser(minimum) of the two,
> and max returns the greater(maximum) of the two. The order of the
> parameters does not matter.
You're sure you don't have to put the smaller one in first?
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
In article <39AD1C3E.5EC11E2F@my-dejanews.com>,
gre### [at] my-dejanews com wrote:
> You're sure you don't have to put the smaller one in first?
I'm sure. It would kind of defeat the purpose of these functions if you
had to know which one was smaller. :-)
--
Christopher James Huff
Personal: chr### [at] mac com, http://homepage.mac.com/chrishuff/
TAG: chr### [at] tag povray org, http://tag.povray.org/
<><
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
"Greg M. Johnson" <gre### [at] my-dejanews com> wrote in message
news:39AD1C3E.5EC11E2F@my-dejanews.com...
> Chris Huff wrote:
>
> > They take two parameters. Min returns the lesser(minimum) of the two,
> > and max returns the greater(maximum) of the two. The order of the
> > parameters does not matter.
>
> You're sure you don't have to put the smaller one in first?
But how do you know which is smaller? Don't they probably change? (And if
you do know and they don't change, why are using max and min). Here's your
badge I believe.
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Greg M. Johnson <gre### [at] my-dejanews com> wrote:
: You're sure you don't have to put the smaller one in first?
#macro GimmeTheMinimumOf(A, B)
#if (A<B)
#local result = min(A, B);
#else
#local result = min(B, A);
#end
result
#end
(Hmm... a new form of povray humor?-) )
--
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):_;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Warp wrote:
>
> #macro GimmeTheMinimumOf(A, B)
> #if (A<B)
> #local result = min(A, B);
> #else
> #local result = min(B, A);
> #end
> result
> #end
>
> (Hmm... a new form of povray humor?-) )
>
:-)
Although 'result' seems unnecessary and I prefer a bit of insecurity:
#declare Rnd=seed(1);
#macro I_am_not_so_sure_about_things(A, B)
#if (rand(Rnd)<0.5)
min(A, B)
#else
min(B, A)
#end
#end
Christoph
--
Christoph Hormann <chr### [at] gmx de>
Homepage: http://www.schunter.etc.tu-bs.de/~chris/
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
OH COME ON you guys! I was poking fun at Chris' overly obvious statement:
it doesn't matter in which order you put the terms.
Chris Huff wrote:
> In article <39AD1C3E.5EC11E2F@my-dejanews.com>,
> gre### [at] my-dejanews com wrote:
>
> > You're sure you don't have to put the smaller one in first?
>
> I'm sure. It would kind of defeat the purpose of these functions if you
> had to know which one was smaller. :-)
>
> --
> Christopher James Huff
> Personal: chr### [at] mac com, http://homepage.mac.com/chrishuff/
> TAG: chr### [at] tag povray org, http://tag.povray.org/
>
> <><
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
In article <39AD526E.C1139BBE@my-dejanews.com>,
gre### [at] my-dejanews com wrote:
> OH COME ON you guys! I was poking fun at Chris' overly obvious statement:
> it doesn't matter in which order you put the terms.
Oh.
(mutters something about the lack of expression in text messages)
--
Christopher James Huff
Personal: chr### [at] mac com, http://homepage.mac.com/chrishuff/
TAG: chr### [at] tag povray org, http://tag.povray.org/
<><
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |