I need a function that returns:
for any number from the range => the result
[0.001,0.01) => 0.01
[0.01,0.1) => 0.1
[0.1,1) => 1
[1,10) => 10
[10,100) => 100
and etc.
My first idea was to use if, but this is the worst way. Is there a simple solution?
if
10^(floor(log(x) + 1))
Source: https://habr.com/ru/post/1747075/More articles:Help with recursive expression linq - linqMVCContrib grid - select row - model-view-controllerimg_data_lock iphone - imageNamed vs imageWithContentsofFile - memory-managementHow to rename a process on Linux? - pythonКак я могу реализовать эту функцию? - javaiphone registration and authentication - authenticationIn Pylons, how do I do things after writing an answer? - pythongetting BR-split text via DOM in JS / JQuery? - javascriptAutomatic translation of images into a 3d model - algorithmSharing LINQ-to-SQL classes / models between multiple projects in a solution - c #All Articles