
(FPCore (ux uy maxCos)
:precision binary32
:pre (and (and (and (<= 2.328306437e-10 ux) (<= ux 1.0))
(and (<= 2.328306437e-10 uy) (<= uy 1.0)))
(and (<= 0.0 maxCos) (<= maxCos 1.0)))
(let* ((t_0 (+ (- 1.0 ux) (* ux maxCos))))
(* (cos (* (* uy 2.0) PI)) (sqrt (- 1.0 (* t_0 t_0))))))float code(float ux, float uy, float maxCos) {
float t_0 = (1.0f - ux) + (ux * maxCos);
return cosf(((uy * 2.0f) * ((float) M_PI))) * sqrtf((1.0f - (t_0 * t_0)));
}
function code(ux, uy, maxCos) t_0 = Float32(Float32(Float32(1.0) - ux) + Float32(ux * maxCos)) return Float32(cos(Float32(Float32(uy * Float32(2.0)) * Float32(pi))) * sqrt(Float32(Float32(1.0) - Float32(t_0 * t_0)))) end
function tmp = code(ux, uy, maxCos) t_0 = (single(1.0) - ux) + (ux * maxCos); tmp = cos(((uy * single(2.0)) * single(pi))) * sqrt((single(1.0) - (t_0 * t_0))); end
\begin{array}{l}
t_0 := \left(1 - ux\right) + ux \cdot maxCos\\
\cos \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - t\_0 \cdot t\_0}
\end{array}
herbie shell --seed 2025360
(FPCore (ux uy maxCos)
:name "UniformSampleCone, x"
:precision binary32
:pre (and (and (and (<= 2.328306437e-10 ux) (<= ux 1.0)) (and (<= 2.328306437e-10 uy) (<= uy 1.0))) (and (<= 0.0 maxCos) (<= maxCos 1.0)))
(* (cos (* (* uy 2.0) PI)) (sqrt (- 1.0 (* (+ (- 1.0 ux) (* ux maxCos)) (+ (- 1.0 ux) (* ux maxCos)))))))
Please file a bug report with this information.
| timeline-push!: contract violation expected: jsexpr? given: '#hash((nodes . (2 ("PI") 1 0 1/2 -2 ("+" 1 1))) (roots . (0 1 2 3 4 5 6))) in: the repeated argument of (-> symbol? jsexpr? ... void?) contract from: <pkgs>/herbie/utils/timeline.rkt blaming: <pkgs>/herbie/core/patch.rkt (assuming the contract is correct) at: <pkgs>/herbie/utils/timeline.rkt:9:24 | L | C | |
|---|---|---|---|
| raise-blame-error | /usr/share/racket/collects/racket/contract/private/blame.rkt | 346 | 0 |
| loop | /usr/share/racket/collects/racket/contract/private/list.rkt | 991 | 12 |
| (unnamed) | .../private/arrow-val-first.rkt | 486 | 18 |
| run-evaluate | /home/nightlies/herbie/batch-timeline/src/core/patch.rkt | 117 | 0 |
| generate-candidates | /home/nightlies/herbie/batch-timeline/src/core/patch.rkt | 204 | 0 |
| run-iteration! | /home/nightlies/herbie/batch-timeline/src/core/mainloop.rkt | 239 | 0 |
| run-improve! | /home/nightlies/herbie/batch-timeline/src/core/mainloop.rkt | 47 | 0 |
| get-alternatives | /home/nightlies/herbie/batch-timeline/src/api/sandbox.rkt | 61 | 0 |
| (unnamed) | /home/nightlies/herbie/batch-timeline/src/api/sandbox.rkt | 181 | 6 |
| (unnamed) | /usr/share/racket/pkgs/profile-lib/main.rkt | 40 | 10 |
| profile-thunk | /usr/share/racket/pkgs/profile-lib/main.rkt | 9 | 0 |
| in-engine | /home/nightlies/herbie/batch-timeline/src/api/sandbox.rkt | 197 | 2 |
| (unnamed) | /usr/share/racket/collects/racket/engine.rkt | 42 | 24 |