The Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Math Forum » Discussions » Inactive » comp.soft-sys.math.mathematica

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Creating a Function to Display Numbers in Percent Format
Replies: 0  

Advanced Search

Back to Topic List Back to Topic List  
Gregory Lypny

Posts: 247
Registered: 3/14/05
Creating a Function to Display Numbers in Percent Format
Posted: Dec 3, 2012 3:30 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

Hello everyone,

I've written a function to display numbers in percent format.

percent[x_, numDec_: 1] :=
PaddedForm[100 x, {500, numDec}, NumberPoint -> If[numDec == 0, "", "."],
DigitBlock -> {3, Infinity}, ExponentStep -> Infinity,
NumberSigns -> {{"-", "%"}, {"", "%"}}, NumberPadding -> {"", "0"}];

The problem with it is that the padding on the right appears after the percent sign so that percent[.0237, 6] returns 2.37%0000. What am I doing wrong?



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.