mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-21 06:45:39 -06:00
ScatterDraw: Fixed ResParallel as indicated by peterh
git-svn-id: svn://ultimatepp.org/upp/trunk@13060 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
331bb27e3a
commit
9d149a56a4
1 changed files with 5 additions and 2 deletions
|
|
@ -497,11 +497,14 @@ public:
|
|||
unit.Sqrt();
|
||||
}
|
||||
void ResParallel(const doubleUnit &d) {
|
||||
if (val + d.val < 1e-100)
|
||||
if (abs(val + d.val) < 1e-100 && abs(val*d.val) > 1e-100)
|
||||
throw Exc(t_("Division by zero"));
|
||||
if (!(unit.IsEqual(d.unit) || IsNull(unit) || IsNull(d.unit)))
|
||||
throw Exc(t_("Units does not match in resistor parallel"));
|
||||
val = val*d.val/(val + d.val);
|
||||
if (abs(val*d.val) < 1e-100)
|
||||
val = 0.0;
|
||||
else
|
||||
val = val*d.val/(val + d.val);
|
||||
}
|
||||
void SetNull() {val = Null;}
|
||||
bool IsNullInstance() const {return IsNull(unit) && IsNull(val);}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue