I chased it down. It's this line:
so := TFslDecimal.ValueOf(sl).Subtract(TFslDecimal.ValueOf(sr)).AsString
in this routine
function TMXmlDocument.opMinus(left, right: TFslList<TMXmlNode>): TFslList<TMXmlNode>;
var
sl, sr, so: String;
dl, dr : TFslDecimal;
begin
result := TFslList<TMXmlNode>.Create;
try
if (left.Count <> 1) or (right.Count <> 1) then
// nothing
else
begin
sl := evaluateString(left);
sr := evaluateString(right);
if StringIsInteger32(sl) and StringIsInteger32(sr) then
so := IntToStr(StringToInteger32(sl) - StringToInteger32(sr))
else if StringIsDecimal(sl) and StringIsDecimal(sr) then
so := TFslDecimal.ValueOf(sl).Subtract(TFslDecimal.ValueOf(sr)).AsString
else
so := sl.Replace(sr, '');
end;
result.Add(TMXmlString.Create(so));
result.link;
finally
result.free;
end;
end;
in
https://github.com/grahamegrieve/fhirserver/blob/master/library/fsl/fsl_xml.pasIf I replace that line with this, which is identical but uses two local variables, no problems
dl := TFslDecimal.ValueOf(sl);
dr := TFslDecimal.ValueOf(sr);
so := dl.Subtract(dr).AsString;