POV-Ray : Newsgroups : povray.general : Function: Making negative numbers positive : Re: Function: Making negative numbers positive Server Time
10 Jun 2024 14:27:11 EDT (-0400)
  Re: Function: Making negative numbers positive  
From: Todd Carnes
Date: 27 Nov 2015 11:20:35
Message: <565882d3$1@news.povray.org>
On 2015-11-27 02:45, clipka wrote:
> That's only true if the number in question is known to be negative.
>

I know, but that was what the OP asked for.

> In that case, however, it is easier and more efficient to just use the
> unary minus operator:
>
> #declare PositiveNumber = -NegativeNumber;

That works too, but then it's really just masking the fact that you are 
doing what I said... i.e. multiplying by -1.

Todd


Post a reply to this message

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