Tsvb calculation

Hi @paigekim ,

I think you could hijack the clamp tinymath to do what you want (here's a Lens example with Formula)

You can set a high value for the clamp to be sure to never reach it (i.e. 1000000% => max = 10000) and write the following:

clamp( (params.rev / params.cost) - 1, 0, 10000)

Explanation:

  • (params.rev / params.cost) - 1 offset by 100% the computation
  • clamp( ..., 0, 10000) keeps the result within 0 and 1000000 (0%-1000000%)
  • because of the offset, any value below 100% will go negative and the clamp will rewrite it as 0%. Anything above 100% will be kept as is (as longs as it does not pass 1000000%) and will be shown
1 Like