POV-Ray : Newsgroups : povray.unofficial.patches : Max and Min Server Time
10 Oct 2026 17:09:44 EDT (-0400)
  Max and Min (Message 1 to 15 of 15)  
From: Tom Melly
Subject: Max and Min
Date: 24 Aug 2000 16:57:29
Message: <39a58c39@news.povray.org>
Assume I'm a complete idiot - what do max and min do in functions, and what
is the syntax?

--
Tom Melly
tom### [at] tomandlucouk
http://www.tomandlu.co.uk


Post a reply to this message

From: Chris Huff
Subject: Re: Max and Min
Date: 24 Aug 2000 17:20:49
Message: <chrishuff-53993B.16221524082000@news.povray.org>
In article <39a58c39@news.povray.org>, "Tom Melly" 
<tom### [at] tomandluforce9couk> 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] maccom, http://homepage.mac.com/chrishuff/
TAG: chr### [at] tagpovrayorg, http://tag.povray.org/

<><


Post a reply to this message

From: Tom Melly
Subject: Re: Max and Min
Date: 25 Aug 2000 04:27:44
Message: <39a62e00$1@news.povray.org>
"Chris Huff" <chr### [at] maccom> wrote in message
news:chrishuff-53993B.16221524082000@news.povray.org...
> In article <39a58c39@news.povray.org>, "Tom Melly"
> <tom### [at] tomandluforce9couk> 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

From: Greg M  Johnson
Subject: Re: Max and Min
Date: 30 Aug 2000 10:43:00
Message: <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?


Post a reply to this message

From: Chris Huff
Subject: Re: Max and Min
Date: 30 Aug 2000 10:50:03
Message: <chrishuff-CD08B3.09513730082000@news.povray.org>
In article <39AD1C3E.5EC11E2F@my-dejanews.com>, 
gre### [at] my-dejanewscom 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] maccom, http://homepage.mac.com/chrishuff/
TAG: chr### [at] tagpovrayorg, http://tag.povray.org/

<><


Post a reply to this message

From: Tom Melly
Subject: Re: Max and Min
Date: 30 Aug 2000 10:52:17
Message: <39ad1fa1$1@news.povray.org>
"Greg M. Johnson" <gre### [at] my-dejanewscom> 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

From: Warp
Subject: Re: Max and Min
Date: 30 Aug 2000 10:52:29
Message: <39ad1fac@news.povray.org>
Greg M. Johnson <gre### [at] my-dejanewscom> 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

From: Christoph Hormann
Subject: Re: Max and Min
Date: 30 Aug 2000 11:24:11
Message: <39AD2759.9ABCA2C3@schunter.etc.tu-bs.de>
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] gmxde>
Homepage: http://www.schunter.etc.tu-bs.de/~chris/


Post a reply to this message

From: Greg M  Johnson
Subject: Re: Max and Min
Date: 30 Aug 2000 14:34:11
Message: <39AD526E.C1139BBE@my-dejanews.com>
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-dejanewscom 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] maccom, http://homepage.mac.com/chrishuff/
> TAG: chr### [at] tagpovrayorg, http://tag.povray.org/
>
> <><


Post a reply to this message

From: Chris Huff
Subject: Re: Max and Min
Date: 30 Aug 2000 18:29:00
Message: <chrishuff-5324DE.17303430082000@news.povray.org>
In article <39AD526E.C1139BBE@my-dejanews.com>, 
gre### [at] my-dejanewscom 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] maccom, http://homepage.mac.com/chrishuff/
TAG: chr### [at] tagpovrayorg, http://tag.povray.org/

<><


Post a reply to this message

From: Warp
Subject: Re: Max and Min
Date: 30 Aug 2000 18:45:47
Message: <39ad8e9b@news.povray.org>
Christoph Hormann <Chr### [at] schunteretctu-bsde> wrote:
: Although 'result' seems unnecessary

  It is very necessary. Without it, something like this will not work:

#declare Val = GimmeTheMinimumOf(Var1, Var2) + 5;

-- 
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

From: Tom Melly
Subject: Re: Max and Min
Date: 31 Aug 2000 05:02:41
Message: <39ae1f31$1@news.povray.org>
"Greg M. Johnson" <gre### [at] my-dejanewscom> wrote in message
news:39AD526E.C1139BBE@my-dejanews.com...
> 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. Well, don't worry - I once made some flippant remark about the Magna
Carta and had to put up with history lessons for a week.


Post a reply to this message

From: Ken
Subject: Re: Max and Min
Date: 31 Aug 2000 05:09:34
Message: <39AE2019.227414BD@pacbell.net>
Tom Melly wrote:

> Oh. Well, don't worry - I once made some flippant remark about the Magna
> Carta and had to put up with history lessons for a week.

:)

-- 
Ken Tyler - 1400+ POV-Ray, Graphics, 3D Rendering, and Raytracing Links:
http://home.pacbell.net/tylereng/index.html http://www.povray.org/links/


Post a reply to this message

From: Greg M  Johnson
Subject: Re: Max and Min
Date: 31 Aug 2000 11:31:27
Message: <39AE7913.FF08458E@my-dejanews.com>
Chris Huff wrote:

> (mutters something about the lack of expression in text messages)

Oh, I've often thought the best jokes are served with a dry serious tone; they
are ruined by someone who already thinks it's funny and has an overly goofy
grin.

greg, curmudgeon jr.


Post a reply to this message

From: Christoph Hormann
Subject: Re: Max and Min
Date: 31 Aug 2000 12:00:37
Message: <39AE816A.F3AE0FF3@schunter.etc.tu-bs.de>
Warp wrote:
> 
> Christoph Hormann <Chr### [at] schunteretctu-bsde> wrote:
> : Although 'result' seems unnecessary
> 
>   It is very necessary. Without it, something like this will not work:
> 
> #declare Val = GimmeTheMinimumOf(Var1, Var2) + 5;
> 

You seem to be right, but i do not really understand why (the '+5' does not seem
to have anything to do with it).

Christoph

--
Christoph Hormann <chr### [at] gmxde>
Homepage: http://www.schunter.etc.tu-bs.de/~chris/


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.