comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: -0.0
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: -0.0 [message #74547 is a reply to message #74533] Thu, 20 January 2011 14:29 Go to previous messageGo to previous message
pgrigis is currently offline  pgrigis
Messages: 436
Registered: September 2007
Senior Member
On Jan 20, 2:22 pm, kisCA <ki...@hotmail.com> wrote:
> I like this "sky is falling" things :-)
>
> I guess that it could be a problem of precision with float...the range
> should be higher in positive value in order to have 0 on the positive
> side?
>
> Thanks!

Well yes. What happens is that when you do

plot,[0,0],xrange=[-0.6,0.6],xtickv=vvv

is that the plot range is given by

r=!X.crange

print,r,format='(f13.10)'
-0.6000000238
0.5999999762

IDL presumably uses the following formula to create 7 tick marks:

tickv=r[0]+(r[1]-r[0])/6.0*findgen(7)

print,tickv,format='(f13.10)'
-0.6000000238
-0.4000000238
-0.2000000238
-0.0000000238
0.1999999762
0.3999999762
0.5999999762

When rounded to something more useful for plots:

print,tickv,format='(f4.1)'
-0.6
-0.4
-0.2
-0.0
0.2
0.4
0.6


That's how you get the negative zero.

Ciao,
Paolo
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Crashes in IDL 7.1 & 8.0, interactive + VM mode, linux and Mac OS X
Next Topic: FSC_contour & NaN

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 16:02:06 PDT 2025

Total time taken to generate the page: 0.00185 seconds