repo.or.cz
/
hiphop-php.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
Error on self::class on non final classes
[hiphop-php.git]
/
hphp
/
hack
/
test
/
typecheck
/
div_union.php
blob
6910a54e60410822670e79f48640211936a07fac
1
<
?hh
// strict
2
// Copyright 2004-present Facebook. All Rights Reserved.
3
4
function
inverseCDF
(
float
$p
,
int
$n
):
float
{
5
$v
=
0.5
;
6
$dv
=
0.5
;
7
$x
=
0.0
;
8
while
(
$dv
>
1e-15
) {
9
$x
=
1
/
$v
-
1
;
10
$dv
=
$dv
/
2
;
11
if
(
cdf
(
$x
,
$n
) <
$p
) {
12
$v
=
$v
-
$dv
;
13
}
else
{
14
$v
=
$v
+
$dv
;
15
}
16
}
17
return
$x
;
18
}
19
20
function
cdf
(
float
$x
,
int
$n
):
float
{
21
return
$x
;
22
}