Re: (1-cos(x))/2 not equal (1/2)-(cos(x))/2

Tatsuro MATSUOKA <[email protected]> Sat, 23 Oct 2010 07:01:29 +0900 (JST)
Newsgroups gmane.comp.graphics.gnuplot.bugs
Message-ID <[email protected]>
Hello

What you pointed out is not a bug

Gnuplot recognize  1 and 2 are integer if you write 1/2.
Thus 1/2 is recognized as integer division.    

gnuplot> pr 1/2
0
In the case
(1 - cos(x))/2

cos(x) is real so that the above is what you want.

However,
Because 1/2=0

plot (1/2)-(cos(x))/2

is the same as

plot -cos(x)/2


You should write
plot 1./2-cos(x)/2

The above is the same as
1 - cos(x))/2

Regards

Tatsuro 
--- Gabriele Santambrogio <[email protected]> wrote:

> Hi,
>  my version:
> 
>   G N U P L O T
>         Version 4.0 patchlevel 0
>         last modified Thu Apr 15 14:44:22 CEST 2004
>         System: Darwin 10.4.0
> 
>  Gnuplot can do this correctly
> 
> gnuplot> plot (1 - cos(x))/2
> 
> but not this:
> 
> gnuplot> plot (1/2)-(cos(x))/2
> gnuplot> plot (1/2)-cos(x)/2    
> 
> see attachment.
> 
> Everything works fine if I substitute the 2s with 2.0s, but why does it work then in the first
> case?
> 
> Regards
> 
>  Gabriele Santambrogio
> > 
> --
>  Dr. Gabriele Santambrogio
>  Fritz-Haber-Institut der Max-Planck-Gesellschaft
>  Faradayweg 4-6, 14195 Berlin, Germany
>  Tel: +49 (0)30 8413 5734
>  Fax: +49 (0)30 8413 5603
> 
> > ------------------------------------------------------------------------------
> Nokia and AT&T present the 2010 Calling All Innovators-North America contest
> Create new apps & games for the Nokia N8 for consumers in  U.S. and Canada
> $10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
> Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store 
> http://p.sf.net/sfu/nokia-dev2dev> _______________________________________________
> gnuplot-bugs mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/gnuplot-bugs
> 


--------------------------------------
Get the new Internet Explorer 8 optimized for Yahoo! JAPAN
http://pr.mail.yahoo.co.jp/ie8/

------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in  U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store 
http://p.sf.net/sfu/nokia-dev2dev
_______________________________________________
gnuplot-bugs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gnuplot-bugs