1 страниц (4 вхождений)
Log10 issues - Floor of log10(10000) not giving expected result - Сообщения
#1 Опубликовано: 02.11.2016 16:18:47
#2 Опубликовано: 02.11.2016 17:45:39
floor and round are two different animals
round(log10(60000),0)=5
Floor(log10(60000))=4
one is not the substitue of the other
round(log10(60000),0)=5
Floor(log10(60000))=4
one is not the substitue of the other
#3 Опубликовано: 02.11.2016 18:34:17
Yes, I realize that.
Sorry, my function was not correct in the previous example.

Let me explain what I am trying to accomplish. Maybe there is a better method.
For all numbers 100 to 999, I want the function to return "2"
For all numbers 1000 to 9999, I want the function to return "3"
And so forth.
Since log10(100)=2 and log10(999)<3
and log10(1000)=3 and log10(9999)<4
I thought that "floor(log10(n))" would work.
However, the implementations of floor that I tried, do not return the correct value for integer powers of 10^x. As shown in my example.
-Jeff
Sorry, my function was not correct in the previous example.
Let me explain what I am trying to accomplish. Maybe there is a better method.
For all numbers 100 to 999, I want the function to return "2"
For all numbers 1000 to 9999, I want the function to return "3"
And so forth.
Since log10(100)=2 and log10(999)<3
and log10(1000)=3 and log10(9999)<4
I thought that "floor(log10(n))" would work.
However, the implementations of floor that I tried, do not return the correct value for integer powers of 10^x. As shown in my example.
-Jeff
#4 Опубликовано: 02.11.2016 19:50:50
WroteI think I found another quirky behavior.
It is because SMath returns 3.9999999999 (set the region to display 15 decimal places)
WroteLet me explain what I am trying to accomplish. Maybe there is a better method.
For all numbers 100 to 999, I want the function to return "2"
For all numbers 1000 to 9999, I want the function to return "3"
And so forth.
Until is not fixed you can try with OoM(...) (order of magnitude) from Custom Functions plugin.
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
1 страниц (4 вхождений)
-
Новые сообщения
-
Нет новых сообщений