title: How do I specifically round to 9 numbers ignoring whether or not said number is significant or not
body: <pre><code>            if (Equation == &quot;.&quot; || Equation == &quot;&quot;)
                  Answer = double.NaN;
              else
                  Answer = (double)Equation.EvalNumerical();
  
              PreviousAnswerFlag = true;
              Equation = &quot;&quot;;
  
              Answer = double.Parse(Answer.ToString(&quot;G7&quot;, CultureInfo.InvariantCulture));
              OutputBox.Content = Answer;
  </code></pre>
  <p>I am building a calculator using WPF and because there is a set size to the window, the box used to output the answer cuts it off at a specific point (Around 9 numbers excluding negative and decimal symbols). Currently I am using a NuGet package to parse the Equation in string form into an answer and am using <code>.ToString()</code> to convert the number into its exponent but this happens at around 14 digits and cuts off when the answer goes above 999,999,999.</p>
  <p>I need something that will convert the number to exponential form after nine digits or something that will round the number to 9 digits that counts zeros (as <code>Math.Round ()</code> does significant figures, the number is not always 9 digits long because it doesn't count initial zeros). I also need this to work regardless or positive, negative or decimal.</p>