Re: [R] Number changed weirdly when converting to numeric

2025-03-10 Thread Stephanie Evert
Both atof() and strtod() give the correct result on my M1 MacBook. So it looks to me like a bug in R_strtod5(), possibly something that requires extended 80-bit precision to get the conversion right. Doesn't seem to be the fault of the ARM chip, so I'd say it warrants a bug report. Perhaps we

Re: [R] Number changed weirdly when converting to numeric

2025-03-09 Thread Stephanie Evert
For once, that doesn't seem to be the issue here. The bug only seems to happen on arm64 and doesn't reproduce on x86_64 hardware. > x <- as.numeric("-17725.33343267441") > sprintf("%.15f", x) [1] "-17725.33373069763" This is the number adjacent to -17725.33343267441 in IE

Re: [R] Weird and changed as.roman() behavior

2025-01-15 Thread Stephanie Evert
Well, the real issue then seems to be that .roman2numeric uses an invalid regular expression: >> grepl("^M{,3}D?C{,4}L?X{,4}V?I{,4}$", cc) > [1] TRUE TRUE TRUE TRUE TRUE or >> grepl("^I{,2}$", c("II", "III", "")) > [1] TRUE TRUE FALSE Both the TRE and the PCRE specification only allow