Changes between Version 193 and Version 194 of WikiStart


Ignore:
Timestamp:
06/26/19 08:19:19 (5 years ago)
Author:
wouter
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • WikiStart

    v193 v194  
    355355}}}
    356356
    357 === Value workaround
    358 This example also illustrates a problem with the json parser. In our jobs example domain, fte is a  discrete value, so "0.8" is just a string, not a number. However if fte would be a numeric issue, we naively would write the 0.8 without quotes: {{{fte:0.8}}}. However due to the way the json parser works, we would get 0.8 parsed as s double. This introduces rounding errors. And these cause all kinds of problems.
    359 
    360 To avoid these rounding errors, the solution is to store the decimal value also in a string. We can then later convert it properly.
    361 
    362 However if we store it in a string, we would be unable to distinguish it from a discrete value. To work around this, we put it in a string and prepend it with a "=".
    363 
    364 * "0.8": the DiscreteValue
    365 * "=0.8": the NumberValue.
    366 
    367 This workaround is only needed for issue values like in bids. In other places where we can *only* have double values, we can work around the issue without needing the string trick.
     357Notice that in this example, issues like fte are discrete (possible values are enumerated). Therefore the issue value is double quoted. If the issue were numeric, we would write the issue value without quotes.
    368358
    369359