<rss xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" version="2.0">
  <channel>
    <title>MaplePrimes - answers and comments on Question, numeric format output</title>
    <link>http://www.mapleprimes.com/questions/119591-Numeric-Format-Output</link>
    <language>en-us</language>
    <copyright>2026 Maplesoft, A Division of Waterloo Maple Inc.</copyright>
    <generator>Maplesoft Document System</generator>
    <lastBuildDate>Fri, 12 Jun 2026 18:42:52 GMT</lastBuildDate>
    <pubDate>Fri, 12 Jun 2026 18:42:52 GMT</pubDate>
    <itunes:subtitle />
    <itunes:summary />
    <description>The latest answers and comments added to the Question, numeric format output</description>
    <image>
      <url>http://www.mapleprimes.com/images/mapleprimeswhite.jpg</url>
      <title>MaplePrimes - answers and comments on Question, numeric format output</title>
      <link>http://www.mapleprimes.com/questions/119591-Numeric-Format-Output</link>
    </image>
    <item>
      <title>Digits:=2</title>
      <link>http://www.mapleprimes.com/questions/119591-Numeric-Format-Output?ref=Feed:MaplePrimes:numeric format output:Comments#answer119593</link>
      <itunes:summary>&lt;p&gt;restart:Digits;&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 10&lt;br&gt;&lt;br&gt;10.0/50.0;&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.2000000000&lt;br&gt;&lt;br&gt;Digits:=2:10.0/50.0;&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.20&lt;br&gt;&lt;br&gt;&amp;nbsp;&lt;br&gt;&lt;br&gt;&lt;/p&gt;</itunes:summary>
      <description>&lt;p&gt;restart:Digits;&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 10&lt;br&gt;&lt;br&gt;10.0/50.0;&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.2000000000&lt;br&gt;&lt;br&gt;Digits:=2:10.0/50.0;&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.20&lt;br&gt;&lt;br&gt;&amp;nbsp;&lt;br&gt;&lt;br&gt;&lt;/p&gt;</description>
      <guid>119593</guid>
      <pubDate>Tue, 03 May 2011 23:44:29 Z</pubDate>
      <itunes:author>Kamel</itunes:author>
      <author>Kamel</author>
    </item>
    <item>
      <title>another way</title>
      <link>http://www.mapleprimes.com/questions/119591-Numeric-Format-Output?ref=Feed:MaplePrimes:numeric format output:Comments#answer119595</link>
      <itunes:summary>&lt;p&gt;evalf(10.0/50.0, 2);&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.20&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</itunes:summary>
      <description>&lt;p&gt;evalf(10.0/50.0, 2);&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.20&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description>
      <guid>119595</guid>
      <pubDate>Wed, 04 May 2011 00:42:51 Z</pubDate>
      <itunes:author>Christopher2222</itunes:author>
      <author>Christopher2222</author>
    </item>
    <item>
      <title>Removing trailing 0's</title>
      <link>http://www.mapleprimes.com/questions/119591-Numeric-Format-Output?ref=Feed:MaplePrimes:numeric format output:Comments#answer119596</link>
      <itunes:summary>&lt;p&gt;To remove all trailing 0's from a floating-point number, try this:&lt;/p&gt;
&lt;p&gt;&amp;gt; RemTZ:= proc(x:: float)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; parse(StringTools[RegSplit]("0+$",convert(x,string)))&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; end proc;&lt;br&gt;&lt;br&gt;For example:&lt;/p&gt;
&lt;p&gt;&amp;gt; RemTZ(123.456000);&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 123.456&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</itunes:summary>
      <description>&lt;p&gt;To remove all trailing 0's from a floating-point number, try this:&lt;/p&gt;
&lt;p&gt;&amp;gt; RemTZ:= proc(x:: float)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; parse(StringTools[RegSplit]("0+$",convert(x,string)))&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; end proc;&lt;br&gt;&lt;br&gt;For example:&lt;/p&gt;
&lt;p&gt;&amp;gt; RemTZ(123.456000);&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 123.456&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description>
      <guid>119596</guid>
      <pubDate>Wed, 04 May 2011 02:48:07 Z</pubDate>
      <itunes:author>Robert Israel</itunes:author>
      <author>Robert Israel</author>
    </item>
    <item>
      <title>display precision</title>
      <link>http://www.mapleprimes.com/questions/119591-Numeric-Format-Output?ref=Feed:MaplePrimes:numeric format output:Comments#answer119600</link>
      <itunes:summary>&lt;p&gt;Firstly, it's not clear whether you want the entire result rounded to just 2 or 3 decimal places (as a total for places both before and after the decimal point), or whether you want the number of places (only) after the decimal point to be restricted. Or something else. Your example is a bit too simple and allows for more than one interpretation.&lt;/p&gt;
