ACSUtils Wiki

An ACS library for ZDoom-based ports

User Tools

Site Tools


functions:clamp

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
functions:clamp [2017/03/15 10:26] – created korshunfunctions:clamp [2017/03/15 10:36] (current) korshun
Line 2: Line 2:
 {{tag>math}} {{tag>math}}
 ''num clamp(num x, num a, num b)'' ''num clamp(num x, num a, num b)''
 +
 +[[:types|num - any numeric type (int or fixed)]]
  
 ===== Description ===== ===== Description =====
Line 12: Line 14:
 ===== Examples ===== ===== Examples =====
 <code> <code>
-clamp(7, 6, 8) -> 7; +clamp(7, 6, 8) -> 7 
-clamp(5, 6, 8) -> 6; +clamp(5, 6, 8) -> 6 
-clamp(8, 6, 8) -> 8;+clamp(8, 6, 8) -> 8
  
-clamp(0.25, 0.2, 0.3) -> 0.25; +clamp(0.25, 0.2, 0.3) -> 0.25 
-clamp(0.15, 0.2, 0.3) -> 0.2; +clamp(0.15, 0.2, 0.3) -> 0.2 
-clamp(0.35, 0.2, 0.3) -> 0.3;+clamp(0.35, 0.2, 0.3) -> 0.3
 </code> </code>
functions/clamp.1489566378.txt.gz · Last modified: 2017/03/15 10:26 by korshun