w := (z,g) -> .1469061274e-2*(1/Im((piecewise(z < .1950000000,Matrix(2, 2, [[1.+z*(-2+2*g),(1.+z*(-2+2*g))*(.1950000000-z)+.8050000000+.8050000000*z*(-2+2*g)+z],[-2.+2*g,(-2.+2*g)*(.1950000000-z)-.6100000000+1.610000000*g]]),piecewise(z < .2050000000,Matrix(2, 2, [[1.+z*(-2+2*g),(1.+z*(-2+2*g))*(.2050000000-z)+.7950000000+.7950000000*z*(-2+2*g)+z],[-2.+2.*g,(-2.+2.*g)*(.2050000000-z)-.5900000000+1.590000000*g]]),piecewise(z < .5,Matrix(2, 2, [[1.+z*(-2+2*g),(1.+z*(-2+2*g))*(.5-z)+.5+.5*z*(-2+2*g)+z],[-2.+2.*g,(-2.+2.*g)*(.5-z)+1.0*g]]),Matrix(2, 2, [[1.+z*(-2+2*g),(1.+z*(-2+2*g))*(1-z)+z],[-2.+2.*g,(-2.+2.*g)*(1-z)+1.]]))))[2,2]-piecewise(z < .1950000000,Matrix(2, 2, [[1.+z*(-2+2*g),(1.+z*(-2+2*g))*(.1950000000-z)+.8050000000+.8050000000*z*(-2+2*g)+z],[-2.+2*g,(-2.+2*g)*(.1950000000-z)-.6100000000+1.610000000*g]]),piecewise(z < .2050000000,Matrix(2, 2, [[1.+z*(-2+2*g),(1.+z*(-2+2*g))*(.2050000000-z)+.7950000000+.7950000000*z*(-2+2*g)+z],[-2.+2.*g,(-2.+2.*g)*(.2050000000-z)-.5900000000+1.590000000*g]]),piecewise(z < .5,Matrix(2, 2, [[1.+z*(-2+2*g),(1.+z*(-2+2*g))*(.5-z)+.5+.5*z*(-2+2*g)+z],[-2.+2.*g,(-2.+2.*g)*(.5-z)+1.0*g]]),Matrix(2, 2, [[1.+z*(-2+2*g),(1.+z*(-2+2*g))*(1-z)+z],[-2.+2.*g,(-2.+2.*g)*(1-z)+1.]]))))[1,1])/piecewise(z < .1950000000,Matrix(2, 2, [[1.+z*(-2+2*g),(1.+z*(-2+2*g))*(.1950000000-z)+.8050000000+.8050000000*z*(-2+2*g)+z],[-2.+2*g,(-2.+2*g)*(.1950000000-z)-.6100000000+1.610000000*g]]),piecewise(z < .2050000000,Matrix(2, 2, [[1.+z*(-2+2*g),(1.+z*(-2+2*g))*(.2050000000-z)+.7950000000+.7950000000*z*(-2+2*g)+z],[-2.+2.*g,(-2.+2.*g)*(.2050000000-z)-.5900000000+1.590000000*g]]),piecewise(z < .5,Matrix(2, 2, [[1.+z*(-2+2*g),(1.+z*(-2+2*g))*(.5-z)+.5+.5*z*(-2+2*g)+z],[-2.+2.*g,(-2.+2.*g)*(.5-z)+1.0*g]]),Matrix(2, 2, [[1.+z*(-2+2*g),(1.+z*(-2+2*g))*(1-z)+z],[-2.+2.*g,(-2.+2.*g)*(1-z)+1.]]))))[1,2]+2*I*((1-(1/2*piecewise(z < .1950000000,Matrix(2, 2, [[1.+z*(-2+2*g),(1.+z*(-2+2*g))*(.1950000000-z)+.8050000000+.8050000000*z*(-2+2*g)+z],[-2.+2*g,(-2.+2*g)*(.1950000000-z)-.6100000000+1.610000000*g]]),piecewise(z < .2050000000,Matrix(2, 2, [[1.+z*(-2+2*g),(1.+z*(-2+2*g))*(.2050000000-z)+.7950000000+.7950000000*z*(-2+2*g)+z],[-2.+2.*g,(-2.+2.*g)*(.2050000000-z)-.5900000000+1.590000000*g]]),piecewise(z < .5,Matrix(2, 2, [[1.+z*(-2+2*g),(1.+z*(-2+2*g))*(.5-z)+.5+.5*z*(-2+2*g)+z],[-2.+2.*g,(-2.+2.*g)*(.5-z)+1.0*g]]),Matrix(2, 2, [[1.+z*(-2+2*g),(1.+z*(-2+2*g))*(1-z)+z],[-2.+2.*g,(-2.+2.*g)*(1-z)+1.]]))))[2,2]+1/2*piecewise(z < .1950000000,Matrix(2, 2, [[1.+z*(-2+2*g),(1.+z*(-2+2*g))*(.1950000000-z)+.8050000000+.8050000000*z*(-2+2*g)+z],[-2.+2*g,(-2.+2*g)*(.1950000000-z)-.6100000000+1.610000000*g]]),piecewise(z < .2050000000,Matrix(2, 2, [[1.+z*(-2+2*g),(1.+z*(-2+2*g))*(.2050000000-z)+.7950000000+.7950000000*z*(-2+2*g)+z],[-2.+2.*g,(-2.+2.*g)*(.2050000000-z)-.5900000000+1.590000000*g]]),piecewise(z < .5,Matrix(2, 2, [[1.+z*(-2+2*g),(1.+z*(-2+2*g))*(.5-z)+.5+.5*z*(-2+2*g)+z],[-2.+2.*g,(-2.+2.*g)*(.5-z)+1.0*g]]),Matrix(2, 2, [[1.+z*(-2+2*g),(1.+z*(-2+2*g))*(1-z)+z],[-2.+2.*g,(-2.+2.*g)*(1-z)+1.]]))))[1,1])^2)/piecewise(z < .1950000000,Matrix(2, 2, [[1.+z*(-2+2*g),(1.+z*(-2+2*g))*(.1950000000-z)+.8050000000+.8050000000*z*(-2+2*g)+z],[-2.+2*g,(-2.+2*g)*(.1950000000-z)-.6100000000+1.610000000*g]]),piecewise(z < .2050000000,Matrix(2, 2, [[1.+z*(-2+2*g),(1.+z*(-2+2*g))*(.2050000000-z)+.7950000000+.7950000000*z*(-2+2*g)+z],[-2.+2.*g,(-2.+2.*g)*(.2050000000-z)-.5900000000+1.590000000*g]]),piecewise(z < .5,Matrix(2, 2, [[1.+z*(-2+2*g),(1.+z*(-2+2*g))*(.5-z)+.5+.5*z*(-2+2*g)+z],[-2.+2.*g,(-2.+2.*g)*(.5-z)+1.0*g]]),Matrix(2, 2, [[1.+z*(-2+2*g),(1.+z*(-2+2*g))*(1-z)+z],[-2.+2.*g,(-2.+2.*g)*(1-z)+1.]]))))[1,2]^2)^(1/2)))^(1/2);

f := (g) -> evalf[20](Int(w(z, g), z=0.0..1.0));

f(-0.2);

0.8042778884924786499363261e-3+0.*I

plot(f(g), g=0.0..1.0);

Error, (in signum/main) too many levels of recursion

It works for one floating-point calculation but does not work for plot.