Log10 issues

Log10 issues - Floor of log10(10000) not giving expected result - Сообщения

#1 Опубликовано: 02.11.2016 16:18:47
jbutler

jbutler

0 сообщений из 5 понравились пользователям.

Группа: User

I think I found another quirky behavior.

floor-log.gif
#2 Опубликовано: 02.11.2016 17:45:39
Jean Giraud

Jean Giraud

983 сообщений из 6866 понравились пользователям.

Группа: User

floor and round are two different animals
round(log10(60000),0)=5
Floor(log10(60000))=4
one is not the substitue of the other
#3 Опубликовано: 02.11.2016 18:34:17
jbutler

jbutler

0 сообщений из 5 понравились пользователям.

Группа: User

Yes, I realize that.

Sorry, my function was not correct in the previous example.

floor.gif

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
Davide Carpi

Davide Carpi

1416 сообщений из 2873 понравились пользователям.

Группа: Moderator

Wrote

I 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

Wrote

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.


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
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
  • Новые сообщения Новые сообщения
  • Нет новых сообщений Нет новых сообщений