cumsum: (Cumulative) Sums, Products of Large Integers and Rationals

Description Usage Arguments Value Author(s) See Also Examples

Description

Theses are methods to ‘overload’ the sum(), cumsum() and prod() functions for big rationals and big integers.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
## S3 method for class 'bigz'
cumsum(x)
## S3 method for class 'bigq'
cumsum(x)
## S3 method for class 'bigz'
sum(..., na.rm = FALSE)
## S3 method for class 'bigq'
sum(..., na.rm = FALSE)
## S3 method for class 'bigz'
prod(..., na.rm = FALSE)
## S3 method for class 'bigq'
prod(..., na.rm = FALSE)

Arguments

x, ...

R objects of class bigz or bigq or ‘simple’ numbers.

na.rm

logical indicating if missing values (NA) should be removed before the computation.

Value

return an element of class bigz or bigq.

Author(s)

Antoine Lucas

See Also

apply

Examples

1
2
3
4
5
6
7
8
9
 x <- as.bigz(1:12)
 cumsum(x)
 prod(x)
 sum(x)

 x <- as.bigq(1:12)
 cumsum(x)
 prod(x)
 sum(x)

gmp documentation built on May 29, 2017, 5:44 p.m.

Search within the gmp package
Search all R packages, documentation and source code