Page MenuHome

Numpy complex numbers division bug on Win 10
Closed, ResolvedPublic


Win 8.1 / 64 bits
AMD A10-6700 APU
video : HD8670 D

Hash = b'f337fea' 8 Fev 2016
and also

Hash = b'f77110e'

I asked someone else to test this on Linux
and it seems to work fine

so this seems to be a bug on Win 10

in given file there is a problem with this division of complexx numbers in Numpy

z1 = 7.49+0.71j
z2 = 127.01705922171767+0j
z3 = z2/z1
print ('z1 =',z1)
print ('z1 abs =',np.absolute(z1),' z1 ang =',np.angle(z1, deg=True),' Deg')
print ('z2 =',z2)
print ('z2 abs =',np.absolute(z2),' z2 ang =',np.angle(z2, deg=True),' Deg')
print ('z2/z1 = z3 =',z3)

the angle for Z3 gives -174 degrees

but it should be around -5 degrees !

tested other values and seems to work but not for this division operation.

see thread discussing this

happy bl



Event Timeline

Ricky J (rickyblender) raised the priority of this task from to Needs Triage by Developer.
Ricky J (rickyblender) updated the task description. (Show Details)
Ricky J (rickyblender) set Type to Bug.
Bastien Montagne (mont29) lowered the priority of this task from Needs Triage by Developer to Needs Information from User.Feb 8 2016, 7:31 PM

This seems to be an issue with numpy itself… Did you try that directly from python console itself (without using Blender at all)?

trying to do it in winpython

but I asked some one else to test it in Linux blender
and it works fine

but not on win 10

happy bl

just did a test in winpython
and it works fine

I get the right angle at around 5 degrees

so guess it has something to do with bl some how

happy bl

@Martijn Berger (juicyfruit) maybe we should use latest version of numpy for windows? We are using 1.9 afaik, according to numpy release notes they are using more and more C99 builtin complex support, this could explain the issue?

@Ricky J (rickyblender) which is the exact version of numpy you used to test outside of Blender?

I have an old Python installed on my machine but not Numpy

so got Winpython
winpython 64 bits python 3.4.3 AMD

which has most of the package including Matplot

wish I could have same things in BL
so only way for me to test it was to use Iptyhon
and it works fine

Also Eppo did a test on Linux and it also work fine

Looks like it is only on Win 64 that it does not work well
for some specific cases of values for the complex angle.

Did anyone else find the same error on Win 64 ?

happy bl

well… winpython reports numpy 1.9.3… (

Will let @Martijn Berger (juicyfruit) handle it from there, could be some bug in our version of numpy but cannot check that here.

Bastien Montagne (mont29) raised the priority of this task from Needs Information from User to Normal.Feb 9 2016, 4:28 PM

I don't think Numpy has anything to do with this, the code in the description only uses Python's builtin complex numbers.

I was talking about these

print ('numpy z3 abs =',np.absolute(z3),'z3 ang =',np.angle(z3, deg=True),' Deg')
print ('numpy angle =', rad2deg(angle(z3)) )

this is using np or numpy values if i'm not mistaking !

ang =',np.angle(z3, deg=True )

that is the one that does not work giving -171 Deg instead of
ang = -0.09451065035724213 Rad -5.41506138450656 deg

some other equations seems to work so not certain what error it can be

you can remove the cmath module at top not beeing use anyway
it will still give same error !

how is it not using np ?

happy bl

I can confirm the issue. While it works fine on my Linux Mint 17.2 64 bit, I have the exact same problem on Windows 7 64 bit (same computer)

I'm using blender 2.76b on both (numpy 1.9.1)

Aaron Carlisle (Blendify) triaged this task as Needs Information from User priority.Feb 2 2017, 5:13 PM

Please try with the latest version of Blender we have updated these libs since then.

LazyDodo (LazyDodo) closed this task as Resolved.Feb 2 2017, 5:19 PM

can confirm it's fixed with the latest libs.

z1= (7.49+0.71j)
z1 abs = 7.52357627728  z1 ang = 5.41506138451  Deg
z2= (127.01705922171767+0j)
z2 abs = 127.017059222  z2 ang = 0.0  Deg
z2/z1 = z3= (16.807194052219895-1.5932053106910715j)
z3 real = 16.807194052219895 z3 imag = -1.5932053106910715

z3 abs = 16.882537578 z3 ang = -5.41506138451  Deg
angle = -5.41506138451