# Regenerate the R column of t/pf_pt_tails.R.mpmath.t:
#
#     Rscript t/pf_pt_tails.R.R
#
# and paste the output into that file's __DATA__ block after the %%R%% marker.
# Written against R 4.6.1 (2026-06-24).  The test reads only the frozen
# literals and never invokes R; installing or testing Stats::LikeR needs no R.
#
# The grid here must stay identical to the one in t/pf_pt_tails.mpmath.py,
# because the .t file joins the two tables on (kind, arg, df1, df2).  R is not
# the authority in this file -- mpmath at mp.dps = 80 is -- and R's own qf() is
# recorded here precisely because it is the side that disagrees with mpmath, by
# up to 1.4e-3 relative in the far lower tail.

options(digits = 17, warn = -1)

PF_DF <- list(c(1,1), c(1,5), c(1,100), c(1,1e6), c(2,2), c(2,100),
              c(5,5), c(5,1e6), c(20,20), c(100,100))
PF_Q  <- c(1e-12, 1e-10, 1e-8, 1e-6, 1e-4, 1e-2, 0.1, 0.5, 1, 2, 10, 100)
PT_DF <- c(1, 2, 3, 5, 10, 100, 1e6)
PT_T  <- c(-100, -10, -2, -1, -1e-2, -1e-4, -1e-6, -1e-8, -1e-10, -1e-12,
           1e-12, 1e-10, 1e-8, 1e-6, 1e-4, 1e-2, 1, 2, 10, 100)
QF_DF <- list(c(1,1), c(1,2), c(1,5), c(1,20), c(1,100), c(2,1), c(2,5),
              c(2,20), c(2,100), c(5,5), c(5,20), c(20,100))
QF_P  <- c(1e-10, 1e-8, 1e-6, 1e-4, 1e-3, 0.01, 0.5, 0.95, 0.999)

cat("# Generated by t/pf_pt_tails.R.R under", R.version.string, "\n")
cat("#kind\targ\tdf1\tdf2\tlower\tupper\n")
for (d in PF_DF) for (q in PF_Q)
	cat(sprintf("pf\t%.17g\t%g\t%g\t%.17g\t%.17g\n", q, d[1], d[2],
	            pf(q, d[1], d[2]), pf(q, d[1], d[2], lower.tail = FALSE)))
for (df in PT_DF) for (t in PT_T)
	cat(sprintf("pt\t%.17g\t%g\t-\t%.17g\t%.17g\n", t, df,
	            pt(t, df), pt(t, df, lower.tail = FALSE)))
for (d in QF_DF) for (p in QF_P)
	cat(sprintf("qf\t%.17g\t%g\t%g\t%.17g\t-\n", p, d[1], d[2], qf(p, d[1], d[2])))
