Skip to content
Snippets Groups Projects
Commit 77a2c1b5 authored by Mark OLESEN's avatar Mark OLESEN
Browse files

ENH: support token conversion of scalar to label (#1696)

- this specifically arises in the case we have used the `#eval` syntax
  to generate a value.
  However, since the expressions produce scalar/vector/tensor etc, the
  tokenized value will *not* be introduced into the dictionary as a
  label, even if it appears to be an integer value.

  Eg, eval "2*5", eval "sqrt(100)" both yield `scalar(100)`, which
  will not be suitable for any consumer expecting a label value.

  With the `#calc` version, this problem is glossed over since it uses a
  string buffer for the output (which can suppress the decimal)
  and re-parses the string into tokens, which causes a label to be
  recognized.

- Since we obviously already support implicit handling of ints as
  floats (when reading), now also allow conversion of float
  representations of integral values.

  Uses the ad hoc value of 1e-4 for deciding if the value deviates too
  far from being integral.

- As a side-effect, can now also support scientific notation when
  specifying integers.  Eg, (10 100 1e+3) for cell counts.
parent 8cfb4830
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment