# How long is my number: Restricted Version

## Challenge

Given an integer, Z in the range -2^31 < Z < 2^31, output the number of digits in that number (in base 10).

## Rules

You must not use any string functions (in the case of overloading, you must not pass a string into functions which act as both string and integer functions). You are not allowed to store the number as a string.

All mathematical functions are allowed.

You may take input in any base, but the output must be the length of the number in base 10.

Do not count the minus sign for negative numbers. Number will never be a decimal.

Zero is effectively a leading zero, so it can have zero or one digit.

## Examples

Input > Output

-45 > 2
1254 > 4
107638538 > 9
-20000 > 5
0 > 0 or 1
-18 > 2


## Winning

Shortest code in bytes wins.

• I assume no array functions either? – Cyoce May 19 '17 at 16:45
• @Cyoce Yes, no array functions – Beta Decay May 19 '17 at 17:04
• So if a language only accepts input as a string, it's invalid for this challenge, right? – Engineer Toast May 19 '17 at 19:24
• @EngineerToast Yes, very much so – Beta Decay May 19 '17 at 19:33
• I'm removing the restricted source tag because while this is a restriction it is not a real source restriction in that it is not computer tractable. – Sriotchilism O'Zaic May 19 '17 at 21:50

# @yBASIC, 53 bytes.

_#=@_>.@_
_%=_%/(_#*_#+!.)_=_+!.GOTO(@_)+"_"*!_%@__?_


Input should be stored in variable _%

# Rust, 41 bytes

fn f(n:i32)->u8{n!=0&&return f(n/10)+1;0}


Try it online!

• Welcome to PPCG. – Muhammad Salman Apr 22 '18 at 8:25

# Pyth, 10 bytes

.xhs.l.aQT


Test suite

Explanation:
.xhs.l.aQT  # Code
.xhs.l.aQTQ # With implicit variables
# Print (implicit):
.l   T  #   the log base 10 of:
.aQ   #    the absolute value of the input
s        #   floored
h         #   plus 1
.x        Q #  unless it throws an error, in which case the input

Python 3 translation:
import math
Q=eval(input())
try:
print(int(math.log(abs(Q),10))+1)
except:
print(Q)


# Gol><>, 12 bytes

SA:z+aSLS(PB


Try it online!

### Example full program & How it works

1AGIE;GN
SA:z+aSLS(PB

1AGIE;GN
1AG       Register row 1 as function G
IE;    Take input as int, halt if EOF
GN  Call G and print the result as int

SA:z+aSLS(PB
SA            Absolute value

Many math functions are prefixed with S, which made the code longer.
Adding 0.9 unconditionally (9a,+) and using ceiling (S)) is also possible with same byte count. Zero input yields 0 in this case.