Dnia Monday 09 of June 2008, Bram Moolenaar napisał:
> Mikolaj Machowski wrote:
> > Things works, thanks :)
> >
> > Few things I'd like to see explained (fixed, implemented?):
> >
> > 1. Once a float, always a float. Don't see way to make float other
> > type of data - string, integer.
>
> String -> Float with str2float()
> Float -> String with printf()

OK, but...

> When would you need Float -> Int?  You can actually use
> printf(".0f", float), and rely on automatic String to Int conversion,
> but it's clumsy.

echo printf("%.0f", "0.4")
E807: expected Float argument for printf()

Also looks like printf() doesn't recognize "real" expression as
argument:

echo printf("%d", "4-2")
4

>
> > 3. floor(), ceil(), trunc() ?
>
> And round()?

Wouldn't hurt ;)

> > 4. Cosmetic thing but truncating of 0s in floating numbers would be
> > user friendly (eg. store and display 0.5 instead of 0.500000)
>
> I don't see an argument to printf() to get this.

To get proper result with printf you have to know precise. To get nice
visually results I have to go through Strings.

m.




--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Raspunde prin e-mail lui