From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from primenet.com.au (ns1.primenet.com.au [203.24.36.2]) by inbox.vuxu.org (OpenSMTPD) with ESMTP id 2d2f64fa for ; Thu, 15 Nov 2018 12:35:39 +0000 (UTC) Received: (qmail 14549 invoked by alias); 15 Nov 2018 12:35:23 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: List-Unsubscribe: X-Seq: 43827 Received: (qmail 21373 invoked by uid 1010); 15 Nov 2018 12:35:23 -0000 X-Qmail-Scanner-Diagnostics: from rcpt-mqugw.biglobe.ne.jp by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.100.2/25112. spamassassin: 3.4.2. Clear:RC:0(133.208.100.2):SA:0(-2.6/5.0):. Processed in 2.492811 secs); 15 Nov 2018 12:35:23 -0000 X-Envelope-From: takimoto-j@kba.biglobe.ne.jp X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | X-Biglobe-Sender: From: Jun T Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 12.1 \(3445.101.1\)) Subject: =?utf-8?Q?Re=3A_Terminal_theme_tool_=E2=80=93_a_workaround_for_la?= =?utf-8?Q?ck_of_24-bit_color_in_Zsh=3F?= Date: Thu, 15 Nov 2018 20:50:24 +0900 References: <58111-1540942908.680582@SXAw.BXd_.-x5N> To: zsh-workers@zsh.org In-Reply-To: <58111-1540942908.680582@SXAw.BXd_.-x5N> Message-Id: X-Mailer: Apple Mail (2.3445.101.1) X-Biglobe-Spnum: 64233 In nearcolor.c, function RGBtoLAB(), floating point data are saved in float (not double) variables; for example: > + float R =3D (float)red / 255.0; (snip) > + R =3D 100.0 * (R > 0.04045 ? powf((R + 0.055) / 1.055, 2.4) : R = / 12.92); Is this to improve performance? If so, it would be better to explicitly use float literals, such as = 255.0f. Otherwise, since 255.0 is double, all the calculations are done in = double (after promoting all values to double), and the final result is = truncated back to float. I believe there is virtually no performance difference (on most CPUs). The reason I'm writing this is I'm getting lots of warnings like: nearcolor.c:55:18: warning: implicit conversion increases floating-point = precision: 'float' to 'double' [-Wdouble-promotion] R =3D 100.0 * (R > 0.04045 ? powf((R + 0.055) / 1.055, 2.4) : R / = 12.92); ^ ~ -Wdouble-promotion is OFF by default, but I still want to remove these warnings.=