MathGroup Archive 2012

[Date Index] [Thread Index] [Author Index]

Search the Archive

Creating a Function to Display Numbers in Percent Format

  • To: mathgroup at smc.vnet.net
  • Subject: [mg128880] Creating a Function to Display Numbers in Percent Format
  • From: Gregory Lypny <gregory.lypny at videotron.ca>
  • Date: Sun, 2 Dec 2012 04:57:20 -0500 (EST)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • Delivered-to: l-mathgroup@wolfram.com
  • Delivered-to: mathgroup-newout@smc.vnet.net
  • Delivered-to: mathgroup-newsend@smc.vnet.net

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?

Regards,

Gregory



  • Prev by Date: Re: Unfortunate Side Effect of Upgrading to Mathematica
  • Next by Date: Re: Plotting a series of Roots
  • Previous by thread: Re: Unfortunate Side Effect of Upgrading to Mathematica
  • Next by thread: Re: Creating a Function to Display Numbers in Percent Format