ACSUtils Wiki

An ACS library for ZDoom-based ports

User Tools

Site Tools


rounding

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revisionBoth sides next revision
rounding [2019/04/18 21:43] korshunrounding [2019/04/18 22:05] korshun
Line 20: Line 20:
 ^  -1.8|        -2|        -2|       -1|        -1| ^  -1.8|        -2|        -2|       -1|        -1|
  
-Every rounding mode is available as two functions. The ones with the ''i'' prefix in the name return an integerwhile the ones without return a fixed-point number:+Every rounding mode is available as two functions
 +  * Functions without the ''i'' prefix return a fixed, e.g. ''floor(2.3) == 2.0''. 
 +  * Functions with the ''i'' prefix return an inte.g ''ifloor(2.3) == 2''.
  
-^ Mode  ^ as fixed ^ as int ^ +^ Mode  ^ fixed result ^ int result 
-^ floor | ''floor()'' | ''ifloor()''+^ floor | ''fixed floor(fixed x)'' | ''int ifloor(fixed x)''
-^ ceil  | ''ceil()'' | ''iceil()''+^ ceil  | ''fixed ceil(fixed x)''  | ''int iceil(fixed x)''  
-^ round | ''round()'' | ''iround()''+^ round | ''fixed round(fixed x)'' | ''int iround(fixed x)''
-^ trunc | ''trunc()'' | ''itrunc()'' |+^ trunc | ''fixed trunc(fixed x)'' | ''int itrunc(fixed x)'' |
  
-Example of the difference between ''i'' and non-''i'' functions:+<note important>Current GZDoom provides built-in functions [[zdoom>Floor_(ACS_function)|floor]], [[zdoom>ceil]] and [[zdoom>round]], but these functions are not available in Zandronum 3.0 and **silently return 0** as a result.
  
-  * ''floor(2.3) == 2.0;'' 
-  * ''ifloor(2.3) == 2;'' 
  
-So the full function list is as follows: +</note>
- +
-  * ''fixed floor(fixed x)'' +
-  * ''fixed ceil(fixed x)'' +
-  * ''fixed round(fixed x)'' +
-  * ''fixed trunc(fixed x)'' +
-  * ''int ifloor(fixed x)'' +
-  * ''int iceil(fixed x)'' +
-  * ''int iround(fixed x)'' +
-  * ''int itrunc(fixed x)''+
rounding.txt · Last modified: 2019/08/26 21:02 by korshun