I try to calculate the input impedance out of an S-Parameter network using the stoz function.
The results are strange. To get correct results I have to use the following equation: Z1=mag(50*((1+S)/(1-S)))
I would have expected stoz to do the same, i.e:

For a very simple pi 6-dB attenuator I got for Z1 50.7 ohm with the calculation "by hand". With the 2nd method (using stoz function) I get 83.6 ohm.

I can provide the QUCS files if required.
Any idea guys? Could this be a bug in the stoz function?

Best Regards