Rabbinatix
Sign inGet started
Store

Discounted price

FreeLogic
@rabbinatix/discounted-price by Rabbinatixupdated Oct 4, 2026

A price after a percentage discount that is always kept between 0 and 100.

Sign in to add

Keep in Range stops a wrong discount (such as 150 or -10) from giving a negative price or a surcharge. The price is rounded to cents.

Shows: Keep in Range, Subtract, Multiply, Divide, Round.

How to use it

Add it to your logic, then add a Call Function step in any logic and pick Discounted price. It belongs to no system, so every system can use it. Or download the TypeScript and call it from your own code.

Inputs
price: Number
percent: Number
Outputs
price: Number
percent: Number
Previewdrag the steps around; scroll to zoom
Function Entry, Input / output. 0 inputs, 3 outputs. step 1 of 7
Discounted price
price
percent
Keep in Range, Math. 3 inputs, 1 output. step 2 of 7
Keep in Range
value
min
max
result
Subtract, Operators. 2 inputs, 1 output. step 3 of 7
-
A
B
result
Multiply, Operators. 2 inputs, 1 output. step 4 of 7
*
A
B
result
Divide, Operators. 2 inputs, 1 output. step 5 of 7
/
A
B
result
Round, Math. 2 inputs, 1 output. step 6 of 7
Round
value
decimals
result
Return, Input / output. 3 inputs, 0 outputs. step 7 of 7
Return
price
percent

Arrow keys: next or previous step in flow order. Alt with arrows: nearest step in that direction. Enter: open. Shift F10: more actions.

100%
Examplesrun live against the logic · 3/3 pass
PassedExampleInputOutput
15% off{"price":200,"percent":15}{"price":170,"percent":15}
Too much{"price":200,"percent":150}{"price":0,"percent":100}
Negative{"price":19.99,"percent":-10}{"price":19.99,"percent":0}
Try it
Versions
In this package
Discounted price (entry)