Table of Contents

Method ToUInt64

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

ToUInt64(double)

Performs a safe conversion from Double to UInt64.

public static ulong ToUInt64(double value)

Parameters

value double

The double-precision floating-point number to convert.

Returns

ulong

value, rounded to the nearest UInt64.

Remarks

When polling a UInt64 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 UInt64 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 UInt64, the max value is returned.