Documentation for /Users/balarsen/Documents/idl/larsen/

Generated by IDLdoc

single page | use frames     summary     class     fields     routine details     file attributes

./

leading_digit.pro

topleading_digit

result = leading_digit(in)

return the leading digit of a number. E.g. 1234 -> 1, 0.345 -> 3. This is used in the computation of Benford's Law (http://en.wikipedia.org/wiki/Benford%27s_law)

Return value

the leading digit of the number

Parameters

in in required

number (or array of numbers) to find the leading digit of

Examples

IDL> print, leading_digit([0.0034, 6123, 0, -0.12343]) 3 6 0 1

Author information

History:

Mon Jun 16 16:36:17 2008, Brian Larsen written and tested

Statistics

Lines: 6
McCabe complexity:

File attributes

Modifcation date: Tue Sep 9 13:58:27 2008
Lines: 37
Disclaimer