Click or drag to resize

analysisExtensionsGetRatio Method (Int32, Int32, Double, Double)

imbSCI | imbACE | imbNLP | imbWEM | imbWBI
Zero-input safe ratio calculation: part / whole

Namespace:  imbSCI.Core.math
Assembly:  imbSCI.Core (in imbSCI.Core.dll) Version: 0.3.58.
Syntax
C#
public static double GetRatio(
	this int part,
	int whole,
	double ifPartIsZero = 0,
	double ifWholeIsZeroAndPartNot = 1
)
Request Example View Source

Parameters

part
Type: SystemInt32
The part - upper part of fraction equasion
whole
Type: SystemInt32
The whole - lower part of fraction equasion
ifPartIsZero (Optional)
Type: SystemDouble
Value for case when part is 0
ifWholeIsZeroAndPartNot (Optional)
Type: SystemDouble
Value for case when whole is 0 but part is not zero

Return Value

Type: Double
Ratio from 0 to 1

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type Int32. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also