From 01060d234430a2ecad90b15407ba333ee375a069 Mon Sep 17 00:00:00 2001 From: rnhmjoj Date: Wed, 8 Apr 2020 13:42:25 +0000 Subject: [PATCH] ex-1: handle too large values in landau_cdf --- ex-1/landau.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ex-1/landau.c b/ex-1/landau.c index bef2c46..1098af3 100644 --- a/ex-1/landau.c +++ b/ex-1/landau.c @@ -32,8 +32,9 @@ double landau_cdf(double x, void* params) { gsl_integration_workspace* w = gsl_integration_workspace_alloc(iter); - // clip values too small - if (x < -200) x = -200; + // clip values too small or large values + if (x < -200) x = -200; + if (x > 100000) x = 100000; // We integrate the pdf in [x, +∞) instead // of (-∞, x] to avoid a singularity and