This is documentation for Caché & Ensemble.

For information on converting to InterSystems IRIS, see the InterSystems IRIS Adoption Guide and the InterSystems IRIS In-Place Conversion Guide, both available on the WRC Distributions page (login required).

# FDIV

Divides two floating point numbers.

## Synopsis

FDIV(num1,num2)

### Arguments

 num1 The dividend. An expression that resolves to a number or numeric string. num2 The divisor. An expression that resolves to a non-zero number or numeric string.

## Description

The FDIV function divides the value of num1 by num2, and returns the quotient. If a value is 0, a null string, or a non-numeric value, FDIV parses it as 0 (zero). If num1 is 0, FDIV returns a result of 0. If num2 is 0, FDIV generates a <DIVIDE> error.

You can perform the same operation using the Division operator (/). Refer to the Operators page of this manual.

### Arithmetic Operations

• To perform arithmetic operations on floating point numbers, use the FADD, FSUB, FMUL, and FDIV functions, or use the standard arithmetic operators.

• To perform arithmetic operations on numeric strings, use the SADD, SSUB, SMUL, and SDIV functions.

• To perform integer division, use the DIV function. To perform modulo division, use the MOD function.

• To perform arithmetic operations on corresponding elements of dynamic arrays, use the ADDS, SUBS, MULS, DIVS, and MODS functions.

• To perform numeric comparison operations, use the SCMP function, or use the standard comparison operators.

## Examples

The following example uses the FDIV and the DIV functions to divide the same two floating point numbers:

a=11.95
b=10.25
PRINT FDIV(a,b);  ! returns 1.165853658536585366
PRINT DIV(a,b);   ! returns 1