Syntax
public static int NumberOfDecimalPlaces(this double Num)
public static int NumberOfDecimalPlaces(double Num)
Parameter Description
Description
Simple static function to return the number of decimal places of an arbitrary entered number.
Example
Example below outputs the number of decimal places of an arbitrary number (here: the first fourteen digits of Pi).
Example using C# extension methods (with legacy syntax commented out):
using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using WealthLab;
namespace WealthLab.Strategies
{
public class Numbers : WealthScript
{
protected override void Execute()
{
PrintDebug( 3.14159265358979.NumberOfDecimalPlaces() );
// This function is inside the Calculate class of Community.Components:
//PrintDebug( Community.Components.Calculate.NumberOfDecimalPlaces( 3.14159265358979 ) );
}
}
}