Post Reply 
a b/c unexpected function
09-04-2020, 03:04 PM (This post was last modified: 09-04-2020 03:31 PM by Albert Chan.)
Post: #10
RE: a b/c unexpected function
(09-04-2020 07:48 AM)ijabbott Wrote:  You could use the LOG function for the number of leading zeros:
-IP(LOG(0.000002)) = 5

It doesn't work for numbers such as 0.1, 0.01, 0.001, but those would have a fractional part after the LOG() function that could be tested for.

It also doesn't work for (0.1, 0.01, 0.001, ...) + 1 ULP

log10(1+ε) = ln(1+ε) / ln(10) ≈ ε / 2.3026 ≈ 0.4343 ε

For k ≥ 1, log10(x = (1+ULP)/10^k) ≈ 0.4343 ULP - k, which rounded back down to -k
However, x has k-1 leading zeroes, after decimal point.

The problem grow worse when k is big. Example, with 12-digits precision, k=11:

log10((1 + 11 ULP)/10^11) = log10(1.00000000011e-11) ≈ 0.4343*11e-11 - 11 = -11 (rounded-down)

---

Instead of scientific notation (or engineering notation), I like normalized notation.
0.1 ≤ mantissa < 1, see IEEE Standard for Floating Point Numbers, by V Rajaraman, page 12.

1.00000000011e-11 = 0.100000000011e-10 → 10 leading zeroes, after decimal point
1234500000 = 0.12345e+10                        → 10 digits number, before decimal point
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
a b/c unexpected function - celltx - 09-03-2020, 05:10 PM
RE: a b/c unexpected function - Joe Horn - 09-03-2020, 06:21 PM
RE: a b/c unexpected function - Joe Horn - 09-04-2020, 12:41 AM
RE: a b/c unexpected function - celltx - 09-03-2020, 07:01 PM
RE: a b/c unexpected function - Joe Horn - 09-03-2020, 07:29 PM
RE: a b/c unexpected function - celltx - 09-03-2020, 08:13 PM
RE: a b/c unexpected function - ijabbott - 09-04-2020, 07:48 AM
RE: a b/c unexpected function - Albert Chan - 09-04-2020 03:04 PM
RE: a b/c unexpected function - celltx - 09-04-2020, 04:23 PM
RE: a b/c unexpected function - Joe Horn - 09-04-2020, 05:24 PM



User(s) browsing this thread: 1 Guest(s)