Log in to see Cloud of Tags

Wealth-Lab Wiki

Number Of Decimal Places

RSS

Syntax


public static int NumberOfDecimalPlaces(this double Num)

public static int NumberOfDecimalPlaces(double Num)

Parameter Description

NumA double value

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 ) ); } } }

Important Disclaimer: The information provided by Wealth-Lab is strictly for informational purposes and is not to be construed as advice or solicitation to buy or sell any security.  The owner of Wealth-Lab.com assumes no liability resulting from the use of the material contained herein for investment purposes. By using this web site, you agree to the terms of this disclaimer and our Terms of Use.


ScrewTurn Wiki. Some of the icons created by FamFamFam.