On Wed, 2007-02-07 at 11:32 -0500, John Denker wrote:
> On 02/07/2007 09:47 AM, Ron Jensen wrote:
> > While working on 3D cockpit instruments I keep hitting into issues with
> > internal floating point representation and the <textranslate><step> tag.
> > 
> > The <step> tag effectively truncates the property, 29.919999999999
> > becomes 29.91, so a (3D) readout reads off one number. 
> 
> > I am proposing an new tag, <bias>, that will act like <offset> but be
> > applied before <step> and <scroll>
> 
> While the <bias> tag seems reasonable enough, the *first* step
> should be to repair the <step> feature so that it performs
> rounding rather than truncation.  This would greatly reduce
> the number of situations where <bias> would be required.
> 
> It seems likely that this change to <step> would immediately
> unbreak a goodly number of currently-broken instruments, and
> unlikely that it would break any currently-working instruments.
> 
> Leaving <step> the way it is would create a long-lasting trap
> for the unwary.
> 
> Let me put it the other way:  If there is any rationale for
> having <step> truncate rather than round, would somebody please
> explain what it is?

How would the step function know to round to the proper number of
decimal places?  In the 2D instruments a printf-style statement is used,
i.e. <format>%02.2f</format>.  However, we're not exactly printing in
<textranslate>.

I thought about a "<significant-digits>" tag where we could tell <step>
how to round.  So we could say:
  <significant-digits>2</significant-digits>
instead of:
  <bias>0.005</bias>
But the code for <significant-digits>2</significant-digits> would end up
just adding 0.005 to the property anyway, and having the finer grain
control in <bias> may prove useful in as-yet unthought of ways.

Ron






-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel

Reply via email to