Table of Contents

Class VBNumericType

Namespace
RDCore.SDK.Model.Types.Abstract
Assembly
RDCore.SDK.dll

Represents any numeric data type mentioned in the MS-VBAL language specifications.

public abstract record VBNumericType : VBIntrinsicType, IEquatable<VBType>, IEquatable<VBIntrinsicType>, INumericType, IEquatable<VBNumericType>
Inheritance
VBNumericType
Implements
Derived
Inherited Members

Constructors

VBNumericType(string, Type)

Represents any numeric data type mentioned in the MS-VBAL language specifications.

protected VBNumericType(string Name, Type ManagedType)

Parameters

Name string

The name (token) of the data type.

ManagedType Type

Properties

ManagedMaxValue

Gets the maximum representable managed (.net) value for this data type.

public abstract double ManagedMaxValue { get; }

Property Value

double

ManagedMinValue

Gets the minimum representable managed (.net) value for this data type.

public abstract double ManagedMinValue { get; }

Property Value

double

Methods

BankersRounding(VBNumericTypedValue)

Implements MS-VBAL 5.5.1.2.1.1 Banker's Rounding. A midpoint rounding scheme also known as "round-to-even" rounds to the nearest rounded value such that the least-significant digit is even.

public static int BankersRounding(VBNumericTypedValue value)

Parameters

value VBNumericTypedValue

The floating-point numeric value to be rounded.

Returns

int

BankersRounding(double)

Implements MS-VBAL 5.5.1.2.1.1 Banker's Rounding. A midpoint rounding scheme also known as "round-to-even" rounds to the nearest rounded value such that the least-significant digit is even.

public static int BankersRounding(double value)

Parameters

value double

The floating-point numeric value to be rounded.

Returns

int

BankersRounding(double, int)

Implements MS-VBAL 5.5.1.2.1.1 Banker's Rounding. A midpoint rounding scheme also known as "round-to-even" rounds to the nearest rounded value such that the least-significant digit is even.

public static double BankersRounding(double value, int digits)

Parameters

value double

The floating-point numeric value to be rounded.

digits int

Returns

double

IsWithinRange(double, VBNumericType)

A helper function to test if a given source numeric value is within the range of a destination data type.

public static bool IsWithinRange(double source, VBNumericType destination)

Parameters

source double

The managed (.net) numeric source value to validate.

destination VBNumericType

The data type to check conversion eligibility against.

Returns

bool

true if the value can legally be used with the destination type, false otherwise.

Remarks

If this function returns false, the caller should throw a VBRuntimeErrorOverflowException.