From d244f20bf9a261185e898320e3bb8d906cca3990 Mon Sep 17 00:00:00 2001 From: "Carl A. B. Pearson" Date: Thu, 7 Nov 2024 15:11:05 -0500 Subject: [PATCH] fix a nan --- R/internal.R | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/R/internal.R b/R/internal.R index ffcb0fe..931e41f 100644 --- a/R/internal.R +++ b/R/internal.R @@ -179,8 +179,14 @@ to_function <- function(x, bounds, interp_opts) { kind <- callargs$kind callargs$kind <- NULL if (kind == "integral") { - ws <- diff(c(x[[1]], bounds[2])) - x[[2]] <- x[[2]]/ws + if (tail(x[[2]], 1) != 0) { + stop(sprintf( + "for integral data, the final entry should be 0; got instead: %s", + toString(tail(x[[2]], 1)) + )) + } + ws <- diff(x[[1]]) + x[[2]] <- c(x[[2]]/ws, 0) } } callargs$.usekind <- NULL