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

Home » Public Forums » archive » Precision Problem
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Precision Problem [message #49403] Mon, 24 July 2006 09:51 Go to next message
DMac is currently offline  DMac
Messages: 6
Registered: May 2006
Junior Member
Hello All,
Using IDL version 6.2 on a Windows XP machine I am reading in a set of
coordinates from a binary file (it is LiDAR data stored in LAS Version
1.0 format) stored in UTM NAD83 Zone 11 and these points are stored as
4 byte long integers in the binary file . The coordinates are stored
in the binary file with an offset such that they need to be divided by
100 to obtain the actual coordinates. The binary file is read into a
heap variable (Data below). The X and Y coordinates are than written
from the heap variable into a double precision array as follows:
x = dblarr(Num_pts)
x = TEMPORARY(data.x*1.000e-002)

y = dblarr(Num_pts)
y = TEMPORARY(data.y*1.000e-002)

Eventually these points are output to an ESRI shapefile. My problem is
that the y coordinates are rounded to the nearest integer value in the
shapefile. The X coordinates are fine. The X coordinates are 6 digits
to the left of the decimal place while the Y coordinates are 7 digits
to the left of the decimal place

Can anyone shed any light on what is going on here or what I might be
doing wrong?

Thanks.

Derek M.
Re: Precision Problem [message #49483 is a reply to message #49403] Mon, 24 July 2006 15:10 Go to previous messageGo to next message
Mark Hadfield is currently offline  Mark Hadfield
Messages: 783
Registered: May 1995
Senior Member
DMac wrote:
> Thanks a bunch guys. That was the problem i.e. I should use 1.000d-002
> rather than the single precision literal 1.000e-002.

By the way, you can save yourself some valuable bytes and keystrokes by
writing those as 1d-2 and 1e-2.

--
Mark Hadfield "Kei puwaha te tai nei, Hoea tahi tatou"
m.hadfield@niwa.co.nz
National Institute for Water and Atmospheric Research (NIWA)
Re: precision problem [message #67663 is a reply to message #49403] Tue, 18 August 2009 05:58 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
skymaxwell@gmail.com writes:

> I have problem with precision.
> I typing
>
> IDL> b=13.37943889D
>
> and then i typing
>
> IDL> help,b
> B DOUBLE = 13.379439
>
> how get my 13.37943889 for calculus ?
> If IDL rounding value, i've got worst results
> Even for test example
>
> How avoid this problem ?

More reading, naturally.

http://www.dfanning.com/math_tips/sky_is_falling.html
http://www.dfanning.com/math_tips/double.html
http://www.dfanning.com/misc_tips/dbl_to_str.html

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: precision problem
Next Topic: Read BUFR Meteorological Data in IDL?

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

Current Time: Wed Oct 08 19:46:52 PDT 2025

Total time taken to generate the page: 0.00504 seconds