zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.stephenson@samsung.com>
To: <zsh-workers@zsh.org>
Subject: Re: Terminal theme tool – a workaround for lack of 24-bit color in Zsh?
Date: Thu, 15 Nov 2018 12:44:37 +0000	[thread overview]
Message-ID: <1542285877.4637.3.camel@samsung.com> (raw)
In-Reply-To: <B2AC3BAB-4105-4C49-BE8C-55DA32F94DE7@kba.biglobe.ne.jp>

On Thu, 2018-11-15 at 20:50 +0900, Jun T wrote:
> In nearcolor.c, function RGBtoLAB(), floating point data are saved in
> float (not double) variables; for example:
> 
> > 
> > +     float R = (float)red / 255.0;
> (snip)
> > 
> > +     R = 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 majority of standardish Unixy systems I know about are designed to
assume most floating point calculations are going to be done as double
--- I see Linux supplies float and long double versions of library
functions as a supplement.  But I doubt Oliver was thinking that much
about optimisation here --- terminal IO is slow enough I can't see how
it could be a big deal.

pws


  reply	other threads:[~2018-11-15 12:53 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CAKc7PVCEmTTMRR0P3kx9ktpLDBYqJ+MRsE77UMLFjonEZAixfA@mail.gmail.com>
2018-10-30 23:41 ` Oliver Kiddle
2018-11-01 18:42   ` dana
2018-11-04  1:42   ` PATCH: true colour support Oliver Kiddle
2018-11-04 22:57     ` Oliver Kiddle
2018-11-05 14:36     ` Sebastian Gniazdowski
     [not found]       ` <46482-1541429525.040210@53iC.Cv7F.M2xE>
2018-11-05 15:48         ` Sebastian Gniazdowski
2018-11-05 16:22           ` Sebastian Gniazdowski
2018-11-06 12:12     ` Sebastian Gniazdowski
2018-11-06 13:37       ` Oliver Kiddle
2018-11-06 21:46         ` Sebastian Gniazdowski
2018-11-06 12:22     ` Should there be a Zsh release for true-color support to adopt earlier? Sebastian Gniazdowski
2018-11-06 22:35       ` Daniel Shahaf
2018-11-06 23:46         ` Bart Schaefer
2018-11-05 14:03   ` Terminal theme tool – a workaround for lack of 24-bit color in Zsh? Sebastian Gniazdowski
2018-11-15 11:50   ` Jun T
2018-11-15 12:44     ` Peter Stephenson [this message]
2018-11-16  7:54       ` Jun T
2018-11-19  8:29         ` Oliver Kiddle

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1542285877.4637.3.camel@samsung.com \
    --to=p.stephenson@samsung.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).