[R] Division ?

(Ted Harding) Ted.Harding at manchester.ac.uk
Sun May 3 11:11:04 CEST 2009


On 02-May-09 17:34:15, bogdanno wrote:
> It seems division with numbers bigger than 10 000 000 doesn't work
>  20000000/21
> [1] 952381
>> 55555555/23
> [1] 2415459
> 
> Thank you

I think you are confusing what is displayed with what is computed:

  20000000/21
# [1] 952381
  print(20000000/21,17)
# [1] 952380.9523809524

  55555555/23
# [1] 2415459
  print(55555555/23,17)
# [1] 2415458.913043478

  (20000000/21)*21
# [1] 2e+07
  print((20000000/21)*21,17)
# [1] 2e+07

  (55555555/23)*23
# [1] 55555555
  print((55555555/23)*23,17)
# [1] 55555555

Your "numbers bigger than 10 000 000" corresponds to the default
display of results to 7 significant figures.

If (as in the above print() statements) you increase this, you
get more "reasonable"-looking results.

Hoping this helps,
Ted.

--------------------------------------------------------------------
E-Mail: (Ted Harding) <Ted.Harding at manchester.ac.uk>
Fax-to-email: +44 (0)870 094 0861
Date: 03-May-09                                       Time: 10:11:02
------------------------------ XFMail ------------------------------




More information about the R-help mailing list