It is currently 22 May 2013, 09:26

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Reducing the number of decimals in a floating point value
PostPosted: 15 Jul 2010, 10:26 
Offline
User avatar

Joined: 19 Jun 2009, 17:07
Posts: 3
Hi

I'm tryng to animate a text that display the distance between two objects.
I reach to add a scripted operator and to connect it to a ctr_dist value.

The problem is that the value I obtain with GetValue is a floating point with 16 decimals.
Here te result:
Image

How I can reduce the number of decimals? I need to display only one or two decimals.
I tried also to convert the value from Float to Integer and creating two animated text, but as you can see in the pictures, the values are (obviously) approximated to the near integer and so, a value of 8,61 is displayed as 9.

Anyone knows how to solve it?

_________________
(sorry for my english)

W.I.P: Eurocopter AS-350


Top
 Profile  
 
 Post subject: Re: Reducing the number of decimals in a floating point value
PostPosted: 15 Jul 2010, 17:25 
Offline

Joined: 03 Jan 2010, 01:40
Posts: 107
Location: Portugal
round(ctr_dist( _nl., _nl1. ) * 100) / 100 - put this in the "Value" parameter
maybe there's even an easier way, but this is what came to my mind right away.

_________________
Tiago Beijoco
http://www.craft.host56.com


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group