Skip to content

Commit 12eb40b

Browse files
authored
10965: extended normalDistribution domain support to +/-inf (#10966)
1 parent b9a61a8 commit 12eb40b

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

std/internal/math/errorfunction.d

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -984,6 +984,9 @@ Journal of Statistical Software <b>11</b>, (July 2004).
984984
*/
985985
real normalDistributionImpl(real a)
986986
{
987+
if (a is -real.infinity) return 0.0L;
988+
if (a is real.infinity) return 1.0L;
989+
987990
real x = a * SQRT1_2;
988991
real z = fabs(x);
989992

@@ -1005,6 +1008,8 @@ real normalDistributionImpl(real a)
10051008
{
10061009
assert(fabs(normalDistributionImpl(1L) - (0.841344746068543L)) < 0.0000000000000005L);
10071010
assert(isIdentical(normalDistributionImpl(NaN(0x325)), NaN(0x325)));
1011+
assert(normalDistributionImpl(-real.infinity) == 0.0L);
1012+
assert(normalDistributionImpl(real.infinity) == 1.0L);
10081013
}
10091014

10101015
/*

0 commit comments

Comments
 (0)