private string StringFromPayloadDecimal(PayloadDecimal t) { double num = (double)t; if (double.IsNaN(num)) { return(Syntax.TOKEN_NOT_A_NUMBER); } if (double.IsPositiveInfinity(num)) { return(Syntax.TOKEN_INFINITY); } if (double.IsNegativeInfinity(num)) { return(Syntax.NEGATIVE_SIGN + Syntax.TOKEN_INFINITY); } string s = num.ToString("g17", Syntax.numberFormat); if (!s.Contains("e") && !s.Contains("E")) { if (!MathHelper.HasDecimalDigits(t)) { s += ".0"; } } return(s); }
/// <summary> /// Creates a new tag of type Decimal with the specified name and payload. /// </summary> /// <param name="name">The name of the new Tag.</param> /// <param name="payload">The payload of the new Tag.</param> public TagDecimal(string name, PayloadDecimal payload) : base(name) { this.payload = payload; this.payload.EmbedIn(this); }