DMARC-Filter: OpenDMARC Filter v1.4.2 delorie.com 6588mvrK746951 Authentication-Results: delorie.com; dmarc=pass (p=none dis=none) header.from=cygwin.com Authentication-Results: delorie.com; spf=pass smtp.mailfrom=cygwin.com DKIM-Filter: OpenDKIM Filter v2.11.0 delorie.com 6588mvrK746951 Authentication-Results: delorie.com; dkim=pass (1024-bit key, unprotected) header.d=cygwin.com header.i=@cygwin.com header.a=rsa-sha256 header.s=default header.b=suaDjOAx X-Recipient: archive-cygwin AT delorie DOT com DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 31C9051A3BB1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com; s=default; t=1780908536; bh=W72sx7rDQITuSg/W5TdC7DJ7d3k3vaCJfoyabI9612Y=; h=References:In-Reply-To:Date:Subject:To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=suaDjOAxc8MJzSHGcTsTFBv9V7P9HaPWRsnfpn/iHFCXZ+5qZwglFMpwdZm0B0IvJ I/IpzaYy9/L6eegq8PLB6KpzgMkseDwXQI13wrWxPu39ItdVdGJn+SBkEa972GWstO LY8SHy0qJUehhd/xUz6FeF4HO0uRJDi6hE4MTe88= X-Original-To: cygwin AT cygwin DOT com Delivered-To: cygwin AT cygwin DOT com DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org F2A1551A3BAF ARC-Filter: OpenARC Filter v1.0.0 sourceware.org F2A1551A3BAF ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1780908517; cv=pass; b=N/xPl38eakgXPqDmYXGVtoCdZwAwESDbDS/ALIpCC9QOzuyvLW0yarEAZXZCX20FoncxyCZSVLSwCvRoc9d2mbG+d6JuqcmPyoXAnQA+9qi2CGYpbC75qHhh/K9fTa7LxpW1HpZRznck9PtJOhTS6i/kMW0F29mDfTBiUjSfQFg= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1780908517; c=relaxed/simple; bh=tn+xE1Y9SpYeFxDRt4a7829AbPM503R8d4wJjgkXeXo=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=L6tghXJbKa3WIq+Wm1+XtXdmSStKFisWzNftyNUSOnzKnKmcAiK0hNqARlPrau3aTS/RSRun51T5lawAQxtMMopnPwmvkFP7Y0E8utyiJBpgYsE13NkXeIBwlOdDTzLnaGYS2xZcylril9Az6zj++2c4urcLVyqd8Xq2/QFnTmo= ARC-Authentication-Results: i=2; sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20251104 header.b=pZW1pgPC DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org F2A1551A3BAF ARC-Seal: i=1; a=rsa-sha256; t=1780908516; cv=none; d=google.com; s=arc-20240605; b=cqgvSPpOHRBghjb26GXJp2FpoJPzMGn/uwyXHDIMFXbKpdnIYhhXap7ymkJMWPSyYx TSiMGOsiNMkzzMXJ+DHSEArml9zcuNFYrvT3142RJsHpmhQ13sjMVBkiYbQOJ7RfEJ9n F4k+pOszQhHX+a+qxfTfwrSS20s5OfcO0fNO45CwexMK5+bO3+chV1Shaepy1nIpVlRI LqXnxoz20H1TrAqHk23ef3eHOdAjJweFxJinuQHoi0W0jx9bSzzgWL1DTDwYVMbpSDQb ZgpGmE6L24gGvuCTnhvMHJ+5vBQC6rvqsOfg+y8RMTNZ64a8yIGN6NP7ZBMhEi81bGn3 aHwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:dkim-signature; bh=t78NJvUqGXBfKHjVWoat7kGk5B9Yaw8BrNKWNCAwcUA=; fh=g1JOyztc+Lw9638T5mkzQXYs5uHS5MD4GZuA1LX97MM=; b=Ppxc7dGWvZGTXp1iSCEEPgqPkp9sp0GpdRStgnyKcqiNsbazv9nCGUno0StnUaRoJc t2mQ3wQ/uNBEEjyTVWD41atEN9cozffpxxEgEe51DJ/r4F+528ITh1irYbcqfhSjkmqv qWqTqRLm/BEGU9wGbN9fvHxO0lby6cCa2sNT6hiDGzn/3QEPnxJzeq7J2/74V6m7kwZH jF1Y8tXKc9j7BhEL6u6RxuBWukAZe9yiKUDmUJwDfvlm3mSwuSZxhNGv8R66HwqbHLTp fW2U8sqsBCTXVCb9pj/8RtY2tUHQCQyz9kpOzgXG6dbw+pW5AULoS2WoBgUpplf99+mC 5Dnw==; darn=cygwin.com ARC-Authentication-Results: i=1; mx.google.com; arc=none X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780908516; x=1781513316; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=t78NJvUqGXBfKHjVWoat7kGk5B9Yaw8BrNKWNCAwcUA=; b=Za87KQLmgYZ3Lmgsdxa2AkHKm3qzogUPUsGM0v3DhyGdHNOMMuNhtHUko4w92Jkyy1 vvum4bD8dN3Dr/b1QkqTRDohblEyanXbC/L15eRga5oZrFKCEF5r0BcmzqpcD2fpISFp Xu0wrbEZv6CaO3oIGXGXcmuzAAZlxC2c+yAdzHBCgOo5CSZJOoahIYkxyuB0l9L24/Av aRTpzy4YjVWVA1be3mPdnFMywQ0FJGurgCZhs02OieJBxXSUqbU50g1TeH6ecHOSHG+h hgKJzWkoGt5Z6H/QM+Rpop4SQa/F7LlbmcbEGvScVCytdwz3Juh3I+fqMpcG/VGerjBn 8QHw== X-Gm-Message-State: AOJu0YzTN6YkwPnUJxz/MPoRC4TByiR1y/TziTxEb+2lPeKJKNzmzGBS aZQHVpyTdt2miZYtwAkpURweJJub+5tN+b4uL23Y+bO9ayTVGeJ06AgH5EUCY15ZSJDO4dX5EjT 1YTAJyYO6mdHVYa2n7Wdek/pSdBqLezfuGxF5 X-Gm-Gg: Acq92OH3YJ2/i7mI3zwYUiJUqbCjgQmGKHytsWEAH8wHVwU7cZ9K4siXtqknBTEk9Op Tx5uAMs9ZZ/LNAYeEa6wBhJZDXSF9VuuUYEXv6E/xz/+eyMVz2fAYWvOLxS09xxTjBm8/ScVKRX SApsQH/QDOdCb1r/QytsbDmx1c85w4aeIFez7idTdQlNYNDlYh+Ya8fW6ysKzRfzWzgvHe0xbJ3 RDhlpCs6AsWLfE2+G0S0UaMbS7Wft66pgi/DXelUfd2YUoMMUPG99+u4ch7hi1Yf/xgZ/HwNXtG d1ZKs8T0hIKa0kQnwjwavVYoMFo3wVxtFYVTLwEvXL5n/P62iCEeNr/Qa4OTja/q3YSCUigjmOI ci3U= X-Received: by 2002:a5d:6892:0:b0:460:2477:2277 with SMTP id ffacd0b85a97d-4603061a177mr17708046f8f.31.1780908515730; Mon, 08 Jun 2026 01:48:35 -0700 (PDT) MIME-Version: 1.0 References: <1640804308 DOT 295932 DOT 1780787212417 AT connect DOT xfinity DOT com> <2125010483 DOT 296244 DOT 1780788258493 AT connect DOT xfinity DOT com> In-Reply-To: <2125010483.296244.1780788258493@connect.xfinity.com> Date: Mon, 8 Jun 2026 10:48:29 +0200 X-Gm-Features: AVVi8Cesd07HH4vT5BMeEzEtgyK1Q5wUQzcxolPWYYQM4SmqXO9SnwiFPNqp03g Message-ID: Subject: Re: log2() is not called for C code, a bug into math.h ? To: KENNON J CONRAD X-BeenThere: cygwin AT cygwin DOT com X-Mailman-Version: 2.1.30 List-Id: General Cygwin discussions and problem reports List-Archive: List-Post: List-Help: List-Subscribe: , From: "Carlo B. via Cygwin" Reply-To: "Carlo B." Cc: KENNON J CONRAD via Cygwin Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "Cygwin" Hello, actually, we have to say that the source code of log2() into newlib: https://sourceware.org/git/?p=newlib-cygwin.git;a=blob;f=newlib/libm/common/log2.c;h=e48c16cf8014b5ba4b3a89af261f54472d643f65;hb=HEAD and the source code of log2() into glibc: https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/ieee754/dbl-64/e_log2.c;h=872cebddd8b4283edd2e653167035c0fd527f3ea;hb=HEAD are identical, so we can assume that this code is correct and probably the best we can get in terms of speed. However, here the problem is different. Using log() and the property of the logarithms for changing the base is mathematically correct. But here, it is WRONG. Unfortunately, this method doesn't provide the right result because the intrinsic format of IEEE-754 numbers propagates a precision error. Calculating the log2 of 2^1023 is a perfect integer number and it's 1023, not 1023.00000000000011. So, in my opinion that macro MUST be removed and the genuine log2() function must be used instead. Thank you very much for your time. Sincerely, Carlo Bramini. Il giorno dom 7 giu 2026 alle ore 01:24 KENNON J CONRAD ha scritto: > > Should have written "I found that using log2 directly on my computer was slower than using log > with the divide". > > > On 06/06/2026 4:06 PM PDT KENNON J CONRAD via Cygwin wrote: > > > > > > Hello Carlo B., > > > > There was another discussion of this issue back in January. Beware, at the time I found that > > using log2 directly on my computer was slower than using log2 with the divide (by removing the > > same lines you mention in math.h). It seems to me that in a perfect world, using log2 should > > be both more accurate and faster than calling log and dividing the result by a constant. > > > > Best Regards, > > > > Kennon Conrad > > > > https://cygwin.com/pipermail/cygwin/2026-January/259314.html > > > > > On 06/06/2026 9:53 AM PDT Carlo B. via Cygwin wrote: > > > > > > > > > Hello, > > > > > > Il Sab 6 Giu 2026, 14:19 Dimitry Andric ha > > > scritto: > > > > > > > > > > > It's been defined like that since the "import newlib-2000-02-17 snapshot", > > > > so for 26 years: > > > > > > > > > > > > https://sourceware.org/git/?p=newlib-cygwin.git;a=blob;f=newlib/libc/include/math.h;h=d3f2e99ae4d33596b608225f0349a6d581d265ca;hb=8a0efa53e44919bcf5ccb1d3353618a82afdf8bc#l103 > > > > > > > > My guess is that at the time, there wasn't yet a separate log2() > > > > implementation, so this was an easy way to cover that case. > > > > > > > > > > Thank you very much for the reply. > > > So, do you think that it would be possible to remove those lines from > > > math.h and use the log2() now provided? > > > > > > Sincerely, > > > > > > Carlo Bramini > > > > > > > > > > -Dimitry > > > > > > > > > > > > > > -- > > > Problem reports: https://cygwin.com/problems.html > > > FAQ: https://cygwin.com/faq/ > > > Documentation: https://cygwin.com/docs.html > > > Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple > > > > -- > > Problem reports: https://cygwin.com/problems.html > > FAQ: https://cygwin.com/faq/ > > Documentation: https://cygwin.com/docs.html > > Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple -- Problem reports: https://cygwin.com/problems.html FAQ: https://cygwin.com/faq/ Documentation: https://cygwin.com/docs.html Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple