|
|
Le 15-11-27 11:20, Todd Carnes a écrit :
> 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
>
It's always safer to assume that the value in question *may* be negative
as well as positive.
You want the result to be *always* positive indepentently if it's
original sign.
Alain
Post a reply to this message
|
|