Algorithm to calculate numbers of 10^x smaller than given one I am struggling to create a smart algorithm. Currently I have produced one which is super-ugly and not efficient because I am casting numerics to strings back and forth, not really useful to share it here.

The point of algorithm is to get a number 10^x which is smaller than a given one.

Examples:


600 => 100
34.54 => 10
7.2 => 1
0.123 => 0.1


I am sure I am missing something. Is there any smart way of doing that?
$Num \geq 10^{x} $

$\implies x \leq log_{10}(Num)$

Then $x = \lfloor log_{10}(Num) \rfloor $. 

$10^{x}$ would be your number.