UniformSampleCone, z

Percentage Accurate: 99.9% → 99.9%
Time: 1.8s
Alternatives: 4
Speedup: 1.0×

Specification

?
\[\left(\left(2.328306437 \cdot 10^{-10} \leq ux \land ux \leq 1\right) \land \left(2.328306437 \cdot 10^{-10} \leq uy \land uy \leq 1\right)\right) \land \left(0 \leq maxCos \land maxCos \leq 1\right)\]
\[\left(1 - ux\right) + ux \cdot maxCos \]
(FPCore (ux uy maxCos)
  :precision binary32
  (+ (- 1.0 ux) (* ux maxCos)))
float code(float ux, float uy, float maxCos) {
	return (1.0f - ux) + (ux * maxCos);
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(4) function code(ux, uy, maxcos)
use fmin_fmax_functions
    real(4), intent (in) :: ux
    real(4), intent (in) :: uy
    real(4), intent (in) :: maxcos
    code = (1.0e0 - ux) + (ux * maxcos)
end function
function code(ux, uy, maxCos)
	return Float32(Float32(Float32(1.0) - ux) + Float32(ux * maxCos))
end
function tmp = code(ux, uy, maxCos)
	tmp = (single(1.0) - ux) + (ux * maxCos);
end
\left(1 - ux\right) + ux \cdot maxCos

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 4 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 99.9% accurate, 1.0× speedup?

\[\left(1 - ux\right) + ux \cdot maxCos \]
(FPCore (ux uy maxCos)
  :precision binary32
  (+ (- 1.0 ux) (* ux maxCos)))
float code(float ux, float uy, float maxCos) {
	return (1.0f - ux) + (ux * maxCos);
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(4) function code(ux, uy, maxcos)
use fmin_fmax_functions
    real(4), intent (in) :: ux
    real(4), intent (in) :: uy
    real(4), intent (in) :: maxcos
    code = (1.0e0 - ux) + (ux * maxcos)
end function
function code(ux, uy, maxCos)
	return Float32(Float32(Float32(1.0) - ux) + Float32(ux * maxCos))
end
function tmp = code(ux, uy, maxCos)
	tmp = (single(1.0) - ux) + (ux * maxCos);
end
\left(1 - ux\right) + ux \cdot maxCos

Alternative 1: 99.9% accurate, 1.0× speedup?

\[\left(maxCos \cdot ux - ux\right) - -1 \]
(FPCore (ux uy maxCos)
  :precision binary32
  (- (- (* maxCos ux) ux) -1.0))
float code(float ux, float uy, float maxCos) {
	return ((maxCos * ux) - ux) - -1.0f;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(4) function code(ux, uy, maxcos)
use fmin_fmax_functions
    real(4), intent (in) :: ux
    real(4), intent (in) :: uy
    real(4), intent (in) :: maxcos
    code = ((maxcos * ux) - ux) - (-1.0e0)
end function
function code(ux, uy, maxCos)
	return Float32(Float32(Float32(maxCos * ux) - ux) - Float32(-1.0))
end
function tmp = code(ux, uy, maxCos)
	tmp = ((maxCos * ux) - ux) - single(-1.0);
end
\left(maxCos \cdot ux - ux\right) - -1
Derivation
  1. Initial program 99.9%

    \[\left(1 - ux\right) + ux \cdot maxCos \]
  2. Step-by-step derivation
    1. lift-+.f32N/A

      \[\leadsto \color{blue}{\left(1 - ux\right) + ux \cdot maxCos} \]
    2. lift-*.f32N/A

      \[\leadsto \left(1 - ux\right) + \color{blue}{ux \cdot maxCos} \]
    3. fp-cancel-sign-sub-invN/A

      \[\leadsto \color{blue}{\left(1 - ux\right) - \left(\mathsf{neg}\left(ux\right)\right) \cdot maxCos} \]
    4. lift--.f32N/A

      \[\leadsto \color{blue}{\left(1 - ux\right)} - \left(\mathsf{neg}\left(ux\right)\right) \cdot maxCos \]
    5. sub-flipN/A

      \[\leadsto \color{blue}{\left(1 + \left(\mathsf{neg}\left(ux\right)\right)\right)} - \left(\mathsf{neg}\left(ux\right)\right) \cdot maxCos \]
    6. associate--l+N/A

      \[\leadsto \color{blue}{1 + \left(\left(\mathsf{neg}\left(ux\right)\right) - \left(\mathsf{neg}\left(ux\right)\right) \cdot maxCos\right)} \]
    7. +-commutativeN/A

      \[\leadsto \color{blue}{\left(\left(\mathsf{neg}\left(ux\right)\right) - \left(\mathsf{neg}\left(ux\right)\right) \cdot maxCos\right) + 1} \]
    8. add-flip-revN/A

      \[\leadsto \color{blue}{\left(\left(\mathsf{neg}\left(ux\right)\right) - \left(\mathsf{neg}\left(ux\right)\right) \cdot maxCos\right) - \left(\mathsf{neg}\left(1\right)\right)} \]
    9. lower--.f32N/A

      \[\leadsto \color{blue}{\left(\left(\mathsf{neg}\left(ux\right)\right) - \left(\mathsf{neg}\left(ux\right)\right) \cdot maxCos\right) - \left(\mathsf{neg}\left(1\right)\right)} \]
    10. fp-cancel-sign-sub-invN/A

      \[\leadsto \color{blue}{\left(\left(\mathsf{neg}\left(ux\right)\right) + ux \cdot maxCos\right)} - \left(\mathsf{neg}\left(1\right)\right) \]
    11. lift-*.f32N/A

      \[\leadsto \left(\left(\mathsf{neg}\left(ux\right)\right) + \color{blue}{ux \cdot maxCos}\right) - \left(\mathsf{neg}\left(1\right)\right) \]
    12. +-commutativeN/A

      \[\leadsto \color{blue}{\left(ux \cdot maxCos + \left(\mathsf{neg}\left(ux\right)\right)\right)} - \left(\mathsf{neg}\left(1\right)\right) \]
    13. sub-flipN/A

      \[\leadsto \color{blue}{\left(ux \cdot maxCos - ux\right)} - \left(\mathsf{neg}\left(1\right)\right) \]
    14. lower--.f32N/A

      \[\leadsto \color{blue}{\left(ux \cdot maxCos - ux\right)} - \left(\mathsf{neg}\left(1\right)\right) \]
    15. lift-*.f32N/A

      \[\leadsto \left(\color{blue}{ux \cdot maxCos} - ux\right) - \left(\mathsf{neg}\left(1\right)\right) \]
    16. *-commutativeN/A

      \[\leadsto \left(\color{blue}{maxCos \cdot ux} - ux\right) - \left(\mathsf{neg}\left(1\right)\right) \]
    17. lower-*.f32N/A

      \[\leadsto \left(\color{blue}{maxCos \cdot ux} - ux\right) - \left(\mathsf{neg}\left(1\right)\right) \]
    18. metadata-eval99.9%

      \[\leadsto \left(maxCos \cdot ux - ux\right) - \color{blue}{-1} \]
  3. Applied rewrites99.9%

    \[\leadsto \color{blue}{\left(maxCos \cdot ux - ux\right) - -1} \]
  4. Add Preprocessing

Alternative 2: 99.9% accurate, 1.1× speedup?

\[\mathsf{fma}\left(ux, maxCos, 1 - ux\right) \]
(FPCore (ux uy maxCos)
  :precision binary32
  (fma ux maxCos (- 1.0 ux)))
float code(float ux, float uy, float maxCos) {
	return fmaf(ux, maxCos, (1.0f - ux));
}
function code(ux, uy, maxCos)
	return fma(ux, maxCos, Float32(Float32(1.0) - ux))
end
\mathsf{fma}\left(ux, maxCos, 1 - ux\right)
Derivation
  1. Initial program 99.9%

    \[\left(1 - ux\right) + ux \cdot maxCos \]
  2. Step-by-step derivation
    1. lift-+.f32N/A

      \[\leadsto \color{blue}{\left(1 - ux\right) + ux \cdot maxCos} \]
    2. +-commutativeN/A

      \[\leadsto \color{blue}{ux \cdot maxCos + \left(1 - ux\right)} \]
    3. lift-*.f32N/A

      \[\leadsto \color{blue}{ux \cdot maxCos} + \left(1 - ux\right) \]
    4. lower-fma.f3299.9%

      \[\leadsto \color{blue}{\mathsf{fma}\left(ux, maxCos, 1 - ux\right)} \]
  3. Applied rewrites99.9%

    \[\leadsto \color{blue}{\mathsf{fma}\left(ux, maxCos, 1 - ux\right)} \]
  4. Add Preprocessing

Alternative 3: 98.0% accurate, 2.6× speedup?

\[1 - ux \]
(FPCore (ux uy maxCos)
  :precision binary32
  (- 1.0 ux))
float code(float ux, float uy, float maxCos) {
	return 1.0f - ux;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(4) function code(ux, uy, maxcos)
use fmin_fmax_functions
    real(4), intent (in) :: ux
    real(4), intent (in) :: uy
    real(4), intent (in) :: maxcos
    code = 1.0e0 - ux
end function
function code(ux, uy, maxCos)
	return Float32(Float32(1.0) - ux)
end
function tmp = code(ux, uy, maxCos)
	tmp = single(1.0) - ux;
end
1 - ux
Derivation
  1. Initial program 99.9%

    \[\left(1 - ux\right) + ux \cdot maxCos \]
  2. Taylor expanded in maxCos around 0

    \[\leadsto \color{blue}{1 - ux} \]
  3. Step-by-step derivation
    1. lower--.f3298.0%

      \[\leadsto 1 - \color{blue}{ux} \]
  4. Applied rewrites98.0%

    \[\leadsto \color{blue}{1 - ux} \]
  5. Add Preprocessing

Alternative 4: 71.3% accurate, 9.2× speedup?

\[1 \]
(FPCore (ux uy maxCos)
  :precision binary32
  1.0)
float code(float ux, float uy, float maxCos) {
	return 1.0f;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(4) function code(ux, uy, maxcos)
use fmin_fmax_functions
    real(4), intent (in) :: ux
    real(4), intent (in) :: uy
    real(4), intent (in) :: maxcos
    code = 1.0e0
end function
function code(ux, uy, maxCos)
	return Float32(1.0)
end
function tmp = code(ux, uy, maxCos)
	tmp = single(1.0);
end
1
Derivation
  1. Initial program 99.9%

    \[\left(1 - ux\right) + ux \cdot maxCos \]
  2. Step-by-step derivation
    1. lift-+.f32N/A

      \[\leadsto \color{blue}{\left(1 - ux\right) + ux \cdot maxCos} \]
    2. lift-*.f32N/A

      \[\leadsto \left(1 - ux\right) + \color{blue}{ux \cdot maxCos} \]
    3. fp-cancel-sign-sub-invN/A

      \[\leadsto \color{blue}{\left(1 - ux\right) - \left(\mathsf{neg}\left(ux\right)\right) \cdot maxCos} \]
    4. lift--.f32N/A

      \[\leadsto \color{blue}{\left(1 - ux\right)} - \left(\mathsf{neg}\left(ux\right)\right) \cdot maxCos \]
    5. sub-flipN/A

      \[\leadsto \color{blue}{\left(1 + \left(\mathsf{neg}\left(ux\right)\right)\right)} - \left(\mathsf{neg}\left(ux\right)\right) \cdot maxCos \]
    6. associate--l+N/A

      \[\leadsto \color{blue}{1 + \left(\left(\mathsf{neg}\left(ux\right)\right) - \left(\mathsf{neg}\left(ux\right)\right) \cdot maxCos\right)} \]
    7. +-commutativeN/A

      \[\leadsto \color{blue}{\left(\left(\mathsf{neg}\left(ux\right)\right) - \left(\mathsf{neg}\left(ux\right)\right) \cdot maxCos\right) + 1} \]
    8. add-flip-revN/A

      \[\leadsto \color{blue}{\left(\left(\mathsf{neg}\left(ux\right)\right) - \left(\mathsf{neg}\left(ux\right)\right) \cdot maxCos\right) - \left(\mathsf{neg}\left(1\right)\right)} \]
    9. lower--.f32N/A

      \[\leadsto \color{blue}{\left(\left(\mathsf{neg}\left(ux\right)\right) - \left(\mathsf{neg}\left(ux\right)\right) \cdot maxCos\right) - \left(\mathsf{neg}\left(1\right)\right)} \]
    10. fp-cancel-sign-sub-invN/A

      \[\leadsto \color{blue}{\left(\left(\mathsf{neg}\left(ux\right)\right) + ux \cdot maxCos\right)} - \left(\mathsf{neg}\left(1\right)\right) \]
    11. lift-*.f32N/A

      \[\leadsto \left(\left(\mathsf{neg}\left(ux\right)\right) + \color{blue}{ux \cdot maxCos}\right) - \left(\mathsf{neg}\left(1\right)\right) \]
    12. +-commutativeN/A

      \[\leadsto \color{blue}{\left(ux \cdot maxCos + \left(\mathsf{neg}\left(ux\right)\right)\right)} - \left(\mathsf{neg}\left(1\right)\right) \]
    13. sub-flipN/A

      \[\leadsto \color{blue}{\left(ux \cdot maxCos - ux\right)} - \left(\mathsf{neg}\left(1\right)\right) \]
    14. lower--.f32N/A

      \[\leadsto \color{blue}{\left(ux \cdot maxCos - ux\right)} - \left(\mathsf{neg}\left(1\right)\right) \]
    15. lift-*.f32N/A

      \[\leadsto \left(\color{blue}{ux \cdot maxCos} - ux\right) - \left(\mathsf{neg}\left(1\right)\right) \]
    16. *-commutativeN/A

      \[\leadsto \left(\color{blue}{maxCos \cdot ux} - ux\right) - \left(\mathsf{neg}\left(1\right)\right) \]
    17. lower-*.f32N/A

      \[\leadsto \left(\color{blue}{maxCos \cdot ux} - ux\right) - \left(\mathsf{neg}\left(1\right)\right) \]
    18. metadata-eval99.9%

      \[\leadsto \left(maxCos \cdot ux - ux\right) - \color{blue}{-1} \]
  3. Applied rewrites99.9%

    \[\leadsto \color{blue}{\left(maxCos \cdot ux - ux\right) - -1} \]
  4. Taylor expanded in ux around 0

    \[\leadsto \color{blue}{1} \]
  5. Step-by-step derivation
    1. Applied rewrites71.3%

      \[\leadsto \color{blue}{1} \]
    2. Add Preprocessing

    Reproduce

    ?
    herbie shell --seed 2025227 
    (FPCore (ux uy maxCos)
      :name "UniformSampleCone, z"
      :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)))
      (+ (- 1.0 ux) (* ux maxCos)))