public override string ToString() { StringBuilder sb = new StringBuilder(200); sb.Append(_feature.ToString()); sb.Append("Threshold="); sb.Append(_threshold.ToString("F04")); sb.AppendLine(","); sb.Append("Sign:"); sb.AppendLine(_posLargeThanThreshold ? ">," : "<,"); sb.Append("Weight="); sb.AppendLine(_weight.ToString("F02")); return(sb.ToString()); }
/// <summary> /// Sets the primitive value to the given number. /// </summary> /// <param name="unitType">The unit of the number.</param> /// <param name="value">The value of the number.</param> /// <returns>The CSS primitive value instance.</returns> public CSSPrimitiveValue SetFloatValue(UnitType unitType, Single value) { _text = value.ToString(CultureInfo.InvariantCulture) + ConvertUnitTypeToString(unitType); unit = unitType; data = value; return this; }
private static void PrintSettings() { foreach (KeyValuePair <string, DeviceSetting> setting in DeviceSettings) { if (!setting.Value.Supported) { continue; } switch (setting.Value.SettingType) { case QLSettingType.QL_SETTING_TYPE_BOOL: bool boolValue = (bool)setting.Value.Value; Console.WriteLine(" {0}: {1}", setting.Key, boolValue.ToString()); break; case QLSettingType.QL_SETTING_TYPE_FLOAT: System.Single singleValue = (System.Single)setting.Value.Value; Console.WriteLine(" {0}: {1}{2}", setting.Key, singleValue.ToString(), setting.Value.Units); break; case QLSettingType.QL_SETTING_TYPE_INT32: if (setting.Key.Equals(QL_SETTINGS.QL_SETTING_DEVICE_BANDWIDTH_MODE)) { QLDeviceBandwidthMode bandwidthMode = (QLDeviceBandwidthMode)setting.Value.Value; Console.WriteLine(" {0}: {1}", setting.Key, bandwidthMode.ToString()); } else if (setting.Key.Equals(QL_SETTINGS.QL_SETTING_DEVICE_GAIN_MODE)) { QLDeviceGainMode gainMode = (QLDeviceGainMode)setting.Value.Value; Console.WriteLine(" {0}: {1}", setting.Key, gainMode.ToString()); } else if (setting.Key.Equals(QL_SETTINGS.QL_SETTING_DEVICE_GAZE_POINT_FILTER_MODE)) { QLDeviceGazePointFilterMode gazePointFilterMode = (QLDeviceGazePointFilterMode)setting.Value.Value; Console.WriteLine(" {0}: {1}", setting.Key, gazePointFilterMode.ToString()); } else if (setting.Key.Equals(QL_SETTINGS.QL_SETTING_DEVICE_IMAGE_PROCESSING_EYES_TO_FIND)) { QLDeviceEyesToUse eyesToUse = (QLDeviceEyesToUse)setting.Value.Value; Console.WriteLine(" {0}: {1}", setting.Key, eyesToUse.ToString()); } else if (setting.Key.Equals(QL_SETTINGS.QL_SETTING_DEVICE_IR_LIGHT_MODE)) { QLDeviceIRLightMode irLightMode = (QLDeviceIRLightMode)setting.Value.Value; Console.WriteLine(" {0}: {1}", setting.Key, irLightMode.ToString()); } else { System.Int32 int32Value = (System.Int32)setting.Value.Value; Console.WriteLine(" {0}: {1}{2}", setting.Key, int32Value.ToString(), setting.Value.Units); } break; default: Console.WriteLine("Unrecognized setting type: {0}.", setting.Value.SettingType.ToString()); break; } } }
/// <summary> /// Convert this rectangle into string. (Format: {x, y, w, h}) /// </summary> /// <returns>String converted from this rectangle object.</returns> public override string ToString() { return(string.Format("{{{0}, {1}, {2}, {3}}}", X.ToString(System.Globalization.CultureInfo.CurrentCulture), Y.ToString(System.Globalization.CultureInfo.CurrentCulture), Width.ToString(System.Globalization.CultureInfo.CurrentCulture), Height.ToString(System.Globalization.CultureInfo.CurrentCulture))); }
public void SetValue(SFRangeSlider r, nfloat value) { nfloat f = (nfloat)Math.Round(value, 1); if (r == rangeSlider1) { label4.Text = f.ToString() + "db"; } else if (r == rangeSlider2) { label5.Text = f.ToString() + "db"; } else { label6.Text = f.ToString() + "db"; } }
public void SetValue(SfRangeSlider r, nfloat value) { nfloat f = (nfloat)Math.Round(value, 1); if (r == rangeSlider1) { decibelLabel1.Text = f.ToString() + "db"; } else if (r == rangeSlider2) { decibelLabel2.Text = f.ToString() + "db"; } else { decibelLabel3.Text = f.ToString() + "db"; } }
public override string ToString() { StringBuilder sb = new StringBuilder(20); sb.Append("Value="); sb.Append(value.ToString("F04")); sb.Append(",Weight="); sb.Append(weight.ToString("F04")); sb.Append(","); sb.Append(isPos.ToString()); return(sb.ToString()); }
public void MusicVolumeChange(System.Single value) { MusicLabel.text = value.ToString() + "%"; if (value == 0) { Mixer.SetFloat("MusicVolume", -80); } else { Mixer.SetFloat("MusicVolume", Mathf.Log10(value / 100) * 20); } }
static StackObject *ToString_15(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject *ptr_of_this_method; StackObject *__ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); System.Single instance_of_this_method = GetInstance(__domain, ptr_of_this_method, __mStack); var result_of_this_method = instance_of_this_method.ToString(); return(ILIntepreter.PushObject(__ret, __mStack, result_of_this_method)); }
static StackObject *ToString_17(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject *ptr_of_this_method; StackObject *__ret = ILIntepreter.Minus(__esp, 2); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); System.String format = (System.String) typeof(System.String).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); ptr_of_this_method = ILIntepreter.Minus(__esp, 2); System.Single instance_of_this_method = GetInstance(__domain, ptr_of_this_method, __mStack); var result_of_this_method = instance_of_this_method.ToString(format); return(ILIntepreter.PushObject(__ret, __mStack, result_of_this_method)); }
/// <summary>Start calculation when "Click" button is activated. Calls doCalculation</summary> /// <param name="sender">Form that sent event</param> /// <param name="e">Event</param> private void calculate_Click(object sender, System.EventArgs e) { try { operandType lhs = operandType.Parse(lhsOperand.Text); operandType rhs = 0; if (!sqrtlhs.Checked) { rhs = operandType.Parse(rhsOperand.Text); } operandType answer = doCalculation(lhs, rhs); result.Text = answer.ToString(); } catch (System.Exception caught) { result.Text = caught.Message; } }
public static void AddWeakClassifier(XmlNode stageNode, MyFloat threshold, bool posLargeThanThreshold, MyFloat weight, ColorType colorType, Rectangle[] rects, int[] rectWeights) { XmlElement node = _doc.CreateElement("WeakClassifier"); node.SetAttribute("Threshold", threshold.ToString()); node.SetAttribute("PosLargeThanThreshold", posLargeThanThreshold.ToString()); node.SetAttribute("Weight", weight.ToString()); node.SetAttribute("ColorType", colorType.ToString()); for (int i = 0; i < rects.Length; i++) { Rectangle rect = rects[i]; XmlElement rectNode = _doc.CreateElement("Rect"); rectNode.InnerText = string.Format("{0} {1} {2} {3} {4}", rect.X, rect.Y, rect.Width, rect.Height, rectWeights[i]); node.AppendChild(rectNode); } stageNode.AppendChild(node); }
/// <summary> Adds a command argument. </summary> /// <param name="argument"> The argument. </param> public void AddArgument(Single argument) { _arguments.Add(argument.ToString(CultureInfo.InvariantCulture)); }
protected override void GenerateSingleFloatValue(Single s) { Output.Write(s.ToString(CultureInfo.InvariantCulture)); Output.Write('F'); }
private string GetFormattedString(string strTextContent, string strFontName, Single sngFontSizeInPoints, double sngMaxWidthInPoints, long hanging) { System.Array varWordArray; IMxApplication pMxApp = ArcMap.Application as IMxApplication; IAppDisplay pAppDisplay = pMxApp.Display; IDisplayTransformation pTransformation = pAppDisplay.DisplayTransformation; IFontDisp pTextFont = new stdole.StdFontClass() as IFontDisp; ITextSymbol pTextSymbol = new TextSymbolClass(); double dblXSize; double dblYSize; string strGoodWidth = ""; string strFinalString = ""; string strTestString = ""; int i; // Split the string into an array of words varWordArray = strTextContent.Split(' ') as System.Array; // Set up the Font pTextFont.Name = strFontName; pTextFont.Size = decimal.Parse(sngFontSizeInPoints.ToString()); // Setup the Text Symbol pTextSymbol.Font = pTextFont; // Setup spacing string for hanging indent int pSpaces, i3; string hangingIndent; pAppDisplay.StartDrawing(pAppDisplay.hDC, 0); hangingIndent = ""; //minimum hanging indent if (hanging > 0) { pTextSymbol.GetTextSize(pAppDisplay.hDC, pTransformation, " ", out dblXSize, out dblYSize); pSpaces = (int)System.Math.Round(hanging / dblXSize); for (i3 = 0; i3 == pSpaces; i3++) { hangingIndent = hangingIndent + " "; } } // do nothing if hanging is 0 pAppDisplay.FinishDrawing(); // done setting up the hanging indent // Add each word into the test string and test for width pAppDisplay.StartDrawing(pAppDisplay.hDC, 0); long linesAdded = 0; for (i = 0; i <= (int)varWordArray.GetUpperBound(0); i++) { if (strGoodWidth != "") { strTestString = strGoodWidth + " " + varWordArray.GetValue(i); } else { strTestString = varWordArray.GetValue(i).ToString(); } // Get the TextSize if (linesAdded == 0) { pTextSymbol.GetTextSize(pAppDisplay.hDC, pTransformation, strTestString, out dblXSize, out dblYSize); } else { pTextSymbol.GetTextSize(pAppDisplay.hDC, pTransformation, " " + strTestString, out dblXSize, out dblYSize); } // If the word added is < max width keep adding to the line, else make a new one if (dblXSize < sngMaxWidthInPoints) { strGoodWidth = strTestString; } else { if (linesAdded == 0) { strFinalString = hangingIndent + strGoodWidth; } else { strFinalString = strFinalString + Environment.NewLine + hangingIndent + " " + strGoodWidth; } linesAdded = linesAdded + 1; strGoodWidth = varWordArray.GetValue(i).ToString(); } } strFinalString = strFinalString + Environment.NewLine + hangingIndent + " " + strGoodWidth; pAppDisplay.FinishDrawing(); //return strFinalString.Substring(2); return strFinalString; }
public static double tTest1Sample(double[] p, double m, Single Alpha, StatisticalTestTail Tail) { if ((Alpha > 1) || (Alpha < 0)) throw new Exception("Wronge Alpha for tTest: " + Alpha.ToString()); double pValue = 0; double xmean = Mean(p); double STDp = Math.Sqrt(Variance(p)); double ser = STDp / Math.Sqrt(p.Length); double tval = (xmean - m) / ser; // Compute the correct p-value for the test, and confidence intervals if requested. switch(Tail) { case StatisticalTestTail.Both: pValue = 2 * TCDF(-Math.Abs(tval), p.Length - 1); //if nargout > 2 // crit = tinv((1 - alpha / 2), samplesize - 1) .* ser; // ci = [(xmean - crit) (xmean + crit)]; break; case StatisticalTestTail.Left: pValue = TCDF(-tval, p.Length - 1); //if nargout > 2 // crit = tinv(1 - alpha, samplesize - 1) .* ser; // ci = [(xmean - crit), Inf]; break; case StatisticalTestTail.Right: pValue = TCDF(tval, p.Length - 1); //if nargout > 2 // crit = tinv(1 - alpha, samplesize - 1) .* ser; // ci = [-Inf, (xmean + crit)]; break; } //// Determine if the actual significance exceeds the desired significance //if p <= alpha // h = 1; //elseif p > alpha // h = 0; //else // isnan(p) must be true // h = NaN; //end return pValue; }
public static double tTestPaired(double[] p1, double[] p2, Single Alpha, StatisticalTestTail Tail) { double pValue=0; if ((Alpha>1)||(Alpha<0)) throw new Exception("Wronge Alpha for tTest: " + Alpha.ToString()); if(p1.Length!=p2.Length) throw new Exception("In a paired tTest two samples must have equal length!"); for (int i = 0; i < p1.GetLength(0); i++) { p1[i] = p1[i] - p2[i]; } int m = 0; int samplesize = p1.Length; int df = samplesize - 1; double xmean = Mean(p1); double sdpop = Math.Sqrt(Variance(p1)); //Ali added this to avoid division by zero if (sdpop == 0) sdpop = Double.MinValue; double ser = sdpop / Math.Sqrt(samplesize); double tval = (xmean - m) / ser; switch (Tail) { case StatisticalTestTail.Both: pValue = 2 * TCDF(-Math.Abs(tval), df); //if nargout > 2 // crit = tinv((1 - alpha / 2), samplesize - 1) .* ser; // ci = [(xmean - crit) (xmean + crit)]; //end break; case StatisticalTestTail.Right: pValue = TCDF(-tval, df); //if nargout > 2 // crit = tinv(1 - alpha, samplesize - 1) .* ser; // ci = [(xmean - crit), Inf]; //end break; case StatisticalTestTail.Left: pValue = TCDF(tval, df); //if nargout > 2 // crit = tinv(1 - alpha, samplesize - 1) .* ser; // ci = [-Inf, (xmean + crit)]; //end break; } //if (((xmean-m) == 0) && (ser == 0)) { pValue = 10; return pValue; } // ALI: if there is no difference between means of two samples or sd is zero these are not different or at least test is impossible (2006-02-09 ASHOORA!) //// Determine if the actual significance exceeds the desired significance //if p <= alpha // h = 1; //elseif p > alpha // h = 0; //else // isnan(p) must be true // h = NaN; //end return pValue; }
public override void OnInspectorGUI() { EditorGUILayout.ObjectField("组件", cs.comp, typeof(UnityEngine.Object)); if (cs.propList.Count != propValList.Count) { SyncPropVal(); } else { for (int i = 0; i < cs.propList.Count; ++i) { if (cs.propList[i].Value.Count != propValList[i].Value.Count) { SyncPropVal(); break; } } } EditorGUILayout.BeginVertical("helpbox"); extraCompName = EditorGUILayout.TextField("额外组件类型(类名)", extraCompName); EditorGUILayout.SelectableLabel(string.IsNullOrEmpty(finalCompName)?"没有此类型!":finalCompName); EditorGUILayout.EndVertical(); if (GUILayout.Button("GetComponents")) { if (preExtra != extraCompName || string.IsNullOrEmpty(finalCompName)) { finalCompName = getQualifiedName(extraCompName); } preExtra = extraCompName; List <string> compTypeList = new List <string>(defaultCompTypeList); if (!string.IsNullOrEmpty(finalCompName) && !compTypeList.Contains(finalCompName)) { compTypeList.Add(finalCompName); } RemoteGameObjectControl.RemoteGetComponent(cs.gameObject, compTypeList); } for (int i = 0; i < cs.propList.Count; ++i) { EditorGUILayout.BeginVertical("helpbox"); EditorGUILayout.LabelField(cs.propList[i].Key); for (int j = 0; j < cs.propList[i].Value.Count; ++j) { KeyValuePair <string, KeyValuePair <string, KeyValuePair <string, string> > > kvp = cs.propList[i].Value[j]; bool bCanWrite = false; bool.TryParse(kvp.Value.Value.Key, out bCanWrite); string propType = kvp.Value.Key; if (notSupportEditTypeList.Contains(propType)) { bCanWrite = false; } EditorGUI.BeginDisabledGroup(!bCanWrite); string val = propValList[i].Value[j]; if ("UnityEngine.Color" == propType) { Color cVal = Color.clear; if (TypeOpe.ColorTryParse(val, out cVal)) { cVal = EditorGUILayout.ColorField(kvp.Key, cVal); propValList[i].Value[j] = TypeOpe.TypeToString(propType, (object)cVal); } else { propValList[i].Value[j] = EditorGUILayout.TextField(kvp.Key + "(" + kvp.Value.Key + ")", val); } } else if ("UnityEngine.Vector2" == propType) { Vector2 vVal = Vector2.zero; if (TypeOpe.Vector2TryParse(val, out vVal)) { vVal = EditorGUILayout.Vector2Field(kvp.Key, vVal); propValList[i].Value[j] = TypeOpe.TypeToString(propType, (object)vVal); } else { propValList[i].Value[j] = EditorGUILayout.TextField(kvp.Key + "(" + kvp.Value.Key + ")", val); } } else if ("UnityEngine.Vector3" == propType) { Vector3 vVal = Vector3.zero; if (TypeOpe.Vector3TryParse(val, out vVal)) { vVal = EditorGUILayout.Vector3Field(kvp.Key, vVal); propValList[i].Value[j] = TypeOpe.TypeToString(propType, (object)vVal); } else { propValList[i].Value[j] = EditorGUILayout.TextField(kvp.Key + "(" + kvp.Value.Key + ")", val); } } else if ("UnityEngine.Vector4" == propType) { Vector4 vVal = Vector4.zero; if (TypeOpe.Vector4TryParse(val, out vVal)) { vVal = EditorGUILayout.Vector4Field(kvp.Key, vVal); propValList[i].Value[j] = TypeOpe.TypeToString(propType, (object)vVal); } else { propValList[i].Value[j] = EditorGUILayout.TextField(kvp.Key + "(" + kvp.Value.Key + ")", val); } } else if ("UnityEngine.Rect" == propType) { Rect vVal = new Rect(0f, 0f, 0f, 0f); if (TypeOpe.RectTryParse(val, out vVal)) { vVal = EditorGUILayout.RectField(kvp.Key, vVal); propValList[i].Value[j] = TypeOpe.TypeToString(propType, (object)vVal); } else { propValList[i].Value[j] = EditorGUILayout.TextField(kvp.Key + "(" + kvp.Value.Key + ")", val); } } else if ("System.Boolean" == propType) { System.Boolean bVal = false; if (System.Boolean.TryParse(val, out bVal)) { bVal = EditorGUILayout.Toggle(kvp.Key, bVal); propValList[i].Value[j] = bVal.ToString(); } else { propValList[i].Value[j] = EditorGUILayout.TextField(kvp.Key + "(" + kvp.Value.Key + ")", val); } } else if ("System.Single" == propType) { System.Single fVal = 0f; if (System.Single.TryParse(val, out fVal)) { fVal = EditorGUILayout.FloatField(kvp.Key, fVal); propValList[i].Value[j] = fVal.ToString(); } else { propValList[i].Value[j] = EditorGUILayout.TextField(kvp.Key + "(" + kvp.Value.Key + ")", val); } } else if ("System.Int32" == propType || "System.UInt32" == propType) { System.Int32 iVal = 0; if (System.Int32.TryParse(val, out iVal)) { iVal = EditorGUILayout.IntField(kvp.Key, iVal); propValList[i].Value[j] = iVal.ToString(); } else { propValList[i].Value[j] = EditorGUILayout.TextField(kvp.Key + "(" + kvp.Value.Key + ")", val); } } else { propValList[i].Value[j] = EditorGUILayout.TextField(kvp.Key + "(" + kvp.Value.Key + ")", val); } EditorGUI.EndDisabledGroup(); } EditorGUILayout.EndVertical(); } if (GUILayout.Button("submit")) { string compStr = ""; ComponentSimulator.encode(out compStr, cs.propList, propValList); RemoteGameObjectControl.RemoteSetComponent(cs.gameObject, compStr); } /* * if (GUILayout.Button("submit0")) * { * string compStr = ""; * ComponentSimulator.encode(out compStr, cs.comp.name, cs.propList, propValList); * List<KeyValuePair<string, KeyValuePair<string, string>>> propList = null; * ComponentSimulator.decode(ref propList, compStr); * * Type type = Type.GetType("UnityEngine.ParticleSystem, UnityEngine"); * if (null == type) * { * return; * } * PropertyInfo[] pis = type.GetProperties(BindingFlags.Public | BindingFlags.Instance); * for (int j = 0; j < pis.Length; ++j) * { * if (!pis[j].CanWrite || !pis[j].CanRead) * continue; * * int idx = propList.FindIndex(p => p.Key == pis[j].Name); * if (-1 == idx) * continue; * * MethodInfo mi = pis[j].GetSetMethod(); * Type propType = pis[j].PropertyType; * object[] val = null; * if (typeof(System.Single) == propType) * { * System.Single tmp; * if (System.Single.TryParse(propList[idx].Value.Value, out tmp)) * val = new object[] { tmp }; * else * continue; * } * else if (typeof(System.Boolean) == propType) * { * System.Boolean tmp; * if (System.Boolean.TryParse(propList[idx].Value.Value, out tmp)) * val = new object[] { tmp }; * else * continue; * } * else if (typeof(System.Int32) == propType) * { * System.Int32 tmp; * if (System.Int32.TryParse(propList[idx].Value.Value, out tmp)) * val = new object[] { tmp }; * else * continue; * } * else if (typeof(System.UInt32) == propType) * { * System.UInt32 tmp; * if (System.UInt32.TryParse(propList[idx].Value.Value, out tmp)) * val = new object[] { tmp }; * else * continue; * } * else if (typeof(System.String) == propType) * { * val = new object[] { propList[idx].Value.Value }; * } * else * continue; * * try * { * mi.Invoke(cs.comp, val); * } * catch (Exception e) * { * Debug.Log(e.ToString()); * } * } * } */ }
public string ToString(int accuracy) { return(string.Format("[{0}, {1}]", _x.ToString(string.Format("f{0}", accuracy)), _y.ToString(string.Format("f{0}", accuracy)))); }
/// <devdoc> /// <para>[To be supplied.]</para> /// </devdoc> protected virtual void GenerateSingleFloatValue(Single s) { Output.Write(s.ToString("R", CultureInfo.InvariantCulture)); }
/// <summary> /// Public constructor that accepts a value of type single /// </summary> /// <param name="value">single (System.Single) value</param> public JSONNumberValue(Single value) : this(value.ToString("E", JSONNumberValue.JavaScriptNumberFormatInfo)) { }
/// <summary>Perform - binary operation</summary> /// <param name="lhs">Left hand side operand</param> /// <param name="rhs">Right hand side operand</param> /// <returns>result of operation</returns> private operandType subtractValues(operandType lhs, operandType rhs) { expression.Text = lhs.ToString() + " - " + rhs.ToString(); return(lhs - rhs); }
/// <summary>Perform + binary operation</summary> /// <param name="lhs">Left hand side operand</param> /// <param name="rhs">Right hand side operand</param> /// <returns>result of operation</returns> private operandType addValues(operandType lhs, operandType rhs) { expression.Text = lhs.ToString() + " + " + rhs.ToString(); return(lhs + rhs); }
public string ToString(string f) { return(string.Concat("{ ", "\"X\": " + X.ToString(f), ", ", "\"Y\": " + Y.ToString(f), ", ", "\"Z\": " + Z.ToString(f), " }")); }
/// <summary>Perform sqrt on operand</summary> /// <param name="lhs">operand value from left hand side field</param> /// <returns>result of operation</returns> private operandType sqrtLhsValue(operandType lhs) { expression.Text = "sqrt(" + lhs.ToString() + ")"; return(Convert.ToSingle(System.Math.Sqrt(lhs))); }
/// <summary>Perform % binary operation</summary> /// <param name="lhs">Left hand side operand</param> /// <param name="rhs">Right hand side operand</param> /// <returns>result of operation</returns> private operandType remainderValues(operandType lhs, operandType rhs) { expression.Text = lhs.ToString() + " % " + rhs.ToString(); return(lhs % rhs); }
/// <summary>Converts the value from <c>Single</c> to an equivalent <c>SqlString</c> value.</summary> public static SqlString ToSqlString(Single p) { return p.ToString(); }
public static void SetFloat(String key, Single value) { SetSettingRaw(key, value.ToString(CultureInfo.InvariantCulture), "float"); }
/// <summary> /// Converts the value of the specified nullable single-precision floating point number to its equivalent SqlString representation. /// </summary> /// <param name="value">A nullable single-precision floating point number.</param> /// <returns>The SqlString equivalent of the nullable single-precision floating point number.</returns> public static SqlString ToSqlString(Single? value) { return value.HasValue ? value.ToString() : SqlString.Null; }
public void AddValue(string protocolKey, Single value) { m_protocolText.Add(protocolKey + ProtocolKey.EqualSign + value.ToString()); }
public static BigInteger ToBigInteger(Single value) { return BigInteger.Parse(value.ToString("#")); }
public void Rule12(float dt, World world){ switch (s12) { case -1: if(Planet.Owner.IsSome) { goto case 34; }else { goto case 35; } case 34: ___res120 = ((3f) / (((1f) + (((0.05f) * (Productivity)))))); NextShipInText = ___res120.ToString("0.##"); s12 = -1; return; case 35: NextShipInText = ""; s12 = -1; return; default: return;}}
/// <summary>Perform / binary operation</summary> /// <param name="lhs">Left hand side operand</param> /// <param name="rhs">Right hand side operand</param> /// <returns>result of operation</returns> private operandType divideValues(operandType lhs, operandType rhs) { expression.Text = lhs.ToString() + " / " + rhs.ToString(); return(lhs / rhs); }
public void Rule13(float dt, World world){ switch (s13) { case -1: ___AttackRound130 = ((UnityEngine.Mathf.Round((Attack) * (10f))) / (10f)); ___DefenseRound130 = ((UnityEngine.Mathf.Round((Defense) * (10f))) / (10f)); ___ProductivityRound130 = ((UnityEngine.Mathf.Round((Productivity) * (10f))) / (10f)); ___ResearchRound130 = ((UnityEngine.Mathf.Round((Research) * (10f))) / (10f)); AttackText = ___AttackRound130.ToString(); DefenseText = ___DefenseRound130.ToString(); ProductivityText = ___ProductivityRound130.ToString(); ResearchText = ___ResearchRound130.ToString(); s13 = -1; return; default: return;}}
public static double tTest2Samples(int[] p1, int[] p2, Single Alpha, StatisticalTestTail Tail, bool EqualVarianceAssumed) { double pValue = 0; if ((Alpha>1)||(Alpha<0)) throw new Exception("Wronge Alpha for tTest: " + Alpha.ToString()); double DegreeofFreedom = 0; double sPooled = 0; double p1Variance = 0; double p2Variance = 0; double se = 0; double ratio = 0; double difference = 0; difference = Mean(p1) - Mean(p2); p1Variance = Variance(p1); p2Variance = Variance(p2); // Ali: I added this to prevent devide by zero error in zero vaiances if (p1Variance == 0) p1Variance = 0.000001f; if (p2Variance == 0) p2Variance = 0.000001f; // Ali if (EqualVarianceAssumed) { DegreeofFreedom = p1.Length + p2.Length - 2; sPooled = Math.Sqrt(((p1.Length-1) * p1Variance + (p2.Length-1) * p2Variance) / DegreeofFreedom); se = sPooled * Math.Sqrt(1.0f/p1.Length + 1.0f/p2.Length); ratio = difference / se; } else // Not EqualVarianceAssumed { double P1VBar = p1Variance / p1.Length; double P2VBar = p2Variance / p2.Length; DegreeofFreedom = Math.Pow((P1VBar + P2VBar),2) / (Math.Pow(P1VBar,2) / (p1.Length-1) + Math.Pow(P2VBar,2) / (p2.Length-1)); se = Math.Sqrt(P1VBar + P2VBar); ratio = difference / se; } // Compute the correct p-value for the test, and confidence intervals if requested. switch(Tail) { case StatisticalTestTail.Both : pValue = 2 * TCDF(-Math.Abs(ratio),DegreeofFreedom); //spread = tinv(1 - alpha ./ 2, DegreeofFreedom) .* se; //ci = [(difference - spread) (difference + spread)]; break; case StatisticalTestTail.Left : pValue = TCDF(ratio,DegreeofFreedom); // if nargout > 2 // spread = tinv(1 - alpha, dfe) .* se; // ci = [-Inf, (difference + spread)]; break; case StatisticalTestTail.Right: pValue = TCDF(-ratio,DegreeofFreedom); // if nargout > 2 // spread = tinv(1 - alpha, dfe) .* se; // ci = [(difference - spread), Inf]; break; } // Determine if the actual significance exceeds the desired significance //if (p <= alpha) // h = 1; //else p > alpha // h = 0; //else // isnan(p) must be true // h = NaN; //end return pValue; }
public void Rule3(float dt, World world){ switch (s3) { case -1: ___debug230 = AttackingShips.Count.ToString(); ___AmountOfAttackingShips30 = ( (AttackingShips).Select(__ContextSymbol200 => new { ___i35 = __ContextSymbol200 }) .Where(__ContextSymbol201 => ((NextPossibleOwner.IsSome) && (((__ContextSymbol201.___i35.BaseShip.Owner) == (NextPossibleOwner.Value))))) .Select(__ContextSymbol202 => __ContextSymbol202.___i35.BaseShip.AmountOfShips) .Aggregate(default(System.Int32), (acc, __x) => acc + __x)); if(((((Planet.LandedShips) > (0))) && (((AttackingShips.Count) > (0))))) { goto case 2; }else { goto case 3; } case 2: count_down4 = 1f; goto case 19; case 19: if(((count_down4) > (0f))) { count_down4 = ((count_down4) - (dt)); s3 = 19; return; }else { goto case 17; } case 17: ___RandomNumber30 = UnityEngine.Random.Range(3f,7f); ___FlankingBonus30 = ((((1f) + (((0.3f) * (AttackingShips.Count))))) - (0.3f)); ___DamageFormula30 = ((((((((((System.Single)___AmountOfAttackingShips30)) * (6f))) * (___RandomNumber30))) * (___FlankingBonus30))) / (500f)); UnityEngine.Debug.Log(("Predamage ") + ((((((System.Single)___AmountOfAttackingShips30)) * (6f)) * (___RandomNumber30)) * (___FlankingBonus30))); ___FlankingBonusDebug30 = ___FlankingBonus30.ToString(); UnityEngine.Debug.Log(("FlankingBonus ") + (___FlankingBonus30)); ___res31 = ((System.Int32)___DamageFormula30); ___Damage30 = ((___res31) + (1)); if(((Planet.LandedShips) > (___Damage30))) { goto case 5; }else { goto case 6; } case 5: Planet.LandedShips = ((Planet.LandedShips) - (___Damage30)); Planet.Owner = Planet.Owner; s3 = -1; return; case 6: Planet.LandedShips = 0; Planet.Owner = Planet.Owner; s3 = -1; return; case 3: if(((((((Planet.LandedShips) == (0))) && (((AttackingShips.Count) > (0))))) && (NextPossibleOwner.IsSome))) { goto case 21; }else { s3 = -1; return; } case 21: ___new_attackingShips30 = ( (AttackingShips).Select(__ContextSymbol204 => new { ___i36 = __ContextSymbol204 }) .Where(__ContextSymbol205 => !(((__ContextSymbol205.___i36.BaseShip.Owner) == (NextPossibleOwner.Value)))) .Select(__ContextSymbol206 => __ContextSymbol206.___i36) .ToList<AttackingShip>()).ToList<AttackingShip>(); if(((___new_attackingShips30.Count) > (0))) { goto case 22; }else { goto case 23; } case 22: Planet.LandedShips = ___AmountOfAttackingShips30; Planet.Owner = (new Just<Commander>(NextPossibleOwner.Value)); s3 = -1; return; case 23: Planet.LandedShips = ___AmountOfAttackingShips30; Planet.Owner = (new Just<Commander>(NextPossibleOwner.Value)); s3 = -1; return; default: return;}}
private void GenerateSingleFloatValue(Single s) { if( float.IsNaN(s)) { Output.Write("float.NaN"); } else if( float.IsNegativeInfinity(s)) { Output.Write("float.NegativeInfinity"); } else if( float.IsPositiveInfinity(s)) { Output.Write("float.PositiveInfinity"); } else { Output.Write(s.ToString(CultureInfo.InvariantCulture)); Output.Write('F'); } }
/// <summary> /// Implemented /// </summary> public void DrawBezier(Pen pen, Single x1, Single y1, Single x2, Single y2, Single x3, Single y3, Single x4, Single y4) { SvgPathElement bez = new SvgPathElement(); bez.D = "M " + x1.ToString() + " " + y1.ToString() + " C " + x2.ToString() + " " + y2.ToString() + " " + x3.ToString() + " " + y3.ToString() + " " + x4.ToString() + " " + y4.ToString(); bez.Style = new SvgStyle(pen); if (!_transforms.Result.IsIdentity) bez.Transform = new SvgTransformList(_transforms.Result.Clone()); _cur.AddChild(bez); }
private void WriteDouble(Single value) { stream.WriteByte(PHPSerializationTag.Double); stream.WriteByte(PHPSerializationTag.Colon); WriteNumber((Single.IsNaN(value) ? "NAN" : (Single.IsPositiveInfinity(value) ? "INF" : (Single.IsNegativeInfinity(value) ? "-INF" : value.ToString())))); stream.WriteByte(PHPSerializationTag.Semicolon); }
public static void SetSens(System.Single vol) { instance.sens = vol; instance.txt.text = vol.ToString(); }
public void AddDebugInfoLine(String name, Single data) { DebugInfoBuilder.Append(name); DebugInfoBuilder.Append(DebugInfoSeparator); DebugInfoBuilder.Append(data.ToString()); DebugInfoBuilder.AppendLine(); }
/// <summary> /// Returns the actual value in formatted form with the quantity suffixed /// </summary> /// <param name="format">Format string to display the value with</param> /// <returns>A <see cref="T:System.String"/> containing a the actual value in formatted form with the quantity symbol appended</returns> public string ToString(string format) { return(String.Format("{0} {1}", mAmount.ToString(format), mUnit.Symbol).Trim()); }
/// <summary>Converts the value from <c>Single?</c> to an equivalent <c>SqlChars</c> value.</summary> public static SqlChars ToSqlChars(Single? p) { return p.HasValue? new SqlChars(p.ToString().ToCharArray()): SqlChars.Null; }
/// <summary> /// Calculates the value this animation believes should be the current value for the property. /// </summary> /// <param name="defaultOriginValue"> /// This value is the suggested origin value provided to the animation /// to be used if the animation does not have its own concept of a /// start value. If this animation is the first in a composition chain /// this value will be the snapshot value if one is available or the /// base property value if it is not; otherise this value will be the /// value returned by the previous animation in the chain with an /// animationClock that is not Stopped. /// </param> /// <param name="defaultDestinationValue"> /// This value is the suggested destination value provided to the animation /// to be used if the animation does not have its own concept of an /// end value. This value will be the base value if the animation is /// in the first composition layer of animations on a property; /// otherwise this value will be the output value from the previous /// composition layer of animations for the property. /// </param> /// <param name="animationClock"> /// This is the animationClock which can generate the CurrentTime or /// CurrentProgress value to be used by the animation to generate its /// output value. /// </param> /// <returns> /// The value this animation believes should be the current value for the property. /// </returns> protected override Single GetCurrentValueCore(Single defaultOriginValue, Single defaultDestinationValue, AnimationClock animationClock) { Debug.Assert(animationClock.CurrentState != ClockState.Stopped); if (!_isAnimationFunctionValid) { ValidateAnimationFunction(); } double progress = animationClock.CurrentProgress.Value; IEasingFunction easingFunction = EasingFunction; if (easingFunction != null) { progress = easingFunction.Ease(progress); } Single from = new Single(); Single to = new Single(); Single accumulated = new Single(); Single foundation = new Single(); // need to validate the default origin and destination values if // the animation uses them as the from, to, or foundation values bool validateOrigin = false; bool validateDestination = false; switch(_animationType) { case AnimationType.Automatic: from = defaultOriginValue; to = defaultDestinationValue; validateOrigin = true; validateDestination = true; break; case AnimationType.From: from = _keyValues[0]; to = defaultDestinationValue; validateDestination = true; break; case AnimationType.To: from = defaultOriginValue; to = _keyValues[0]; validateOrigin = true; break; case AnimationType.By: // According to the SMIL specification, a By animation is // always additive. But we don't force this so that a // user can re-use a By animation and have it replace the // animations that precede it in the list without having // to manually set the From value to the base value. to = _keyValues[0]; foundation = defaultOriginValue; validateOrigin = true; break; case AnimationType.FromTo: from = _keyValues[0]; to = _keyValues[1]; if (IsAdditive) { foundation = defaultOriginValue; validateOrigin = true; } break; case AnimationType.FromBy: from = _keyValues[0]; to = AnimatedTypeHelpers.AddSingle(_keyValues[0], _keyValues[1]); if (IsAdditive) { foundation = defaultOriginValue; validateOrigin = true; } break; default: Debug.Fail("Unknown animation type."); break; } if (validateOrigin && !AnimatedTypeHelpers.IsValidAnimationValueSingle(defaultOriginValue)) { throw new InvalidOperationException( SR.Get( SRID.Animation_Invalid_DefaultValue, this.GetType(), "origin", defaultOriginValue.ToString(CultureInfo.InvariantCulture))); } if (validateDestination && !AnimatedTypeHelpers.IsValidAnimationValueSingle(defaultDestinationValue)) { throw new InvalidOperationException( SR.Get( SRID.Animation_Invalid_DefaultValue, this.GetType(), "destination", defaultDestinationValue.ToString(CultureInfo.InvariantCulture))); } if (IsCumulative) { double currentRepeat = (double)(animationClock.CurrentIteration - 1); if (currentRepeat > 0.0) { Single accumulator = AnimatedTypeHelpers.SubtractSingle(to, from); accumulated = AnimatedTypeHelpers.ScaleSingle(accumulator, currentRepeat); } } // return foundation + accumulated + from + ((to - from) * progress) return AnimatedTypeHelpers.AddSingle( foundation, AnimatedTypeHelpers.AddSingle( accumulated, AnimatedTypeHelpers.InterpolateSingle(from, to, progress))); }
/// <summary> /// Converts the value of the specified nullable single-precision floating point number to the equivalent SqlChars representation. /// </summary> /// <param name="value">A nullable single-precision floating point number.</param> /// <returns>The equivalent SqlChars.</returns> public static SqlChars ToSqlChars(Single? value) { return value.HasValue ? new SqlChars(value.ToString().ToCharArray()) : SqlChars.Null; }
public static void UpdateAttribute(XmlElement element, string attributeName, Single newValue) { UpdateAttribute(element, attributeName, newValue.ToString()); }
/// <summary> /// Converts the value of the specified single-precision floating point number to its equivalent String representation. /// </summary> /// <param name="value">A single-precision floating point number.</param> /// <returns>The String equivalent of the single-precision floating point number.</returns> public static String ToString(Single value) { return value.ToString(); }
/// <summary> /// Fromatira količinu robe preostale za sken. /// </summary> /// <param name="preostaloZaSken">Količina robe preostala za sken</param> /// <returns>Formatirana količina robe preostala za sken.</returns> private string PreostaloZaSken(Single preostaloZaSken) { string pZaSken = String.Empty; if (preostaloZaSken == 0) { pZaSken = "0"; } else { pZaSken = preostaloZaSken.ToString(); } return pZaSken; }
public static Mono.Math.BigInteger ToMonoBigInteger(Single value) { return Mono.Math.BigInteger.Parse(value.ToString("#")); }
/// <summary> /// Gibt die größe einer Datei in einem formatiertem String wieder. /// </summary> /// <param name="lenght">Die Größe der Datei in Bytes</param> /// <returns></returns> public static string GetFileSize(Single lenght) { try { if (lenght < 1024) { return string.Format("{0} Bytes", lenght.ToString()); } if (lenght > 1023 && lenght < 1048576) { Single c_lenght = lenght/1024; return string.Format("{0} KB", c_lenght.ToString("###0.00")); } if (lenght >= 1048576 && lenght <= 1043741825) { Single c_lenght = lenght/(float) (Math.Pow(1024, 2)); return string.Format("{0} MB", c_lenght.ToString("###0.00")); } return "0 Bytes"; } catch { return "0 Bytes"; } }
public void updateText(System.Single val) { powerText.text = val.ToString(); }
public void UpdateValue(System.Single newValue) { text.text = newValue.ToString("F2"); }
/// <summary> /// Print a control (not is children). Call the print function depending of the type of the control /// </summary> /// <param name="c"></param> /// <param name="mp"></param> /// <param name="x"></param> /// <param name="y"></param> /// <param name="extendedHeight"></param> public void PrintOneControl(System.Windows.Forms.Control c, ParentControlPrinting typePrint, MultiPageManagement mp, Single x, Single y, ref Single extendedHeight, out bool ScanForChildControls) { // Silver color if disable if (c.Enabled || !DisabledControlsInGray) { _Pen = new Pen(Color.Black); _Brush = Brushes.Black; } else { _Pen = new Pen(Color.Silver); _Brush = Brushes.Silver; } ScanForChildControls = true; string s = c.GetType().ToString(); bool founded = false; //First check if it's a text box like control if (!founded) foreach (string sType in _TextBoxLikeControl) if (s.IndexOf(sType) >= 0) { Single h; h = mp.FontHeight(new Font(c.Font.Name, c.Font.Size)); extendedHeight = mp.BeginPrintUnit(y, h); PrintText(c, mp, x, y, TextBoxBoxed, false, TextBoxBoxed, HorizontalAlignment.Left); mp.EndPrintUnit(); founded = true; ScanForChildControls = false; break; } //Process other type of control, beginning at the end of the list (use last add for a type) if (!founded) for (int i = _DelegatesforControls.Count-1; i>=0; i--) // from end to the beginning { _DelegateforControls d = (_DelegateforControls) _DelegatesforControls[i]; if (s.EndsWith(d.typ)) { d.PrintFunction(c, typePrint, mp, x, y, ref extendedHeight, out ScanForChildControls); break; } } _traceLog.Append(_indent.ToString() + " - " + typePrint.ToString() + " " + s + " (" + c.Text + ":" + c.Name + ") X=" + x.ToString() + " Y=" + y.ToString() + " H=" + c.Height.ToString() + " + " + extendedHeight.ToString()+ System.Environment.NewLine); }
/// <summary>Perform * binary operation</summary> /// <param name="lhs">Left hand side operand</param> /// <param name="rhs">Right hand side operand</param> /// <returns>result of operation</returns> private operandType multiplyValues(operandType lhs, operandType rhs) { expression.Text = lhs.ToString() + " * " + rhs.ToString(); return(checked (lhs * rhs)); }