Skip to content
  • Mark OLESEN's avatar
    77a2c1b5
    ENH: support token conversion of scalar to label (#1696) · 77a2c1b5
    Mark OLESEN authored
    - 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.
    77a2c1b5
    ENH: support token conversion of scalar to label (#1696)
    Mark OLESEN authored
    - 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.
Loading