| RoundingHelper | R Documentation |
The class RoundingHelper provides the code and settings
to define numeric rounding rules for premiums, reserves, benefits etc. of
a life insurance contract. By default, no rounding it applied.
roundingThe (named) list containing all declared rounding definitions
new()Initialize the rounding settings
RoundingHelper$new(...)
...named entries specifying rounding accuracy
Sets up the rounding helper by giving a list of named entries, specifying rounding accuracy for each particular value
rounding = RoundingHelper$new(raw = 0, hundred = -2, accurate = 4)
rounding$round("raw", c(1234.567891, 0.00012345, 1234))
rounding$round("hundred", c(1234.567891, 0.00012345, 1234))
rounding$round("accurate", c(1234.567891, 0.00012345, 1234))
rounding$round("non-existing", c(1234.567891, 0.00012345, 1234))
round()Round the given values using the pre-defined accuracy
RoundingHelper$round(spec, value, ...)
specthe ID used for looking up the desired accuracy
valuethe values to be rounded according to 'spec'
...currently unused
Rounds the given values using the accuracies defined in the internal rounding list (set either via the 'initialize' function or via a call to 'setRounding'. The accuracies are defined using a 'spec' identifier, which allows to define different accuracies for different uses
rounding = RoundingHelper$new(raw = 0, hundred = -2, accurate = 4)
rounding$round("raw", c(1234.567891, 0.00012345, 1234))
rounding$round("hundred", c(1234.567891, 0.00012345, 1234))
rounding$round("accurate", c(1234.567891, 0.00012345, 1234))
# If the given spec does not exist, no rounding it applied
rounding$round("non-existing", c(1234.567891, 0.00012345, 1234))
setRounding()Define rounding accuracy for a certain identifier
RoundingHelper$setRounding(key, spec, ...)
keythe ID used for looking up the desired accuracy
specthe rounding accuracy (number of digits)
...currently unused
Configures the rounding helper for a given named entry, specifying rounding accuracy for each particular value
rounding = RoundingHelper$new(raw = 0, hundred = -2, accurate = 4)
rounding$round("raw", c(1234.567891, 0.00012345, 1234))
rounding$round("hundred", c(1234.567891, 0.00012345, 1234))
rounding$round("accurate", c(1234.567891, 0.00012345, 1234))
# If the given spec does not exist, no rounding it applied
rounding$round("non-existing", c(1234.567891, 0.00012345, 1234))
# Add a new spec with different settings:
rounding$setRounding("non-existing", 1)
rounding$round("non-existing", c(1234.567891, 0.00012345, 1234))
getRounding()Extract rounding accuracy for a certain identifier
RoundingHelper$getRounding(key, ...)
keythe ID used for looking up the desired accuracy
...currently unused
Read out the rounding for a given named entry.
rounding = RoundingHelper$new(raw = 0, hundred = -2, accurate = 4)
rounding$getRounding("hundred")
clone()The objects of this class are cloneable with this method.
RoundingHelper$clone(deep = FALSE)
deepWhether to make a deep clone.
# TODO
## ------------------------------------------------
## Method `RoundingHelper$new`
## ------------------------------------------------
rounding = RoundingHelper$new(raw = 0, hundred = -2, accurate = 4)
rounding$round("raw", c(1234.567891, 0.00012345, 1234))
rounding$round("hundred", c(1234.567891, 0.00012345, 1234))
rounding$round("accurate", c(1234.567891, 0.00012345, 1234))
rounding$round("non-existing", c(1234.567891, 0.00012345, 1234))
## ------------------------------------------------
## Method `RoundingHelper$round`
## ------------------------------------------------
rounding = RoundingHelper$new(raw = 0, hundred = -2, accurate = 4)
rounding$round("raw", c(1234.567891, 0.00012345, 1234))
rounding$round("hundred", c(1234.567891, 0.00012345, 1234))
rounding$round("accurate", c(1234.567891, 0.00012345, 1234))
# If the given spec does not exist, no rounding it applied
rounding$round("non-existing", c(1234.567891, 0.00012345, 1234))
## ------------------------------------------------
## Method `RoundingHelper$setRounding`
## ------------------------------------------------
rounding = RoundingHelper$new(raw = 0, hundred = -2, accurate = 4)
rounding$round("raw", c(1234.567891, 0.00012345, 1234))
rounding$round("hundred", c(1234.567891, 0.00012345, 1234))
rounding$round("accurate", c(1234.567891, 0.00012345, 1234))
# If the given spec does not exist, no rounding it applied
rounding$round("non-existing", c(1234.567891, 0.00012345, 1234))
# Add a new spec with different settings:
rounding$setRounding("non-existing", 1)
rounding$round("non-existing", c(1234.567891, 0.00012345, 1234))
## ------------------------------------------------
## Method `RoundingHelper$getRounding`
## ------------------------------------------------
rounding = RoundingHelper$new(raw = 0, hundred = -2, accurate = 4)
rounding$getRounding("hundred")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.