
(FPCore (x y z) :precision binary64 (+ 1.0 (/ (* 4.0 (- (+ x (* y 0.75)) z)) y)))
double code(double x, double y, double z) {
return 1.0 + ((4.0 * ((x + (y * 0.75)) - z)) / y);
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = 1.0d0 + ((4.0d0 * ((x + (y * 0.75d0)) - z)) / y)
end function
public static double code(double x, double y, double z) {
return 1.0 + ((4.0 * ((x + (y * 0.75)) - z)) / y);
}
def code(x, y, z): return 1.0 + ((4.0 * ((x + (y * 0.75)) - z)) / y)
function code(x, y, z) return Float64(1.0 + Float64(Float64(4.0 * Float64(Float64(x + Float64(y * 0.75)) - z)) / y)) end
function tmp = code(x, y, z) tmp = 1.0 + ((4.0 * ((x + (y * 0.75)) - z)) / y); end
code[x_, y_, z_] := N[(1.0 + N[(N[(4.0 * N[(N[(x + N[(y * 0.75), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 + \frac{4 \cdot \left(\left(x + y \cdot 0.75\right) - z\right)}{y}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (+ 1.0 (/ (* 4.0 (- (+ x (* y 0.75)) z)) y)))
double code(double x, double y, double z) {
return 1.0 + ((4.0 * ((x + (y * 0.75)) - z)) / y);
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = 1.0d0 + ((4.0d0 * ((x + (y * 0.75d0)) - z)) / y)
end function
public static double code(double x, double y, double z) {
return 1.0 + ((4.0 * ((x + (y * 0.75)) - z)) / y);
}
def code(x, y, z): return 1.0 + ((4.0 * ((x + (y * 0.75)) - z)) / y)
function code(x, y, z) return Float64(1.0 + Float64(Float64(4.0 * Float64(Float64(x + Float64(y * 0.75)) - z)) / y)) end
function tmp = code(x, y, z) tmp = 1.0 + ((4.0 * ((x + (y * 0.75)) - z)) / y); end
code[x_, y_, z_] := N[(1.0 + N[(N[(4.0 * N[(N[(x + N[(y * 0.75), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 + \frac{4 \cdot \left(\left(x + y \cdot 0.75\right) - z\right)}{y}
\end{array}
(FPCore (x y z) :precision binary64 (fma (/ 4.0 y) (- (fma y 0.75 x) z) 1.0))
double code(double x, double y, double z) {
return fma((4.0 / y), (fma(y, 0.75, x) - z), 1.0);
}
function code(x, y, z) return fma(Float64(4.0 / y), Float64(fma(y, 0.75, x) - z), 1.0) end
code[x_, y_, z_] := N[(N[(4.0 / y), $MachinePrecision] * N[(N[(y * 0.75 + x), $MachinePrecision] - z), $MachinePrecision] + 1.0), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\frac{4}{y}, \mathsf{fma}\left(y, 0.75, x\right) - z, 1\right)
\end{array}
Initial program 99.1%
+-commutativeN/A
clear-numN/A
associate-/r*N/A
associate-/r/N/A
clear-numN/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f64N/A
--lowering--.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f6499.7
Applied egg-rr99.7%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (/ (* 4.0 (- (+ x (* y 0.75)) z)) y)))
(if (<= t_0 -50.0)
(fma (/ 4.0 y) (- x z) 1.0)
(if (<= t_0 2000000000.0) (fma (/ 4.0 y) x 4.0) (/ (* 4.0 (- x z)) y)))))
double code(double x, double y, double z) {
double t_0 = (4.0 * ((x + (y * 0.75)) - z)) / y;
double tmp;
if (t_0 <= -50.0) {
tmp = fma((4.0 / y), (x - z), 1.0);
} else if (t_0 <= 2000000000.0) {
tmp = fma((4.0 / y), x, 4.0);
} else {
tmp = (4.0 * (x - z)) / y;
}
return tmp;
}
function code(x, y, z) t_0 = Float64(Float64(4.0 * Float64(Float64(x + Float64(y * 0.75)) - z)) / y) tmp = 0.0 if (t_0 <= -50.0) tmp = fma(Float64(4.0 / y), Float64(x - z), 1.0); elseif (t_0 <= 2000000000.0) tmp = fma(Float64(4.0 / y), x, 4.0); else tmp = Float64(Float64(4.0 * Float64(x - z)) / y); end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(4.0 * N[(N[(x + N[(y * 0.75), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]}, If[LessEqual[t$95$0, -50.0], N[(N[(4.0 / y), $MachinePrecision] * N[(x - z), $MachinePrecision] + 1.0), $MachinePrecision], If[LessEqual[t$95$0, 2000000000.0], N[(N[(4.0 / y), $MachinePrecision] * x + 4.0), $MachinePrecision], N[(N[(4.0 * N[(x - z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{4 \cdot \left(\left(x + y \cdot 0.75\right) - z\right)}{y}\\
\mathbf{if}\;t\_0 \leq -50:\\
\;\;\;\;\mathsf{fma}\left(\frac{4}{y}, x - z, 1\right)\\
\mathbf{elif}\;t\_0 \leq 2000000000:\\
\;\;\;\;\mathsf{fma}\left(\frac{4}{y}, x, 4\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{4 \cdot \left(x - z\right)}{y}\\
\end{array}
\end{array}
if (/.f64 (*.f64 #s(literal 4 binary64) (-.f64 (+.f64 x (*.f64 y #s(literal 3/4 binary64))) z)) y) < -50Initial program 98.7%
+-commutativeN/A
clear-numN/A
associate-/r*N/A
associate-/r/N/A
clear-numN/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f64N/A
--lowering--.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f6499.7
Applied egg-rr99.7%
Taylor expanded in y around 0
--lowering--.f6498.4
Simplified98.4%
if -50 < (/.f64 (*.f64 #s(literal 4 binary64) (-.f64 (+.f64 x (*.f64 y #s(literal 3/4 binary64))) z)) y) < 2e9Initial program 99.8%
Taylor expanded in z around 0
Simplified98.7%
distribute-neg-inN/A
*-commutativeN/A
distribute-lft-neg-inN/A
distribute-frac-neg2N/A
metadata-evalN/A
frac-2negN/A
metadata-evalN/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f6498.7
Applied egg-rr98.7%
if 2e9 < (/.f64 (*.f64 #s(literal 4 binary64) (-.f64 (+.f64 x (*.f64 y #s(literal 3/4 binary64))) z)) y) Initial program 98.8%
Taylor expanded in y around 0
associate-*r/N/A
/-lowering-/.f64N/A
Simplified98.8%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (/ (* 4.0 (- (+ x (* y 0.75)) z)) y)))
(if (<= t_0 -50.0)
(* (/ 4.0 y) (- x z))
(if (<= t_0 2000000000.0) (fma (/ 4.0 y) x 4.0) (/ (* 4.0 (- x z)) y)))))
double code(double x, double y, double z) {
double t_0 = (4.0 * ((x + (y * 0.75)) - z)) / y;
double tmp;
if (t_0 <= -50.0) {
tmp = (4.0 / y) * (x - z);
} else if (t_0 <= 2000000000.0) {
tmp = fma((4.0 / y), x, 4.0);
} else {
tmp = (4.0 * (x - z)) / y;
}
return tmp;
}
function code(x, y, z) t_0 = Float64(Float64(4.0 * Float64(Float64(x + Float64(y * 0.75)) - z)) / y) tmp = 0.0 if (t_0 <= -50.0) tmp = Float64(Float64(4.0 / y) * Float64(x - z)); elseif (t_0 <= 2000000000.0) tmp = fma(Float64(4.0 / y), x, 4.0); else tmp = Float64(Float64(4.0 * Float64(x - z)) / y); end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(4.0 * N[(N[(x + N[(y * 0.75), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]}, If[LessEqual[t$95$0, -50.0], N[(N[(4.0 / y), $MachinePrecision] * N[(x - z), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 2000000000.0], N[(N[(4.0 / y), $MachinePrecision] * x + 4.0), $MachinePrecision], N[(N[(4.0 * N[(x - z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{4 \cdot \left(\left(x + y \cdot 0.75\right) - z\right)}{y}\\
\mathbf{if}\;t\_0 \leq -50:\\
\;\;\;\;\frac{4}{y} \cdot \left(x - z\right)\\
\mathbf{elif}\;t\_0 \leq 2000000000:\\
\;\;\;\;\mathsf{fma}\left(\frac{4}{y}, x, 4\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{4 \cdot \left(x - z\right)}{y}\\
\end{array}
\end{array}
if (/.f64 (*.f64 #s(literal 4 binary64) (-.f64 (+.f64 x (*.f64 y #s(literal 3/4 binary64))) z)) y) < -50Initial program 98.7%
Taylor expanded in y around 0
associate-*r/N/A
/-lowering-/.f64N/A
Simplified97.4%
*-commutativeN/A
associate-/l*N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
/-lowering-/.f6498.4
Applied egg-rr98.4%
if -50 < (/.f64 (*.f64 #s(literal 4 binary64) (-.f64 (+.f64 x (*.f64 y #s(literal 3/4 binary64))) z)) y) < 2e9Initial program 99.8%
Taylor expanded in z around 0
Simplified98.7%
distribute-neg-inN/A
*-commutativeN/A
distribute-lft-neg-inN/A
distribute-frac-neg2N/A
metadata-evalN/A
frac-2negN/A
metadata-evalN/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f6498.7
Applied egg-rr98.7%
if 2e9 < (/.f64 (*.f64 #s(literal 4 binary64) (-.f64 (+.f64 x (*.f64 y #s(literal 3/4 binary64))) z)) y) Initial program 98.8%
Taylor expanded in y around 0
associate-*r/N/A
/-lowering-/.f64N/A
Simplified98.8%
Final simplification98.6%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (/ 4.0 y) (- x z))) (t_1 (/ (* 4.0 (- (+ x (* y 0.75)) z)) y)))
(if (<= t_1 -50.0)
t_0
(if (<= t_1 2000000000.0) (fma (/ 4.0 y) x 4.0) t_0))))
double code(double x, double y, double z) {
double t_0 = (4.0 / y) * (x - z);
double t_1 = (4.0 * ((x + (y * 0.75)) - z)) / y;
double tmp;
if (t_1 <= -50.0) {
tmp = t_0;
} else if (t_1 <= 2000000000.0) {
tmp = fma((4.0 / y), x, 4.0);
} else {
tmp = t_0;
}
return tmp;
}
function code(x, y, z) t_0 = Float64(Float64(4.0 / y) * Float64(x - z)) t_1 = Float64(Float64(4.0 * Float64(Float64(x + Float64(y * 0.75)) - z)) / y) tmp = 0.0 if (t_1 <= -50.0) tmp = t_0; elseif (t_1 <= 2000000000.0) tmp = fma(Float64(4.0 / y), x, 4.0); else tmp = t_0; end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(4.0 / y), $MachinePrecision] * N[(x - z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(4.0 * N[(N[(x + N[(y * 0.75), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]}, If[LessEqual[t$95$1, -50.0], t$95$0, If[LessEqual[t$95$1, 2000000000.0], N[(N[(4.0 / y), $MachinePrecision] * x + 4.0), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{4}{y} \cdot \left(x - z\right)\\
t_1 := \frac{4 \cdot \left(\left(x + y \cdot 0.75\right) - z\right)}{y}\\
\mathbf{if}\;t\_1 \leq -50:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;t\_1 \leq 2000000000:\\
\;\;\;\;\mathsf{fma}\left(\frac{4}{y}, x, 4\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if (/.f64 (*.f64 #s(literal 4 binary64) (-.f64 (+.f64 x (*.f64 y #s(literal 3/4 binary64))) z)) y) < -50 or 2e9 < (/.f64 (*.f64 #s(literal 4 binary64) (-.f64 (+.f64 x (*.f64 y #s(literal 3/4 binary64))) z)) y) Initial program 98.8%
Taylor expanded in y around 0
associate-*r/N/A
/-lowering-/.f64N/A
Simplified98.1%
*-commutativeN/A
associate-/l*N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
/-lowering-/.f6498.5
Applied egg-rr98.5%
if -50 < (/.f64 (*.f64 #s(literal 4 binary64) (-.f64 (+.f64 x (*.f64 y #s(literal 3/4 binary64))) z)) y) < 2e9Initial program 99.8%
Taylor expanded in z around 0
Simplified98.7%
distribute-neg-inN/A
*-commutativeN/A
distribute-lft-neg-inN/A
distribute-frac-neg2N/A
metadata-evalN/A
frac-2negN/A
metadata-evalN/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f6498.7
Applied egg-rr98.7%
Final simplification98.5%
(FPCore (x y z) :precision binary64 (let* ((t_0 (/ (* 4.0 x) y)) (t_1 (/ (* 4.0 (- (+ x (* y 0.75)) z)) y))) (if (<= t_1 -50.0) t_0 (if (<= t_1 5.0) 4.0 t_0))))
double code(double x, double y, double z) {
double t_0 = (4.0 * x) / y;
double t_1 = (4.0 * ((x + (y * 0.75)) - z)) / y;
double tmp;
if (t_1 <= -50.0) {
tmp = t_0;
} else if (t_1 <= 5.0) {
tmp = 4.0;
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (4.0d0 * x) / y
t_1 = (4.0d0 * ((x + (y * 0.75d0)) - z)) / y
if (t_1 <= (-50.0d0)) then
tmp = t_0
else if (t_1 <= 5.0d0) then
tmp = 4.0d0
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = (4.0 * x) / y;
double t_1 = (4.0 * ((x + (y * 0.75)) - z)) / y;
double tmp;
if (t_1 <= -50.0) {
tmp = t_0;
} else if (t_1 <= 5.0) {
tmp = 4.0;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = (4.0 * x) / y t_1 = (4.0 * ((x + (y * 0.75)) - z)) / y tmp = 0 if t_1 <= -50.0: tmp = t_0 elif t_1 <= 5.0: tmp = 4.0 else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(Float64(4.0 * x) / y) t_1 = Float64(Float64(4.0 * Float64(Float64(x + Float64(y * 0.75)) - z)) / y) tmp = 0.0 if (t_1 <= -50.0) tmp = t_0; elseif (t_1 <= 5.0) tmp = 4.0; else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = (4.0 * x) / y; t_1 = (4.0 * ((x + (y * 0.75)) - z)) / y; tmp = 0.0; if (t_1 <= -50.0) tmp = t_0; elseif (t_1 <= 5.0) tmp = 4.0; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(4.0 * x), $MachinePrecision] / y), $MachinePrecision]}, Block[{t$95$1 = N[(N[(4.0 * N[(N[(x + N[(y * 0.75), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]}, If[LessEqual[t$95$1, -50.0], t$95$0, If[LessEqual[t$95$1, 5.0], 4.0, t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{4 \cdot x}{y}\\
t_1 := \frac{4 \cdot \left(\left(x + y \cdot 0.75\right) - z\right)}{y}\\
\mathbf{if}\;t\_1 \leq -50:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;t\_1 \leq 5:\\
\;\;\;\;4\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if (/.f64 (*.f64 #s(literal 4 binary64) (-.f64 (+.f64 x (*.f64 y #s(literal 3/4 binary64))) z)) y) < -50 or 5 < (/.f64 (*.f64 #s(literal 4 binary64) (-.f64 (+.f64 x (*.f64 y #s(literal 3/4 binary64))) z)) y) Initial program 98.8%
Taylor expanded in x around inf
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f6456.7
Simplified56.7%
if -50 < (/.f64 (*.f64 #s(literal 4 binary64) (-.f64 (+.f64 x (*.f64 y #s(literal 3/4 binary64))) z)) y) < 5Initial program 99.8%
Taylor expanded in y around inf
Simplified95.7%
(FPCore (x y z) :precision binary64 (let* ((t_0 (* (/ 4.0 y) x)) (t_1 (/ (* 4.0 (- (+ x (* y 0.75)) z)) y))) (if (<= t_1 -50.0) t_0 (if (<= t_1 5.0) 4.0 t_0))))
double code(double x, double y, double z) {
double t_0 = (4.0 / y) * x;
double t_1 = (4.0 * ((x + (y * 0.75)) - z)) / y;
double tmp;
if (t_1 <= -50.0) {
tmp = t_0;
} else if (t_1 <= 5.0) {
tmp = 4.0;
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (4.0d0 / y) * x
t_1 = (4.0d0 * ((x + (y * 0.75d0)) - z)) / y
if (t_1 <= (-50.0d0)) then
tmp = t_0
else if (t_1 <= 5.0d0) then
tmp = 4.0d0
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = (4.0 / y) * x;
double t_1 = (4.0 * ((x + (y * 0.75)) - z)) / y;
double tmp;
if (t_1 <= -50.0) {
tmp = t_0;
} else if (t_1 <= 5.0) {
tmp = 4.0;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = (4.0 / y) * x t_1 = (4.0 * ((x + (y * 0.75)) - z)) / y tmp = 0 if t_1 <= -50.0: tmp = t_0 elif t_1 <= 5.0: tmp = 4.0 else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(Float64(4.0 / y) * x) t_1 = Float64(Float64(4.0 * Float64(Float64(x + Float64(y * 0.75)) - z)) / y) tmp = 0.0 if (t_1 <= -50.0) tmp = t_0; elseif (t_1 <= 5.0) tmp = 4.0; else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = (4.0 / y) * x; t_1 = (4.0 * ((x + (y * 0.75)) - z)) / y; tmp = 0.0; if (t_1 <= -50.0) tmp = t_0; elseif (t_1 <= 5.0) tmp = 4.0; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(4.0 / y), $MachinePrecision] * x), $MachinePrecision]}, Block[{t$95$1 = N[(N[(4.0 * N[(N[(x + N[(y * 0.75), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]}, If[LessEqual[t$95$1, -50.0], t$95$0, If[LessEqual[t$95$1, 5.0], 4.0, t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{4}{y} \cdot x\\
t_1 := \frac{4 \cdot \left(\left(x + y \cdot 0.75\right) - z\right)}{y}\\
\mathbf{if}\;t\_1 \leq -50:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;t\_1 \leq 5:\\
\;\;\;\;4\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if (/.f64 (*.f64 #s(literal 4 binary64) (-.f64 (+.f64 x (*.f64 y #s(literal 3/4 binary64))) z)) y) < -50 or 5 < (/.f64 (*.f64 #s(literal 4 binary64) (-.f64 (+.f64 x (*.f64 y #s(literal 3/4 binary64))) z)) y) Initial program 98.8%
Taylor expanded in x around inf
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f6456.7
Simplified56.7%
*-commutativeN/A
associate-/l*N/A
frac-2negN/A
metadata-evalN/A
distribute-frac-neg2N/A
distribute-rgt-neg-inN/A
*-commutativeN/A
distribute-lft-neg-inN/A
distribute-frac-neg2N/A
metadata-evalN/A
frac-2negN/A
*-lowering-*.f64N/A
/-lowering-/.f6456.6
Applied egg-rr56.6%
if -50 < (/.f64 (*.f64 #s(literal 4 binary64) (-.f64 (+.f64 x (*.f64 y #s(literal 3/4 binary64))) z)) y) < 5Initial program 99.8%
Taylor expanded in y around inf
Simplified95.7%
(FPCore (x y z) :precision binary64 (let* ((t_0 (* z (/ -4.0 y))) (t_1 (/ (* 4.0 (- (+ x (* y 0.75)) z)) y))) (if (<= t_1 -50.0) t_0 (if (<= t_1 5e+32) 4.0 t_0))))
double code(double x, double y, double z) {
double t_0 = z * (-4.0 / y);
double t_1 = (4.0 * ((x + (y * 0.75)) - z)) / y;
double tmp;
if (t_1 <= -50.0) {
tmp = t_0;
} else if (t_1 <= 5e+32) {
tmp = 4.0;
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = z * ((-4.0d0) / y)
t_1 = (4.0d0 * ((x + (y * 0.75d0)) - z)) / y
if (t_1 <= (-50.0d0)) then
tmp = t_0
else if (t_1 <= 5d+32) then
tmp = 4.0d0
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = z * (-4.0 / y);
double t_1 = (4.0 * ((x + (y * 0.75)) - z)) / y;
double tmp;
if (t_1 <= -50.0) {
tmp = t_0;
} else if (t_1 <= 5e+32) {
tmp = 4.0;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = z * (-4.0 / y) t_1 = (4.0 * ((x + (y * 0.75)) - z)) / y tmp = 0 if t_1 <= -50.0: tmp = t_0 elif t_1 <= 5e+32: tmp = 4.0 else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(z * Float64(-4.0 / y)) t_1 = Float64(Float64(4.0 * Float64(Float64(x + Float64(y * 0.75)) - z)) / y) tmp = 0.0 if (t_1 <= -50.0) tmp = t_0; elseif (t_1 <= 5e+32) tmp = 4.0; else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = z * (-4.0 / y); t_1 = (4.0 * ((x + (y * 0.75)) - z)) / y; tmp = 0.0; if (t_1 <= -50.0) tmp = t_0; elseif (t_1 <= 5e+32) tmp = 4.0; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[(-4.0 / y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(4.0 * N[(N[(x + N[(y * 0.75), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]}, If[LessEqual[t$95$1, -50.0], t$95$0, If[LessEqual[t$95$1, 5e+32], 4.0, t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \frac{-4}{y}\\
t_1 := \frac{4 \cdot \left(\left(x + y \cdot 0.75\right) - z\right)}{y}\\
\mathbf{if}\;t\_1 \leq -50:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+32}:\\
\;\;\;\;4\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if (/.f64 (*.f64 #s(literal 4 binary64) (-.f64 (+.f64 x (*.f64 y #s(literal 3/4 binary64))) z)) y) < -50 or 4.9999999999999997e32 < (/.f64 (*.f64 #s(literal 4 binary64) (-.f64 (+.f64 x (*.f64 y #s(literal 3/4 binary64))) z)) y) Initial program 98.7%
Taylor expanded in z around inf
*-lft-identityN/A
associate-*l/N/A
associate-*l*N/A
metadata-evalN/A
distribute-lft-neg-inN/A
*-commutativeN/A
*-lowering-*.f64N/A
associate-*r/N/A
metadata-evalN/A
distribute-neg-fracN/A
metadata-evalN/A
/-lowering-/.f6446.3
Simplified46.3%
if -50 < (/.f64 (*.f64 #s(literal 4 binary64) (-.f64 (+.f64 x (*.f64 y #s(literal 3/4 binary64))) z)) y) < 4.9999999999999997e32Initial program 99.8%
Taylor expanded in y around inf
Simplified94.0%
(FPCore (x y z) :precision binary64 (let* ((t_0 (fma z (/ -4.0 y) 4.0))) (if (<= z -3.3e-10) t_0 (if (<= z 7.2e+57) (fma (/ 4.0 y) x 4.0) t_0))))
double code(double x, double y, double z) {
double t_0 = fma(z, (-4.0 / y), 4.0);
double tmp;
if (z <= -3.3e-10) {
tmp = t_0;
} else if (z <= 7.2e+57) {
tmp = fma((4.0 / y), x, 4.0);
} else {
tmp = t_0;
}
return tmp;
}
function code(x, y, z) t_0 = fma(z, Float64(-4.0 / y), 4.0) tmp = 0.0 if (z <= -3.3e-10) tmp = t_0; elseif (z <= 7.2e+57) tmp = fma(Float64(4.0 / y), x, 4.0); else tmp = t_0; end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[(-4.0 / y), $MachinePrecision] + 4.0), $MachinePrecision]}, If[LessEqual[z, -3.3e-10], t$95$0, If[LessEqual[z, 7.2e+57], N[(N[(4.0 / y), $MachinePrecision] * x + 4.0), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(z, \frac{-4}{y}, 4\right)\\
\mathbf{if}\;z \leq -3.3 \cdot 10^{-10}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 7.2 \cdot 10^{+57}:\\
\;\;\;\;\mathsf{fma}\left(\frac{4}{y}, x, 4\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -3.3e-10 or 7.2000000000000005e57 < z Initial program 98.0%
Taylor expanded in x around 0
+-commutativeN/A
*-commutativeN/A
div-subN/A
associate-/l*N/A
*-inversesN/A
metadata-evalN/A
*-commutativeN/A
sub-negN/A
+-commutativeN/A
distribute-rgt-inN/A
*-commutativeN/A
*-lft-identityN/A
associate-*l/N/A
distribute-rgt-neg-inN/A
associate-*l*N/A
metadata-evalN/A
associate-+l+N/A
Simplified85.7%
if -3.3e-10 < z < 7.2000000000000005e57Initial program 99.9%
Taylor expanded in z around 0
Simplified94.1%
distribute-neg-inN/A
*-commutativeN/A
distribute-lft-neg-inN/A
distribute-frac-neg2N/A
metadata-evalN/A
frac-2negN/A
metadata-evalN/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f6494.1
Applied egg-rr94.1%
(FPCore (x y z) :precision binary64 (let* ((t_0 (/ (* 4.0 x) y))) (if (<= x -2.9e+38) t_0 (if (<= x 5.3e+132) (fma z (/ -4.0 y) 4.0) t_0))))
double code(double x, double y, double z) {
double t_0 = (4.0 * x) / y;
double tmp;
if (x <= -2.9e+38) {
tmp = t_0;
} else if (x <= 5.3e+132) {
tmp = fma(z, (-4.0 / y), 4.0);
} else {
tmp = t_0;
}
return tmp;
}
function code(x, y, z) t_0 = Float64(Float64(4.0 * x) / y) tmp = 0.0 if (x <= -2.9e+38) tmp = t_0; elseif (x <= 5.3e+132) tmp = fma(z, Float64(-4.0 / y), 4.0); else tmp = t_0; end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(4.0 * x), $MachinePrecision] / y), $MachinePrecision]}, If[LessEqual[x, -2.9e+38], t$95$0, If[LessEqual[x, 5.3e+132], N[(z * N[(-4.0 / y), $MachinePrecision] + 4.0), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{4 \cdot x}{y}\\
\mathbf{if}\;x \leq -2.9 \cdot 10^{+38}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 5.3 \cdot 10^{+132}:\\
\;\;\;\;\mathsf{fma}\left(z, \frac{-4}{y}, 4\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -2.90000000000000007e38 or 5.3e132 < x Initial program 98.9%
Taylor expanded in x around inf
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f6471.4
Simplified71.4%
if -2.90000000000000007e38 < x < 5.3e132Initial program 99.3%
Taylor expanded in x around 0
+-commutativeN/A
*-commutativeN/A
div-subN/A
associate-/l*N/A
*-inversesN/A
metadata-evalN/A
*-commutativeN/A
sub-negN/A
+-commutativeN/A
distribute-rgt-inN/A
*-commutativeN/A
*-lft-identityN/A
associate-*l/N/A
distribute-rgt-neg-inN/A
associate-*l*N/A
metadata-evalN/A
associate-+l+N/A
Simplified86.1%
(FPCore (x y z) :precision binary64 4.0)
double code(double x, double y, double z) {
return 4.0;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = 4.0d0
end function
public static double code(double x, double y, double z) {
return 4.0;
}
def code(x, y, z): return 4.0
function code(x, y, z) return 4.0 end
function tmp = code(x, y, z) tmp = 4.0; end
code[x_, y_, z_] := 4.0
\begin{array}{l}
\\
4
\end{array}
Initial program 99.1%
Taylor expanded in y around inf
Simplified37.6%
(FPCore (x y z) :precision binary64 1.0)
double code(double x, double y, double z) {
return 1.0;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = 1.0d0
end function
public static double code(double x, double y, double z) {
return 1.0;
}
def code(x, y, z): return 1.0
function code(x, y, z) return 1.0 end
function tmp = code(x, y, z) tmp = 1.0; end
code[x_, y_, z_] := 1.0
\begin{array}{l}
\\
1
\end{array}
Initial program 99.1%
associate-/l*N/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
--lowering--.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f6499.6
Applied egg-rr99.6%
Taylor expanded in x around inf
Simplified42.0%
Taylor expanded in y around inf
Simplified8.2%
herbie shell --seed 2024198
(FPCore (x y z)
:name "Data.Array.Repa.Algorithms.ColorRamp:rampColorHotToCold from repa-algorithms-3.4.0.1, A"
:precision binary64
(+ 1.0 (/ (* 4.0 (- (+ x (* y 0.75)) z)) y)))