&lt;p&gt;Supposing that you just want to restrict the number of displayed decimal figures after the decimal point, you can control that in two ways:&lt;/p&gt;
&lt;p&gt;The &lt;a href="http://www.maplesoft.com/support/help/Maple/view.aspx?path=worksheet/managing/OptionsDialogPrecision"&gt;first&lt;/a&gt; way, in the Standard GUI, is using the top menu to go to Tools -&amp;gt; Options, then select the "Precision" tab. Then check the box marked "Round screen display to" and type the number 2 in its entry box. The choose either the Apply to Session or the Apply Globally buttons to finsh, according to whether you want it done for every new worksheet or just the current one.&lt;/p&gt;
&lt;p&gt;You should also be able to do that by using the command&lt;/p&gt;
&lt;pre&gt;interface(displayprecision=2):
&lt;/pre&gt;
&lt;p&gt;which you could issue right inside the worksheet, at the beginning say. Or you could hide that command, using the top menu's Edit -&amp;gt; Startup Code, which would be one of the few ways to ensure that it applied for anyone else running the worksheet on another Maple installation. Or you could put it in your &lt;a href="http://www.maplesoft.com/support/help/Maple/view.aspx?path=worksheet/reference/initialization"&gt;initialization file&lt;/a&gt;, if you wanted it for all future sessions.&lt;/p&gt;
&lt;p&gt;I attach a worksheet with that command embedded already in its Startup Code. When you accept the auto-execute, and run its content, you should be able to see the output change to just 0.20 as you wrote it.&lt;/p&gt;
&lt;p&gt;&lt;a href="/view.aspx?sf=119600/382010/displayprecision.mw"&gt;displayprecision.mw&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Whatever you do, do not set Digits low (not lower than 5, ever). That is not a good way to get this done. You could compute the float result at default Digits=10, with output suppressed using a full colon to terminate the command. And then afterwards evalf[2](...) that prior numeric value so as to display it how you describe. Or you could use the printf command to format it with full control over the displayed digits. But a lot of Maple's numerics breaks down pretty hard when Digits is set lower than 4 or so. You can end up with results whose last digit is wrong by more than 1 unit. You probably don't want such inaccuracy. Much better to &lt;em&gt;compute&lt;/em&gt; at least at default working precision, and only &lt;em&gt;display&lt;/em&gt; at lower precision.&lt;/p&gt;</itunes:summary>
      <description>&lt;p&gt;Firstly, it's not clear whether you want the entire result rounded to just 2 or 3 decimal places (as a total for places both before and after the decimal point), or whether you want the number of places (only) after the decimal point to be restricted. Or something else. Your example is a bit too simple and allows for more than one interpretation.&lt;/p&gt;
&lt;p&gt;Supposing that you just want to restrict the number of displayed decimal figures after the decimal point, you can control that in two ways:&lt;/p&gt;
&lt;p&gt;The &lt;a href="http://www.maplesoft.com/support/help/Maple/view.aspx?path=worksheet/managing/OptionsDialogPrecision"&gt;first&lt;/a&gt; way, in the Standard GUI, is using the top menu to go to Tools -&amp;gt; Options, then select the "Precision" tab. Then check the box marked "Round screen display to" and type the number 2 in its entry box. The choose either the Apply to Session or the Apply Globally buttons to finsh, according to whether you want it done for every new worksheet or just the current one.&lt;/p&gt;
&lt;p&gt;You should also be able to do that by using the command&lt;/p&gt;
&lt;pre&gt;interface(displayprecision=2):
&lt;/pre&gt;
&lt;p&gt;which you could issue right inside the worksheet, at the beginning say. Or you could hide that command, using the top menu's Edit -&amp;gt; Startup Code, which would be one of the few ways to ensure that it applied for anyone else running the worksheet on another Maple installation. Or you could put it in your &lt;a href="http://www.maplesoft.com/support/help/Maple/view.aspx?path=worksheet/reference/initialization"&gt;initialization file&lt;/a&gt;, if you wanted it for all future sessions.&lt;/p&gt;
&lt;p&gt;I attach a worksheet with that command embedded already in its Startup Code. When you accept the auto-execute, and run its content, you should be able to see the output change to just 0.20 as you wrote it.&lt;/p&gt;
&lt;p&gt;&lt;a href="/view.aspx?sf=119600/382010/displayprecision.mw"&gt;displayprecision.mw&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Whatever you do, do not set Digits low (not lower than 5, ever). That is not a good way to get this done. You could compute the float result at default Digits=10, with output suppressed using a full colon to terminate the command. And then afterwards evalf[2](...) that prior numeric value so as to display it how you describe. Or you could use the printf command to format it with full control over the displayed digits. But a lot of Maple's numerics breaks down pretty hard when Digits is set lower than 4 or so. You can end up with results whose last digit is wrong by more than 1 unit. You probably don't want such inaccuracy. Much better to &lt;em&gt;compute&lt;/em&gt; at least at default working precision, and only &lt;em&gt;display&lt;/em&gt; at lower precision.&lt;/p&gt;</description>
      <guid>119600</guid>
      <pubDate>Wed, 04 May 2011 05:46:52 Z</pubDate>
      <itunes:author>pagan</itunes:author>
      <author>pagan</author>
    </item>
    <item>
      <title>Be careful!</title>
      <link>http://www.mapleprimes.com/questions/119591-Numeric-Format-Output?ref=Feed:MaplePrimes:numeric format output:Comments#answer119606</link>
      <itunes:summary>&lt;p&gt;Be careful.&lt;/p&gt;
