F_TryDevide()

F_TryDevide() 1:

Function is 'obsolete'

This function is marked as obsolete and should not be used anymore!

Alternative: F_TryDivide

Original version:

F_TryDevide() 2:

Divides two values without throwing an exception.

F_TryDevide() 3:

Return value mathematically invalid

The function defines the mathematically invalid case x / 0 as 0. This is a mathematically invalid result, but is sufficient for many use cases. Check for your use case whether this definition does not lead to unforeseen misbehavior.

Syntax:

FUNCTION F_TryDevide : HRESULT
VAR_INPUT
    fNominator:      LREAL;                
    fDenominator:    LREAL;                
    refResult:       REFERENCE TO LREAL;    
END_VAR

F_TryDevide() 4: Inputs

Name

Type

Description

fNominator

LREAL

Value to be divided

fDenominator

LREAL

Value by which to divide

refResult

REFERENCE TO LREAL

Result of the division

F_TryDevide() 5: Outputs

Name

Type

Description

F_TryDevide

HRESULT

Return value with feedback on the success of the execution

Requirements

Development environment

Target platform

PLC libraries to include

TwinCAT v3.1.4024.35

PC or CX (x64, x86)

Tc3_PlasticBaseApplication (>= v3.12.5.0)