I'm using Neuron version 7.2 (436::cbc0331180f8) 2010-04-05 and I found an annoying bug.
Plaese try this code
Code: Select all
strdef stemp
g = 2.2e-9
gk = 2.2e-9 * 1e11
sprint(stemp,"K%d",gk)
stemp
Is this normal?
Best regards
Code: Select all
strdef stemp
g = 2.2e-9
gk = 2.2e-9 * 1e11
sprint(stemp,"K%d",gk)
stemp
Code: Select all
oc>gk=2.2e-9*1e11
first instance of gk
oc>gk
220
oc>print gk
220
oc>int(gk)
220
oc>strdef foo
oc>sprint(foo,"%d",gk)
1
oc>foo
219
oc>{printf("%20.15f\n", gk)}
219.999999999999972
oc>float_epsilon
1e-11
oc>float_epsilon=1e-20
oc>print gk
220
oc>int(gk)
219
OK but I need to do that. g is a conductance in a given unit and gk is used to create string and filename (in a court form).avoid writing code that invites truncation error, e.g. by multiplying a very small number by a very large number and then expecting the result to be a whole number.
I'd suggest a different strategy for naming files and managing data.Gannier wrote:I need to do that. g is a conductance in a given unit and gk is used to create string and filename
A court form? What does the law have to do with this?(in a court form).
sorry, I would say "short form" ("court" = short in french)A court form? What does the law have to do with this?
Ah, yes, as in Latin "curtus," similar to German "kurtz" although it seems strange that they would have borrowed that from Latin--maybe something more ancient gave rise to both? Sanskrit "hrasva" suggests a root like [h|k]rs.Gannier wrote:"short form" ("court" = short in french)
Yes, and if you compare Norvegian/Swedish/danish term (kort) it seem that all ("kurtz", "court", "short" and "kort") derive from a unique root.ted wrote:Ah, yes, as in Latin "curtus," similar to German "kurtz" although it seems strange that they would have borrowed that from Latin--maybe something more ancient gave rise to both? Sanskrit "hrasva" suggests a root like [h|k]rs.