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

Home » Public Forums » archive » Re: rounding function
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: rounding function [message #2998] Fri, 14 October 1994 06:29
velt is currently offline  velt
Messages: 19
Registered: June 1994
Junior Member
> Does anyone have a little function that will round off a float or a double
> to a user-specified number of significant digits?


You don't need a routine for that. Just do:

rounded=1.0*round(10^d * myvalue)/10^d

where d is the number of digits you want.

Good luck,

Robert Velthuizen,
Digital Medical Imaging Program of the
H. Lee Moffitt Cancer Center and Research Institute at the
University of South Florida.
[Message index]
 
Read Message
Previous Topic: roundoff function
Next Topic: Image question.

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

Current Time: Wed Oct 08 15:31:32 PDT 2025

Total time taken to generate the page: 0.00482 seconds