Skip to content
Prev 48052 / 63424 Next

type.convert and doubles

On Thu, Apr 17, 2014 at 2:35 PM, Gabor Grothendieck
<ggrothendieck at gmail.com> wrote:
The columns that are "supposed" to be numeric are those that can fit
into a numeric data type.  Previously that was not always the case
with columns that could not be represented as a numeric erroneously
coerced into a truncated/rounded numeric.
You want a casting operation in your SQL query or similar if you want
a rounded type that will always fit in a double.  Cast or Convert
operators in SQL, or similar for however you are getting the data you
want to use with type.convert().  This is all application specific and
sort of beyond the scope of type.convert(), which now behaves as it
has been documented to behave.

In my code for this kind of thing I have however typically introduced
an option() to let the user control casting behavior for e.g. 64-bit
ints in C++.  Should they be returned as truncated precision numeric
types or the full precision data in a character string representation?
 In the RProtoBuf package we let the user specify an option() to
specify which behavior they need for their application as a shortcut
to just always returning the safer character representation and making
them coerce to numeric often.

            - Murray

Thread (30 messages)

Gregory R. Warnes type.convert and doubles Apr 11 Simon Urbanek type.convert and doubles Apr 11 Paul Gilbert type.convert and doubles Apr 11 McGehee, Robert type.convert and doubles Apr 17 Hadley Wickham type.convert and doubles Apr 17 Duncan Murdoch type.convert and doubles Apr 17 Murray Stokely type.convert and doubles Apr 17 Gabor Grothendieck type.convert and doubles Apr 17 Murray Stokely type.convert and doubles Apr 17 Paul Gilbert type.convert and doubles Apr 17 McGehee, Robert type.convert and doubles Apr 17 Martin Maechler type.convert and doubles Apr 19 Simon Urbanek type.convert and doubles Apr 19 Gabor Grothendieck type.convert and doubles Apr 19 Murray Stokely type.convert and doubles Apr 20 Gábor Csárdi type.convert and doubles Apr 20 Duncan Murdoch type.convert and doubles Apr 20 McGehee, Robert type.convert and doubles Apr 21 Martin Maechler type.convert and doubles Apr 22 Martin Maechler type.convert and doubles Apr 26 Gregory R. Warnes type.convert and doubles Apr 26 Hadley Wickham type.convert and doubles Apr 27 Duncan Murdoch type.convert and doubles Apr 27 Martin Maechler type.convert and doubles Apr 28 Peter Dalgaard type.convert and doubles Apr 29 Mark Bravington type.convert and doubles Apr 29 Martin Maechler type.convert and doubles Apr 29 Martin Maechler type.convert and doubles Apr 29 Martin Maechler type.convert and doubles Apr 29 Jan T. Kim type.convert and doubles Apr 29