MathGroup Archive 2010

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: InputField Rounding Problem

  • To: mathgroup at smc.vnet.net
  • Subject: [mg109450] Re: InputField Rounding Problem
  • From: telefunkenvf14 <rgorka at gmail.com>
  • Date: Tue, 27 Apr 2010 07:51:06 -0400 (EDT)
  • References: <hr65pi$jmr$1@smc.vnet.net>

On Apr 27, 3:04 am, Chris Degnen <deg... at cwgsy.net> wrote:
> Hi. Any suggestions on how to stop the number type field below
> displaying input as 69.5999999...?   Thanks
>
> InputField[Dynamic[x], ImageSize -> {100, 20},
>  ContinuousAction -> True]
> x = 69.6
> InputField[Dynamic[y], Number, ImageSize -> {100, 20},
>  ContinuousAction -> True]
> y = 69.6

If I evaluate:

InputField[Dynamic[x], ImageSize -> {100, 20}, ContinuousAction ->
True]

Input 69.6 in the field. Now click outside of the field and then type
and evaluate x

In[179]:= x
Out[179]= 69.6

If you click in the output cell you'll see that x is in numerical
form, so I doubt you need to force InputField to display as Number.
(for underlying calculations, etc.) Although, I am a little confused
as to why your second example (using Number) would display all the
digits it does. If anything, shouldn't it be 69.600000000....? Seems
like a bug.

Maybe someone else will chime in.

-RG



  • Prev by Date: Re: Precision of calculations
  • Next by Date: Re: Database memory usage
  • Previous by thread: InputField Rounding Problem
  • Next by thread: Re: InputField Rounding Problem