title: How to emulate Excel's automatic rounding?
body: <p>When Excel reports the results of a floating point calculation, it appears to round it to the correct precision based on the significant digits in the input numbers. But if I include the result in a text string, it includes the full precision, including the floating point error:</p>
  <p><a href="https://i.stack.imgur.com/FR61Q.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/FR61Q.jpg" alt="enter image description here" /></a></p>
  <p>How can I get the text version to use the same rounding as Excel uses in displaying the number? I suppose I could calculate the maximum number of digits of precision of the input numbers and <code>round()</code> to that precision. Is there an easier/better way?</p>
  <p>Using Excel 2019.</p>