public DType Accept(TFloat type, string x) { if (float.TryParse(x, out var b)) { return(DFloat.ValueOf(b)); } else { throw new Exception($"{x} 不是float类型"); } }
public static bool ApproximatelyEqual(TFloat a, TFloat b) { const TFloat epsilon = 1E-4f; var diff = Math.Abs(a - b); // ReSharper disable CompareOfFloatsByEqualityOperator return(a == b || (a == 0 || b == 0 || diff < TFloat.Epsilon ? diff < TFloat.Epsilon : diff / (Math.Abs(a) + Math.Abs(b)) < epsilon)); // ReSharper restore CompareOfFloatsByEqualityOperator }
public DType Accept(TFloat type, ExcelStream x) { var d = x.Read(); if (CheckNull(type.IsNullable, d)) { return(null); } if (!float.TryParse(d.ToString(), out var v)) { throw new InvalidExcelDataException($"{d} 不是 float 类型值"); } return(DFloat.ValueOf(v)); }
public DType Accept(TFloat type, object converter, ExcelStream x, DefAssembly ass) { var d = x.Read(); if (CheckNull(type.IsNullable, d)) { return(null); } if (!float.TryParse(d.ToString(), out var v)) { throw new Exception($"{d} 不是 float 类型值"); } return(new DFloat(v)); }
void updateSkillContext(Fix64 timeDelta) { var dt = new TFloat(timeDelta); updatingSkillList.AddRange(skillContexts); for (int i = 0; i < updatingSkillList.Count; ++i) { var ctx = updatingSkillList[i]; ctx.update(dt); if (ctx.activedObjectCount == 0) { skillContexts.Remove(ctx.updater); } } updatingSkillList.Clear(); }
public static void Contagion(Number[] args) { int minType = 0; foreach (var i in args) { if (i is TFloat) { minType = 3; break; } } if (minType > 0) { for (int i = 0; i < args.Length; ++i) { if (!(args[i] is TFloat)) { args[i] = TFloat.From(args[i]); } } } }
public DType Accept(TFloat type, Sheet.NamedRow x, bool multirow, bool nullable) { throw new NotSupportedException(); }
public string Accept(TFloat type, string jsonVarName, string fieldName) { return($"{fieldName} = {jsonVarName}"); }
public string Accept(TFloat type, string fieldName, string logType) { return($"{fieldName} = default;"); }
public virtual string Accept(TFloat type, string x) { return(x + "f"); }
public string Accept(TFloat type) { return("readFloat"); }
public string Accept(TFloat type) { return("FLOAT"); }
public string Accept(TFloat type, string bufName, string fieldName) { return($"if(!{bufName}.readFloat({fieldName})) return false;"); }
public void Accept(TFloat type, Dictionary <string, DefTypeBase> x) { }
public string Accept(TFloat type) { return("writeFloat"); }
public virtual void Accept(TFloat type, T x) { }
public string Accept(TFloat type, string bufName, string fieldName) { return($"{bufName}.WriteFloat({fieldName});"); }
public virtual TR Accept(TFloat type) { return DoAccept(type); }
public string Accept(TFloat type, string bufName) { return($"{bufName}.ReadFloat()"); }
public string Accept(TFloat type) { return("FJsonValueNumber"); }
public virtual void Accept(TFloat type, T x) { DoAccept(type, x); }
public DType Accept(TFloat type, XElement x, DefAssembly ass) { return(DFloat.ValueOf(float.Parse(x.Value.Trim()))); }
public override string Accept(TFloat type, string x) { return(x); }
public bool Accept(TFloat type, TType x, Dictionary <DefTypeBase, bool> y, HashSet <DefTypeBase> z) { return(true); }
public string Accept(TFloat type) { return("float32"); }
public string Accept(TFloat type, string json, string field) { return(DefaultLoad(json, field)); }
public void Accept(TFloat type, HashSet <DefTypeBase> x) { }
public string Accept(TFloat type, string fieldName, string tablesName) { throw new NotImplementedException(); }
public string Accept(TFloat type, string bufName, string fieldName) { return($"{fieldName} = {bufName}.ReadFloat();"); }
public DType Accept(TFloat type, IEnumerable <ExcelStream> x, bool y, DefAssembly ass) { throw new NotImplementedException(); }