we are calculating the average of three user inputs (decimal) and
store the result in a "readonly" variable.
The calculation gives us far too many digits after the decimal point.
How can we control the number of digits after the decimal point?
There is an int(.) function which converts numbers to integers. So if you
want to truncate at the 0.01's, you should be able to do
number( int(. * 100) ) / 100.0
Mitch
···
On Thu, Apr 26, 2012 at 1:59 AM, LETSGO CeLeKT wrote:
Hi,
we are calculating the average of three user inputs (decimal) and
store the result in a "readonly" variable.
The calculation gives us far too many digits after the decimal point.
How can we control the number of digits after the decimal point?
···
On 26 Apr., 17:37, Mitch S wrote:
> There is an int(.) function which converts numbers to integers. So if you
> want to truncate at the 0.01's, you should be able to do
>
> number( int(. * 100) ) / 100.0
>
> Mitch
>
> On Thu, Apr 26, 2012 at 1:59 AM, LETSGO CeLeKT wrote:
>
> > Hi,
>
> > we are calculating the average of three user inputs (decimal) and
> > store the result in a "readonly" variable.
> > The calculation gives us far too many digits after the decimal point.
> > How can we control the number of digits after the decimal point?
>
> > Thank you!
>
> > --
> > Post: opendatakit@googlegroups.com
> > Unsubscribe: opendatakit+unsubscribe@googlegroups.com
> > Options:http://groups.google.com/group/opendatakit?hl=en
>
> --
> Mitch Sundt
> Software Engineer
> University of Washington
> mitchellsu...@gmail.com
--
Mitch Sundt
Software Engineer
University of Washington mitche...@gmail.com
Hi Mitch,
Just came across this number( int(. * 100) ) / 100.0 but I'm unable to use it.
Am having the calculation (today() - ${dob}) div 365.25 for the age.
How can I make sure the answer is in 2 decimal places?
Many Thanks,
John
···
On Thursday, April 26, 2012 6:37:56 PM UTC+3, Mitch Sundt wrote:
> On Thu, Apr 26, 2012 at 1:59 AM, LETSGO CeLeKT wrote:
--
Mitch Sundt
Software Engineer
University of Washington mitche...@gmail.com
Hi Mitch,
Just came across this number( int(. * 100) ) / 100.0 but I'm unable to
use it.
Am having the calculation (today() - ${dob}) div 365.25 for the age.
How can I make sure the answer is in 2 decimal places?