fix range problem for complex<float>, found by szabi@mplayerhq.hu
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5798 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
72c9fe5ba7
commit
252ce1d0c9
2 changed files with 7 additions and 4 deletions
|
|
@ -1,10 +1,13 @@
|
||||||
import complextest
|
import complextest
|
||||||
|
|
||||||
a = complex(1,2)
|
a = complex(-1,2)
|
||||||
|
|
||||||
if complextest.Conj(a) != a.conjugate():
|
if complextest.Conj(a) != a.conjugate():
|
||||||
raise RuntimeError, "bad complex mapping"
|
raise RuntimeError, "bad complex mapping"
|
||||||
|
|
||||||
|
if complextest.Conjf(a) != a.conjugate():
|
||||||
|
raise RuntimeError, "bad complex mapping"
|
||||||
|
|
||||||
|
|
||||||
v = (complex(1,2), complex(2,3), complex(4,3), 1)
|
v = (complex(1,2), complex(2,3), complex(4,3), 1)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -62,8 +62,8 @@ SWIGSTATICINLINE(int)
|
||||||
if (PyComplex_Check(o)) {
|
if (PyComplex_Check(o)) {
|
||||||
double re = PyComplex_RealAsDouble(o);
|
double re = PyComplex_RealAsDouble(o);
|
||||||
double im = PyComplex_ImagAsDouble(o);
|
double im = PyComplex_ImagAsDouble(o);
|
||||||
if (SWIG_CheckDoubleInRange(re, FLT_MIN, FLT_MAX, errmsg)
|
if (SWIG_CheckDoubleInRange(re, -FLT_MAX, FLT_MAX, errmsg)
|
||||||
&& SWIG_CheckDoubleInRange(im, FLT_MIN, FLT_MAX, errmsg)) {
|
&& SWIG_CheckDoubleInRange(im, -FLT_MAX, FLT_MAX, errmsg)) {
|
||||||
if (val) *val = Constructor(swig_numeric_cast(re, float),
|
if (val) *val = Constructor(swig_numeric_cast(re, float),
|
||||||
swig_numeric_cast(im, float));
|
swig_numeric_cast(im, float));
|
||||||
return 1;
|
return 1;
|
||||||
|
|
@ -73,7 +73,7 @@ SWIGSTATICINLINE(int)
|
||||||
} else {
|
} else {
|
||||||
double re;
|
double re;
|
||||||
if (SWIG_AsVal(double)(o, &re)) {
|
if (SWIG_AsVal(double)(o, &re)) {
|
||||||
if (SWIG_CheckDoubleInRange(re, FLT_MIN, FLT_MAX, errmsg)) {
|
if (SWIG_CheckDoubleInRange(re, -FLT_MAX, FLT_MAX, errmsg)) {
|
||||||
if (val) *val = Constructor(swig_numeric_cast(re,float), 0);
|
if (val) *val = Constructor(swig_numeric_cast(re,float), 0);
|
||||||
return 1;
|
return 1;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue