Integers in component values

4 views
Skip to first unread message

Joacim Frisk

unread,
Nov 24, 2009, 5:30:07 AM11/24/09
to pyci...@googlegroups.com
I thought I found a bug, but it could perhaps be considered a feature.
I got mysterious results when running some transient tests when I used
integers e.g. 2, for component values. The results where correct when
I used e.g. 2.0 instead. I guess it was due to G=1/R calculation.
Should we make sure all component values are converted to float?

/Joacim

henrik johansson

unread,
Nov 24, 2009, 7:05:29 AM11/24/09
to pyci...@googlegroups.com
This is a Python problem that is fixed in version 3.x where / means
float division and // integer division. In Python 2.x / means integer
division if the arguments are integers.

The obvious fix would be to add this line to all files:
from __future__ import division

In the meantime it could be reported as an issue.

/Henrik

2009/11/24 Joacim Frisk <joacim...@gmail.com>:
> --
>
> You received this message because you are subscribed to the Google Groups "pycircuit" group.
> To post to this group, send email to pyci...@googlegroups.com.
> To unsubscribe from this group, send email to pycircuit+...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/pycircuit?hl=en.
>
>
>
Reply all
Reply to author
Forward
0 new messages