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()

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.

> 2. This is not strictly related to floating point, just noticed:
> 
>       :echo 1/0
>       2147483647
> 
>       :echo 1.0/0
>       2.147484e+09
> 
>    Shouldn't divide by 0 throw error?

The number you see is the largest int value or a special value for
floats which is INFINITY.  It has always worked this way for Ints, don't
know if it is such a good idea to do differently for floats.  Although I
would rather get the maximum value, INFINITY doesn't appear to be close
to infinity :-).  I suppose I should use MAXFLOAT instead.

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

And round()?
 
> 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.

-- 
For a moment, nothing happened.
Then, after a second or so, nothing continued to happen.
                -- Douglas Adams, "The Hitchhiker's Guide to the Galaxy"

 /// Bram Moolenaar -- [EMAIL PROTECTED] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\        download, build and distribute -- http://www.A-A-P.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

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

Raspunde prin e-mail lui