# Re: s29 and Complex numbers

```Doug McNutt wrote:
> Jonathan Lang wrote:
> >Technically, the result set is one element (the principle value),
> >since a mathematical function - by definition - produces a single
> >result for any given input.
>
> Please be careful of  "definitions" like that. Computer science has quite
> different ideas about mathematics than those of chalkboard algebra.```
```
...which is why I specified "mathematical function"; I was
intentionally referring to the chalkboard algebra meaning.  But I can
see where the confusion came from.

> x^(1/2) is a multivalued function and x^2 is a single valued
> function but they are both pow(x ,y).

Actually, that's an interesting point: I didn't find a pow() function
in the s29 draft.  There was an exp() function which could do the same
thing, albeit with the arguments in reverse order: exp(\$exp, \$base) :=
\$base ** \$exp; but if you want to do a function that places the
arguments the other way around, you apparently have to say something
like "infix:<**> (\$base, \$exp)".

I'd recommend adding a pow() function such that pow(\$base, \$exp) :=
\$base ** \$exp; it's redundant, but it's a very useful bit of
redundancy.

> The likes of yacc have
> other ideas causing -2^2 to become +4 (thankfully not in
> perl)

Oh?  Last I checked, prefix:<-> was a higher-priority operator than
infix:<**>; so -2**2 is equivalent to (-2)**2, not -(2**2).

> and sqrt(x) to become single valued positive definite.
> -2^(1/2) is not the same as -sqrt(2) in some implementations.

I should hope not.

That said, I really hope that "sqrt(\$x)" will effectively be the same
as "\$x ** 0.5": I want both of them to return a single value in scalar
context, and for each to behave like the other when in list context.

--
Jonathan "Dataweaver" Lang
```