Opened 8 years ago
Last modified 2 years ago
#3818 new defect
Number type problem with relative templates. — at Version 5
Reported by: | fatherbushido | Owned by: | |
---|---|---|---|
Priority: | Should Have | Milestone: | Backlog |
Component: | Simulation | Keywords: | patch |
Cc: | mimo | Patch: |
Description (last modified by )
When using relative template, for example
<Cost> <BuildTime>350</BuildTime> <Resources> <stone op="mul">0.8</stone> </Resources> </Cost>
in mace_fortess.xml,
We get an (expected) error due to wrong number type :
ERROR: RelaxNGValidator: Validation error: structures/mace_fortress:1: Type nonNegativeInteger doesn't allow value '799.9878'
see L157 of ps/trunk/source/simulation2/system/ParamNode.cpp
// TODO: Support parsing of data types other than fixed; log warnings in other cases
Change History (5)
comment:1 by , 8 years ago
comment:2 by , 8 years ago
Milestone: | Backlog → Alpha 21 |
---|---|
Priority: | Nice to Have → Should Have |
comment:3 by , 8 years ago
Description: | modified (diff) |
---|
comment:4 by , 8 years ago
Isn't this a bit normal? If the code expects an integer, giving 0.8 won't be valid. Note that 0.8 has no finite expansion in binary, so multiplication with a something that should theoretically give an integer might not always result in something integer after all.
If you want to have multiplication with a decimal, the cost itself should be allowed to be a decimal, and the code should handle decimals correctly (rounding in the simulation or in the gui).
comment:5 by , 8 years ago
Description: | modified (diff) |
---|
I had just seen that there is a TODO in :r17386