&lt;p&gt;Using&amp;nbsp; evalf or Digits affects the number digits used to perform the floating-point computations. While this will work most of the time, there are times when it will lead to problems.&lt;/p&gt;
&lt;p&gt;If it's really only the display you are trying to control, the comments about displayprecision are appropriate. An older way of managing this is to use either fnormal or printf (or one of its cousins: fprintf, sprintf, nprintf. Please consult the online help for explicit syntax and examples.&lt;/p&gt;
&lt;p&gt;Good luck!&lt;/p&gt;
&lt;!--break--&gt;
&lt;p&gt;Doug&lt;/p&gt;
&lt;pre&gt;---------------------------------------------------------------------
Douglas B. Meade  &amp;lt;&amp;gt;&amp;lt;
Math, USC, Columbia, SC 29208  E-mail: mailto:meade@math.sc.edu
Phone:  (803) 777-6183         URL:    http://www.math.sc.edu
&lt;/pre&gt;</itunes:summary>
      <description>&lt;p&gt;Be careful.&lt;/p&gt;
&lt;p&gt;Using&amp;nbsp; evalf or Digits affects the number digits used to perform the floating-point computations. While this will work most of the time, there are times when it will lead to problems.&lt;/p&gt;
&lt;p&gt;If it's really only the display you are trying to control, the comments about displayprecision are appropriate. An older way of managing this is to use either fnormal or printf (or one of its cousins: fprintf, sprintf, nprintf. Please consult the online help for explicit syntax and examples.&lt;/p&gt;
&lt;p&gt;Good luck!&lt;/p&gt;
&lt;!--break--&gt;
&lt;p&gt;Doug&lt;/p&gt;
&lt;pre&gt;---------------------------------------------------------------------
Douglas B. Meade  &amp;lt;&amp;gt;&amp;lt;
Math, USC, Columbia, SC 29208  E-mail: mailto:meade@math.sc.edu
Phone:  (803) 777-6183         URL:    http://www.math.sc.edu
&lt;/pre&gt;</description>
      <guid>119606</guid>
      <pubDate>Wed, 04 May 2011 09:41:47 Z</pubDate>
      <itunes:author>Doug Meade</itunes:author>
      <author>Doug Meade</author>
    </item>
    <item>
      <title>striptrailing</title>
      <link>http://www.mapleprimes.com/questions/119591-Numeric-Format-Output?ref=Feed:MaplePrimes:numeric format output:Comments#answer123277</link>
      <itunes:summary>&lt;p&gt;I'm a little late joining this thread, but here's a few lines one can inserted at the top of a worksheet to display no more than 3 decimals and to remove trailing zeros (all of them), it works with standard.&lt;/p&gt;
&lt;p&gt;interface(displayprecision=3): # customize this&lt;br&gt;interface(typesetting=extended):&lt;br&gt;Typesetting:-Settings(striptrailing=true):&lt;br&gt;&lt;br&gt;&lt;/p&gt;</itunes:summary>
      <description>&lt;p&gt;I'm a little late joining this thread, but here's a few lines one can inserted at the top of a worksheet to display no more than 3 decimals and to remove trailing zeros (all of them), it works with standard.&lt;/p&gt;
&lt;p&gt;interface(displayprecision=3): # customize this&lt;br&gt;interface(typesetting=extended):&lt;br&gt;Typesetting:-Settings(striptrailing=true):&lt;br&gt;&lt;br&gt;&lt;/p&gt;</description>
      <guid>123277</guid>
      <pubDate>Sun, 26 Jun 2011 18:59:04 Z</pubDate>
      <itunes:author>PatrickT</itunes:author>
      <author>PatrickT</author>
    </item>
  </channel>
</rss>