aboutsummaryrefslogtreecommitdiff
path: root/cad/spice
diff options
context:
space:
mode:
authorJohn Polstra <jdp@FreeBSD.org>2006-05-14 16:48:07 +0000
committerJohn Polstra <jdp@FreeBSD.org>2006-05-14 16:48:07 +0000
commit6c8918644414d8508a7462d55060e697de1516c9 (patch)
treeabe57d1940938ab6994b82f9dc7202c555822504 /cad/spice
parent9823d4bce05e7032b77c3ac7573674cfa0a9688f (diff)
downloadports-6c8918644414d8508a7462d55060e697de1516c9.tar.gz
ports-6c8918644414d8508a7462d55060e697de1516c9.zip
Notes
Diffstat (limited to 'cad/spice')
-rw-r--r--cad/spice/files/patch-src_lib_inp_inpptree_c34
1 files changed, 34 insertions, 0 deletions
diff --git a/cad/spice/files/patch-src_lib_inp_inpptree_c b/cad/spice/files/patch-src_lib_inp_inpptree_c
new file mode 100644
index 000000000000..0819cac1407d
--- /dev/null
+++ b/cad/spice/files/patch-src_lib_inp_inpptree_c
@@ -0,0 +1,34 @@
+--- src/lib/inp/inpptree.c.orig Mon May 3 02:16:54 1993
++++ src/lib/inp/inpptree.c Sun May 14 09:34:56 2006
+@@ -1,6 +1,8 @@
+ /**********
+ Copyright 1990 Regents of the University of California. All rights reserved.
+ Author: 1987 Wayne A. Christopher, U. C. Berkeley CAD Group
++Modified: 2006 John D. Polstra - Fix differentiation of a^b where b is not
++ constant.
+ **********/
+
+ #include "spice.h"
+@@ -206,18 +208,10 @@
+ mkcon(p->right->constant - 1))),
+ arg1);
+ } else {
+- /* This is complicated. f(x) ^ g(x) ->
+- * exp(y(x) * ln(f(x)) ...
+- */
+- arg1 = PTdifferentiate(p->left, varnum);
+- arg2 = PTdifferentiate(p->right, varnum);
+- newp = mkb(PT_TIMES, mkf(PTF_EXP, mkb(PT_TIMES,
+- p->right, mkf(PTF_LN, p->left))),
+- mkb(PT_PLUS, mkb(PT_TIMES, p->right,
+- mkb(PT_DIVIDE, arg1, p->left)),
+- mkb(PT_TIMES, arg2,
+- mkf(PTF_LN, arg1))));
+-
++ /* Rewrite a^b as exp(ln(a) * b) */
++ newp = mkf(PTF_EXP, mkb(PT_TIMES, mkf(PTF_LN, p->left), p->right));
++ /* Differentiate the rewritten form. */
++ newp = PTdifferentiate(newp, varnum);
+ }
+ break;
+