On 02/12/08 05:31, Bill McCarthy wrote:
> On Mon 1-Dec-08 2:46am -0600, Tony Mechelynck wrote:
>
>> On 01/12/08 08:39, Bill McCarthy wrote:
>> [...]
>>> My C docs say a negative number produces a domain error. A
>>> zero produces a range error. Assuming these Open Watcom
>>> docs are correct, I've specified the argument must be a
>>> positive NUMBER or FLOAT, hence my notation (0,inf] - you
>>> correctly assumed my "(" means open and "]" means closed for
>>> ranges. Of course it may be better to always consider "inf"
>>> as open.
>>>
>>> Please let me know if you spot any errors or a need for
>>> clarification.
>>>
>
>> Not sure if it was an error, a need for clarification, or both, or neither.
>>
>> ":echo log(0)" answers -inf
>> ":echo log(log(0))" answers nan
>> ":echo log(log(log(0)))" still answers nan
>> ":echo log( 1. / 0. ) gives three Vim errors (the first of which is
>> "E15: Invalid expression: / 0. )"
>
> I build with Make_ming.mak under Windows.
>
> :echo log(0)
> -1.#INFe
> :echo log(-1)
> -1.#INDe
>
> If I write this in C:
>
> #include<stdio.h>
> #include<stdlib.h>
> #include<math.h>
>
> int main( void )
> {
> printf("%g\n",log(0.0));
> printf("%g\n",log(-1.0));
> return EXIT_SUCCESS;
> }
>
> Then compile/link with gcc I get:
>
> -1.#INF
> -1.#IND
>
> But when I compile/link with Open Watcom I get:
>
> -inf
> -nan
>
> This is quite strange, but not the fault of Vim (except
> perhaps that 'e' at the end).
>
Apparently the MinGW gcc libraries handles infinities and not-a-numbers
differently than the Linux gcc libraries (where I saw "-inf" and "nan"
as quoted above) when it comes to display them. (":echo log(-1.0)"
displays "nan" for me, without a sign.)
Notice the sentence near the bottom of ":help sqrt()":
"nan" may be different, it depends on system libraries.
I found it by ":helpgrep \<nan\>" which gives only three matches.
Best regards,
Tony.
--
Eight Megabytes And Continually Swapping.
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---