## Why my pdf does not integrate to \$1\$ numerically even though it does analytically?

I’m running a simulation to verify my pdfs integrate to $$1$$ numerically. My problem is that `pdfa` outputs `1.` but `pdfg` outputs `0.995075`. I understand it’s almost $$1$$ but still this slight error affect my subsequent simulations. Is this error resulting from computations? Is it fixable?

# Code

``a = 9.6117; b = 0.1581;  lamdaA = 0.00001; ha = 100; pta = 1; etaaN = 3.2; etaaL = 3;  lamdaG = 0.001; hg = 60; ptg = 1; etag = 3.6;  PL[rr_] := 1/(1 + a Exp[b (a - 180/\[Pi] ArcTan[ha/rr])])  Eg[rr_] := (pta/ptg)^(2/etaaL) (rr^2 + hg^2)^(etag/etaaL) - ha^2 Ea[rr_] := (ptg/pta)^(2/etag) (rr^2 + ha^2)^(etaaL/etag) - hg^2  frg[rr_] := 2 \[Pi] lamdaG rr Exp[-\[Pi] lamdaG rr^2]; Frg[rr_] := 1 - Exp[-\[Pi] lamdaG rr^2];  fra[rr_] := 2 \[Pi] lamdaA rr Exp[-\[Pi] lamdaA rr^2]; Fra[rr_] := 1 - Exp[-\[Pi] lamdaA rr^2]  intt1[rr_] := PL[rr] fra[rr] ; intt2[rr_] := PL[rr] fra[rr] Frg[Sqrt[Ea[rr]]];  If [Eg[0] > 0 ,  ppa = ( NIntegrate[intt1[t] , {t, 0, \[Infinity]}] -       NIntegrate[intt2[t], {t, Sqrt[Eg[0]], \[Infinity]}]);,  ppa = (NIntegrate[intt2[t], {t, 0, \[Infinity]}]);]  fxa1[xx_] := (PL[xx] fra[xx])/ppa;  fxa2[xx_] := (PL[xx] fra[xx])/ppa (1 - Frg[Sqrt[Ea[xx]]]); fxg1[xx_] := (PL[xx] frg[xx])/(1 - ppa); fxg2[xx_] := ((PL[xx] frg[xx])/(1 - ppa)) (1 - Fra[Sqrt[Eg[xx]]]);  pdfa1 := NIntegrate[fxa1[t], {t, 0, Sqrt[Eg[0]]}] +     NIntegrate[fxa2[t], {t, Sqrt[Eg[0]], \[Infinity]}]; pdfa2 := NIntegrate[fxa2[t], {t, 0, \[Infinity]}];  If[(Eg[0] > 0 ),  pdfa = pdfa1,  pdfa = pdfa2]  pdfg1 := NIntegrate[fxg1[t], {t, 0, Sqrt[Ea[0]]}] +     NIntegrate[fxg2[t], {t, Sqrt[Ea[0]], \[Infinity]}]; pdfg2 := NIntegrate[fxg2[t], {t, 0, \[Infinity]}];  If[(Ea[0] > 0 ),  pdfg = pdfg1,  pdfg = pdfg2] ``