Re: precalc_first
al davis <[email protected]> Sun, 18 Apr 2021 13:10:35 -0400
| Newsgroups | gmane.comp.gnu.gnucap.devel |
|---|---|
| Message-ID | <20210418131035.08d75d10@z> |
On Sun, 18 Apr 2021 12:40:51 +0200 Felix Salfelder <[email protected]> wrote: > I have removed > the call from list_save and recorded the changes in the prec_list > branch. It has the opposite effect to forwarding precalc_first in > subcircuit proto, see precalc_first branch. This demonstrates the need for the call to precalc_first in list_save. See the switch (apps/d_switch.cc and a bunch of tests related to it). The intent is to "list" (show the user) or "save" (as a file suitable to read back in), in such a way as to be the same as originally input, but with more info. In the switch ... A switch turns on when a rising input crosses von, turns off when a falling input crosses voff. Alternatively, the user might specify vt and vh instead, so von would be calculated as vt+vh, and voff as vt-vh. vt and vh are used only to calculate von and voff. If the user specifies von and voff, they show explicitly ... ... von=2, voff=-2 In existing code, vt and vh show the default values of 0 and 0. ... vt=NA(0), vh=NA(0), von=2, voff=-2 It probably should show vt and vh as back-calculated, but that is unimportant because they are not used. Perhaps they should not be printed. This is probably not important enough to bother with. If the user specifies vt and vh, but not von and voff, it shows as: ... vt=0, vh=2, von=NA(2), voff=NA(-2) The listing shows the values of von and voff based on vt and vh, which are only known after precalc_first. So here .. precalc_first is needed in list. von and voff must be in precalc_first, not _last. vt and vh must be calculated before von and voff, which implies pc_first.