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

Home » Public Forums » archive » Re: round to x number of decimals within floating point value?
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: round to x number of decimals within floating point value? [message #74353 is a reply to message #74352] Thu, 13 January 2011 11:35 Go to previous messageGo to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Snow53 writes:

> I need to round the values within a file to three decimal places. For
> example, 0.00053335 would become 0.001.
> I also have many NaNs within the file.

goodval = where(array EQ Finite(), count)
if count gt 0 then begin
array[gooval] = Float(Round(array[goodval]*1000)/1000.)
endif

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Temp variables are checked out
Next Topic: Re: Temp variables are checked out

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

Current Time: Sun Oct 12 13:21:45 PDT 2025

Total time taken to generate the page: 2.40513 seconds