ACSUtils Wiki

An ACS library for ZDoom-based ports

User Tools

Site Tools


functions:safediv

Table of Contents

SafeDiv

int SafeDiv(int num, int den)

Description

Performs safe division: if denumerator is 0, the result is 0 and no error happens.

Integer version, for fixed-point numbers see SafeFixedDiv.

Examples

SafeDiv(6, 3) -> 2
SafeDiv(6, 0) -> 0
functions/safediv.txt · Last modified: 2017/03/17 17:41 by korshun