Are there any string formatting options when conve...
# ngspice
c
Are there any string formatting options when converting numerical data to strings, e.g.,
sprintf
? My issue arises when I do something like
Copy code
set fname = 'device_char_dc_{$DEVNAME}_wid{$&wid_curr}_len{$&len_curr}_vbs{$vbs_curr}_vgs{$vgs_curr}.raw'
Once in a while, for a 0 value, I get something like
Copy code
device_char_noise_nfet1p8lvt_wid0.5_len0.15_vbs0_vgs-5.55112E-17.raw
This is not a simulator output variable, i.e., subject to ngspice tolerance, it’s just the result of
set vgs_curr = 0
t
My suggestion would be first to try setting it as a different type of variable, e.g. (and this is off the top of my head, syntax not guaranteed):
Copy code
let vgs_curr_print = $vgs_curr
set fname = '... {$&vgs_curr_print} ...'
just because different variable types act differently and may have different numerical formats. If that doesn't work, then maybe just try to round it to hundredths:
Copy code
let vgs_curr_print = floor($vgs_curr * 100) / 100
but take all that with a grain of salt. . . I often find myself struggling with variable formats in ngspice.