Table of Contents

Method ToUInt32

Namespace
Skyline.DataMiner.Utils.SafeConverters
Assembly
Skyline.DataMiner.Utils.SafeConverters.dll

ToUInt32(double)

Performs a safe conversion from Double to UInt32.

public static uint ToUInt32(double value)

Parameters

value double

The double-precision floating-point number to convert.

Returns

uint

The converted value, rounded to the nearest UInt32.

Remarks

When polling a UInt32 value from a data source, DM will convert it to a Double in order to store the value into a parameter.

In some cases, such conversion might result into a rounded value bigger than the MaxValue which would in turn cause an overflow when trying to convert that Double back to a UInt32 in a QAction.
This method covers such cases by returning MaxValue in case of such overflow.

If value is halfway between two whole numbers, the even number is returned.

If value is higher than the max value of a UInt32, the max value is returned.