PowerApps 中的 Abs、Exp、Ln、Power 和 Sqrt 函数Abs, Exp, Ln, Power, and Sqrt functions in PowerApps

计算绝对值、自然对数、平方根和 e 或任意数字的指定次方值结果。Calculates absolute values, natural logarithms, square roots, and the results of raising e or any number to specified powers.

说明Description

Abs 函数返回参数的非负值。The Abs function returns the non-negative value of its argument. Abs 返回负数的绝对值。If a number is negative, Abs returns the positive equivalent.

Exp 函数返回 e 的参数次方值。The Exp function returns e raised to the power of its argument. 超越数 e 的一次方值为 2.7182818...The transcendental number e begins 2.7182818...

Ln 函数返回参数的自然对数(以 e 为底)。The Ln function returns the natural logarithm (base e) of its argument.

Power 函数返回数字的次方值。The Power function returns a number raised to a power. 相当于使用 ^ 运算符It is equivalent to using the ^ operator.

Sqrt 函数返回参数的平方根。The Sqrt function returns the number that, when multiplied by itself, equals its argument.

如果你传递一个数字,则返回一个视调用函数而定的结果值。If you pass a single number, the return value is a single result based on the function called. 如果你传递包含数字的单列,则返回单列表结果值,参数表中每条记录都对应一个结果。If you pass a single-column table that contains numbers, the return value is a single-column table of results, one result for each record in the argument's table. 如果你有多列表,可以将其调整为单列表,如使用表中所述。If you have a multi-column table, you can shape it into a single-column table, as working with tables describes.

如果参数的结果值未经定义,则结果为空白If an argument would result in an undefined valued, the result is blank. 例如,在求负数的平方根和对数时可能会遇到这种情况。This can happen, for example, with square roots and logarithms of negative numbers.

语法Syntax

Abs( Number )Abs( Number )
Exp( Number )Exp( Number )
Ln( Number )Ln( Number )
Sqrt( Number )Sqrt( Number )

  • Number - 必需。Number - Required. 要计算的数字。Number to operate on.

Power( Base, Exponent )Power( Base, Exponent )

  • Base - 必需。Base - Required. 计算次方值时的底数。Base number to raise.
  • Exponent - 必需。Exponent - Required. 计算底数次方值时的指数。The exponent to which the base number is raised.

Abs( SingleColumnTable )Abs( SingleColumnTable )
Exp( SingleColumnTable )Exp( SingleColumnTable )
Ln( SingleColumnTable )Ln( SingleColumnTable )
Sqrt( SingleColumnTable )Sqrt( SingleColumnTable )

  • SingleColumnTable - 必需。SingleColumnTable - Required. 要计算的单列表数字。A single-column table of numbers to operate on.

示例Examples

单个数字Single number

公式Formula 说明Description 结果Result
Abs( -55 )Abs( -55 ) 返回不带负号的数字。Returns the number without the negative sign. 5555
Exp( 2 )Exp( 2 ) 返回 e 的 2 次方值,或 e \* e 结果值。Returns e raised to the power of 2, or e \* e. 7.389056...7.389056...
Ln( 100 )Ln( 100 ) 返回数字 100 的自然对数(以 e 为底)。Returns the natural logarithm (base e) of the number 100. 4.605170...4.605170...
Power( 5, 3 )Power( 5, 3 ) 返回 5 的 3 次方值 ,或 5 * 5 * 5 结果值。Returns 5 raised to the power of 3, or 5 * 5 * 5. 125125
Sqrt( 9 )Sqrt( 9 ) 返回 9 的平方根。Returns the number that, when multiplied by itself, results in 9. 33

单列表Single-column table

本部分中的示例使用名为 ValueTable数据源,其中包括以下数据:The examples in this section use a data source that's named ValueTable and that contains this data:

公式Formula 说明Description 结果Result
Abs( ValueTable )Abs( ValueTable ) 返回表中每个数字的绝对值。Returns the absolute value of each number in the table.
Exp( ValueTable )Exp( ValueTable ) 返回 e 的表中每个数字次方值。Returns e raised to the power of each number in the table.
Ln( ValueTable )Ln( ValueTable ) 返回表中每个数字的自然对数。Returns the natural logarithm of each number in the table.
Sqrt( ValueTable )Sqrt( ValueTable ) 返回表中每个数字的平方根。Returns the square root of each number in the table

分步示例Step-by-step example

  1. 添加“文本输入”控件,然后将其命名为“Source”。Add a Text input control, and name it Source.
  2. 添加一个“标签”控件,然后将“Text”属性设置为以下公式:Add a Label control, and set its Text property to this formula:
    Sqrt( Value( Source.Text ) )Sqrt( Value( Source.Text ) )
  3. 在“源”中键入数字,然后确认“标签”控件中是否显示所键入数字的平方根。Type a number into Source, and confirm that the Label control shows the square root of the number that you typed.