Re: [SMARTY-DEV] New plugin
| From: | Patrick Emond | Date: | Tue, 27 May 2003 22:05:34 +0000 |
| Subject: | Re: [SMARTY-DEV] New plugin | ||
| References: | 1 2 3 4 5 | Groups: | php.smarty.dev |
| Request: | Send a blank email to php-smarty-dev+get-1516@lists.php.net to get a copy of this message | ||
On Tue, 2003-05-27 at 11:34, Piotr Klaban wrote:
> On Tue, May 27, 2003 at 10:12:05AM +0100, Patrick Emond wrote:
> > I've attached a new modifier plugin that I thought some of you may find handy. It
> > rounds a number to two orders of significance and adds it's size prefix (similar to adding the
> > -h option to an linux ls command). It supports up to a Yotta (1e24) in size.
> >
> > For example:
> >
> > 13990 -> 14.0K
> > 4520000 -> 4.5M
> > 123 -> 123
> > etc.
>
> Maybe it is better to divide by 1024, not by 1000.
>
I thought about dividing by powers of 2 but you'll notice in the plugin
that to speed up the calculation there isn't actually a division going
on - that and dividing by 1024 would suggest that we're working out
bytes and not any other unit (like scientific units for instance).
- Patrick
> > The name isn't so good so if anyone can think of anything better to call it please
> > let me know.
>
> In one of my app I called it nice_size() (nice to eyes).
>
> --
> Piotr Klaban
--
Patrick Emond <patrickemond@softhome.net>