# [rrd-users] Re: Quick RPN question... (Square root in RPN?)

Serge Maandag serge.maandag at staff.zeelandnet.nl
Mon Jun 9 16:37:24 MEST 2003

```Hey, I remember this one from school:

you:
- first take the log() from each side,
- then get the exponent out of the brackets.
- then take the exp() from each side. exp(logx)) = x

x      = a^b
log(x) = log(a^b)
log(x) = b * log(a)
x      = exp( b*log(a) )

you want to do a^(1/2) for a square root, so sqrt(a) = exp( log(a)/2 )

So you're right.

Serge.

-----Original Message-----
From: Alex van den Bogaerdt [mailto:alex at ergens.op.het.net]
Sent: Monday, June 09, 2003 1:29 PM
To: RRD Users
Subject: [rrd-users] Re: Quick RPN question... (Square root in RPN?)

On Mon, Jun 09, 2003 at 11:07:40AM +0100, Simon Mullis wrote:
> Hello all,
>
> Am I right in thinking there is no easy way to do a square root in RPN?

Isn't a square root the same as exp(log(x)/2) ?

CDEF:y=x,LOG,2,/,EXP

Not sure,never tried it, just try it yourself.

--
Unsubscribe mailto:rrd-users-request at list.ee.ethz.ch?subject=unsubscribe
Help        mailto:rrd-users-request at list.ee.ethz.ch?subject=help
Archive     http://www.ee.ethz.ch/~slist/rrd-users