From: Serge Steer Date: Tue, 30 Dec 2008 12:17:38 +0000 (+0100) Subject: bug 3880 fixed X-Git-Tag: 5.1~264^2~7 X-Git-Url: http://gitweb.scilab.org/?p=scilab.git;a=commitdiff_plain;h=185a6195e4a8cf89a9142081874b8364f7e61f19 bug 3880 fixed --- diff --git a/scilab/modules/cacsd/macros/g_margin.sci b/scilab/modules/cacsd/macros/g_margin.sci index 86ed428..301159e 100644 --- a/scilab/modules/cacsd/macros/g_margin.sci +++ b/scilab/modules/cacsd/macros/g_margin.sci @@ -24,8 +24,9 @@ function [gm,fr]=g_margin(h) if h.dt=='c' then //continuous time case // get s such as h(s)=h(-s) and s=iw s=%i*poly(0,"w"); - w=roots( imag(horner(h.num,s)*conj(horner(h.den,s))) ) + w=roots(imag(horner(h.num,s)*conj(horner(h.den,s))) ) ws=real(w(abs(imag(w)) +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/show_bug.cgi?id=3880 +// +// <-- Short Description --> +// division by zero occurs in g_margin with Scilab v5.0.3 +// +s=%s/(2*%pi); +g=20*(s+1)/(s*(s+5)*(s^2+2*s+10)); +gs=syslin('c',g) + gs = + + 20 + 3.1830989s + ------------------------------------------------- + 2 3 4 + 7.9577472s + 0.5066059s + 0.0282201s + 0.0006416s +if execstr('[gg,wcp]=g_margin(gs)','errcatch')<>0 then bugmes();quit;end diff --git a/scilab/modules/cacsd/tests/nonreg_tests/bug_3880.tst b/scilab/modules/cacsd/tests/nonreg_tests/bug_3880.tst new file mode 100644 index 0000000..be1b5bf --- /dev/null +++ b/scilab/modules/cacsd/tests/nonreg_tests/bug_3880.tst @@ -0,0 +1,20 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2005-2008 - INRIA - Serge.Steer@inria.fr +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= + +// <-- Non-regression test for bug 3880 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/show_bug.cgi?id=3880 +// +// <-- Short Description --> +// division by zero occurs in g_margin with Scilab v5.0.3 +// +s=%s/(2*%pi); +g=20*(s+1)/(s*(s+5)*(s^2+2*s+10)); +gs=syslin('c',g) +if execstr('[gg,wcp]=g_margin(gs)','errcatch')<>0 then pause,end +