
(FPCore (xi yi zi ux uy maxCos)
:precision binary32
:pre (and (and (and (and (and (and (<= -10000.0 xi) (<= xi 10000.0))
(and (<= -10000.0 yi) (<= yi 10000.0)))
(and (<= -10000.0 zi) (<= zi 10000.0)))
(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) maxCos) ux))
(t_1 (sqrt (- 1.0 (* t_0 t_0))))
(t_2 (* (* uy 2.0) PI)))
(+
(+ (* (* (cos t_2) t_1) xi) (* (* (sin t_2) t_1) yi))
(* t_0 zi))))float code(float xi, float yi, float zi, float ux, float uy, float maxCos) {
float t_0 = ((1.0f - ux) * maxCos) * ux;
float t_1 = sqrtf((1.0f - (t_0 * t_0)));
float t_2 = (uy * 2.0f) * ((float) M_PI);
return (((cosf(t_2) * t_1) * xi) + ((sinf(t_2) * t_1) * yi)) + (t_0 * zi);
}
function code(xi, yi, zi, ux, uy, maxCos) t_0 = Float32(Float32(Float32(Float32(1.0) - ux) * maxCos) * ux) t_1 = sqrt(Float32(Float32(1.0) - Float32(t_0 * t_0))) t_2 = Float32(Float32(uy * Float32(2.0)) * Float32(pi)) return Float32(Float32(Float32(Float32(cos(t_2) * t_1) * xi) + Float32(Float32(sin(t_2) * t_1) * yi)) + Float32(t_0 * zi)) end
function tmp = code(xi, yi, zi, ux, uy, maxCos) t_0 = ((single(1.0) - ux) * maxCos) * ux; t_1 = sqrt((single(1.0) - (t_0 * t_0))); t_2 = (uy * single(2.0)) * single(pi); tmp = (((cos(t_2) * t_1) * xi) + ((sin(t_2) * t_1) * yi)) + (t_0 * zi); end
\begin{array}{l}
t_0 := \left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\\
t_1 := \sqrt{1 - t\_0 \cdot t\_0}\\
t_2 := \left(uy \cdot 2\right) \cdot \pi\\
\left(\left(\cos t\_2 \cdot t\_1\right) \cdot xi + \left(\sin t\_2 \cdot t\_1\right) \cdot yi\right) + t\_0 \cdot zi
\end{array}
herbie shell --seed 2025360
(FPCore (xi yi zi ux uy maxCos)
:name "UniformSampleCone 2"
:precision binary32
:pre (and (and (and (and (and (and (<= -10000.0 xi) (<= xi 10000.0)) (and (<= -10000.0 yi) (<= yi 10000.0))) (and (<= -10000.0 zi) (<= zi 10000.0))) (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) maxCos) ux) (* (* (- 1.0 ux) maxCos) ux))))) xi) (* (* (sin (* (* uy 2.0) PI)) (sqrt (- 1.0 (* (* (* (- 1.0 ux) maxCos) ux) (* (* (- 1.0 ux) maxCos) ux))))) yi)) (* (* (* (- 1.0 ux) maxCos) ux) zi)))
Please file a bug report with this information.
| timeline-push!: contract violation expected: jsexpr? given: '#hash((nodes . (2 ("PI") 1 -2 1/2 2/3 ("pow" 1 5) ("cbrt" 1))) (roots . (0 1 2 3 4 5 6 7))) 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 |