PercentForm

PercentForm[expr]

prints with numbers in expr given as percentages.

PercentForm[expr,n]

prints with approximate real numbers in expr given as percentages to n-digit precision.

Details and Options

Examples

open allclose all

Basic Examples  (2)

Show a decimal number as a percentage:

Display a table of random percentages:

Scope  (3)

Numbers of any size and sign can be shown in percent form:

PercentForm works on integers:

PercentForm does not work on rational or complex numbers:

Display percentages with different precisions:

Options  (8)

DefaultPrintPrecision  (1)

By default, percentages are shown with precision 4:

Show percentages with default precision 6:

DigitBlock  (1)

Default representation:

Digits separated in blocks of length 3:

NumberPadding  (2)

The default does not pad on the left or right:

Pad with spaces on the left:

Pad with spaces on the left to align percentages in a table:

NumberPoint  (1)

By default, the decimal point is printed if decimal digits would be printed after it:

Use a decimal point even when no digits follow:

Display with a comma (,) instead:

NumberSeparator  (1)

The default separator is a comma (,):

Use spaces instead:

SignPadding  (2)

The default pads before signs:

Pad between signs and numbers instead:

PercentForm by default pads before the - and % signs:

Pad inside the signs:

Pad after the signs:

Pad outside the signs:

Properties & Relations  (4)

PercentForm never uses scientific form:

Quantity can be used to work with percentages:

Convert to a normal number:

Represent that number using PercentForm:

They are the same number:

The typeset form of PercentForm[expr] is interpreted the same as expr when used in input:

Copy the output and paste it into an input cell. The 50% is interpreted as 0.5:

When an input evaluates to PercentForm[expr], PercentForm does not appear in the output:

Out is assigned the value 0.5, not PercentForm[0.5]:

Possible Issues  (2)

Placeholder zeros may be needed if the requested precision is small:

Even when an output omits PercentForm from the top level, it is not stripped from subexpressions:

The output does not have PercentForm in it:

However, the variable e does have PercentForm in it, which may affect subsequent evaluations:

The product is not evaluated due to the intervening PercentForm:

Assign variables first and then apply PercentForm to the result to maintain computability:

Wolfram Research (2019), PercentForm, Wolfram Language function, https://reference.wolfram.com/language/ref/PercentForm.html.

Text

Wolfram Research (2019), PercentForm, Wolfram Language function, https://reference.wolfram.com/language/ref/PercentForm.html.

CMS

Wolfram Language. 2019. "PercentForm." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/PercentForm.html.

APA

Wolfram Language. (2019). PercentForm. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/PercentForm.html

BibTeX

@misc{reference.wolfram_2024_percentform, author="Wolfram Research", title="{PercentForm}", year="2019", howpublished="\url{https://reference.wolfram.com/language/ref/PercentForm.html}", note=[Accessed: 14-November-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_percentform, organization={Wolfram Research}, title={PercentForm}, year={2019}, url={https://reference.wolfram.com/language/ref/PercentForm.html}, note=[Accessed: 14-November-2024 ]}