Hello, I'm new here. I just finished my first project using Swift Numerics, which is actually a tutorial about plotting the Mandelbrot set, and using it to compute π very inefficiently, as reported by Dave Boll in this 1991 post to sci.math. There's also a detour into IEEE 754 floating point formats, but I won't give spoilers here.

I realized quite late in writing the second part that using the `magnitude`

property from `Numeric`

wasn't the right way to the check boundedness of *f* for complex *z*. As the documentation (which I read, but evidently didn't absorb ) clearly points out in multiple places, for `Complex`

, `magnitude`

is the -norm. Of course, what I needed for *M* set boundedness checking is the Euclidean norm, which is available in `length`

.

I didn't notice this for a while because the -norm gives nearly the same plots of the *M* set and approximations of the digits of πβit just takes a few more iterations for *f* to blow up when *z* has non-zero real and imaginary components. But exact iteration counts are important for reproducing Boll's results.

I struggled to figure out how to write code that is generic over integers, reals, and complex numbers, and uses `magnitude`

for integers and reals, and `length`

for complex. What I ended up doing is writing a protocol `Lengthy`

(sorry) that requires a `length`

property, and giving it a default implementation that returned `magnitude`

. Then everything that conforms to `Numeric`

*and* `Complex`

already conform to `Lengthy`

as well, and `length`

is the property I use in the generic code. In other words,

```
protocol Lengthy: Numeric {
var length: Magnitude { get }
}
extension Lengthy {
var length: Magnitude {
magnitude
}
}
extension Int: Lengthy {}
extension Double: Lengthy {}
extension Float80: Lengthy {}
extension ComplexModule.Complex: Lengthy {}
```

I haven't decided whether this is kludgy or not, and I'm interested to hear what more experienced Swift Numerics / Standard Library programmers think.

I'd also appreciate hearing any other suggestions for improvement on my tutorial.

Thanks!