1 Pages (4 items)
Log10 issues - Floor of log10(10000) not giving expected result - Messages
#1 Posted: 11/2/2016 4:18:47 PM
#2 Posted: 11/2/2016 5:45:39 PM
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 Posted: 11/2/2016 6:34:17 PM
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 Posted: 11/2/2016 7:50:50 PM
WroteI think I found another quirky behavior.
It is because SMath returns 3.9999999999 (set the region to display 15 decimal places)
![2016-11-02 23_45_28-SMath Studio - [Page1_].png](/en-US/files/Download/V4yzRc/2016-11-02-23_45_28-SMath-Studio---[Page1_].png)
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.
![2016-11-02 23_46_54-SMath Studio - [Page1_].png](/en-US/files/Download/LrhdSC/2016-11-02-23_46_54-SMath-Studio---[Page1_].png)
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
1 Pages (4 items)
-
New Posts
-
No New Posts