percentageMathFloat := percentage_math_float(Args{
value: 199.99,
percentage: 15.5,
operation: "Subtract Percentage",
})
send_text_message(Args{
channel_id: trigger.channel_id,
message_content: "Result: " + percentageMathFloat,
})
Percentage Math (Float)
BlockMath
Add or subtract a percentage to/from a floating point number.
Inputs
ValueRequired
Base float value.
Example: 199.99
PercentageRequired
Percentage to apply (e.g. 15.5 for 15.5%).
Example: 15.5
OperationRequired
Add or subtract the percentage.
OptionsAdd PercentageSubtract Percentage
Outputs
Result
Resulting value after applying the percentage.
Example: 169.99
Build a bot using blocks like Percentage Math (Float)
Use this block in our visual flow editor. Bots are hosted 24/7 for free on inventor.bot.
Advanced Documentation
This documentation can be useful when using code mode. View as Markdown
ID:
percentage_math_float- Value block: it can be used directly inside expressions, e.g.
"Result: " + percentage_math_float(Args{...}).
Inputs
| Field | InventScript name | Value |
|---|---|---|
| Value | value | e.g. "199.99" |
| Percentage | percentage | e.g. "15.5" |
| Operation | operation | "Add Percentage", "Subtract Percentage" |
Outputs
| Field | InventScript name | Value |
|---|---|---|
| Result | result | e.g. "169.99" |
Example InventScript
More math blocks
Math OperationsPerform addition, subtraction, multiplication, division, modulo and exponent operations.Math Operations (Float)Perform addition, subtraction, multiplication, division, modulo and exponent operations with floating point numbers.Round NumberRound a number using a chosen method (round, floor, ceil, truncate) to a specified number of digits.Absolute ValueGet the absolute value of a number.Square RootGet the square root (sqrt) of a number.LogarithmGet the logarithm of a number with a specified base.FactorialCalculate the factorial of a number.Random Number GeneratorGenerate a random number using specified minimum and maximum values.Passphrase GeneratorGenerate a random passphrase with a specified number of words.If Number is in RangeCheck if a number is in a specified range.If Number is Close to Other NumberCheck if a number is close to another number within a specified tolerance.If Value is NumberCheck if a value is a number.Hex to IntConvert a hexadecimal number to an integer.Int to HexConvert an integer to a hexadecimal number.Percentage Math (Integer)Add or subtract a percentage to/from an integer.