
(FPCore (x y z) :precision binary64 (/ (* 4.0 (- (- x y) (* z 0.5))) z))
double code(double x, double y, double z) {
return (4.0 * ((x - y) - (z * 0.5))) / z;
}
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 * ((x - y) - (z * 0.5d0))) / z
end function
public static double code(double x, double y, double z) {
return (4.0 * ((x - y) - (z * 0.5))) / z;
}
def code(x, y, z): return (4.0 * ((x - y) - (z * 0.5))) / z
function code(x, y, z) return Float64(Float64(4.0 * Float64(Float64(x - y) - Float64(z * 0.5))) / z) end
function tmp = code(x, y, z) tmp = (4.0 * ((x - y) - (z * 0.5))) / z; end
code[x_, y_, z_] := N[(N[(4.0 * N[(N[(x - y), $MachinePrecision] - N[(z * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]
\begin{array}{l}
\\
\frac{4 \cdot \left(\left(x - y\right) - z \cdot 0.5\right)}{z}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (/ (* 4.0 (- (- x y) (* z 0.5))) z))
double code(double x, double y, double z) {
return (4.0 * ((x - y) - (z * 0.5))) / z;
}
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 * ((x - y) - (z * 0.5d0))) / z
end function
public static double code(double x, double y, double z) {
return (4.0 * ((x - y) - (z * 0.5))) / z;
}
def code(x, y, z): return (4.0 * ((x - y) - (z * 0.5))) / z
function code(x, y, z) return Float64(Float64(4.0 * Float64(Float64(x - y) - Float64(z * 0.5))) / z) end
function tmp = code(x, y, z) tmp = (4.0 * ((x - y) - (z * 0.5))) / z; end
code[x_, y_, z_] := N[(N[(4.0 * N[(N[(x - y), $MachinePrecision] - N[(z * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]
\begin{array}{l}
\\
\frac{4 \cdot \left(\left(x - y\right) - z \cdot 0.5\right)}{z}
\end{array}
(FPCore (x y z) :precision binary64 (+ -2.0 (/ (* 4.0 (- x y)) z)))
double code(double x, double y, double z) {
return -2.0 + ((4.0 * (x - y)) / z);
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (-2.0d0) + ((4.0d0 * (x - y)) / z)
end function
public static double code(double x, double y, double z) {
return -2.0 + ((4.0 * (x - y)) / z);
}
def code(x, y, z): return -2.0 + ((4.0 * (x - y)) / z)
function code(x, y, z) return Float64(-2.0 + Float64(Float64(4.0 * Float64(x - y)) / z)) end
function tmp = code(x, y, z) tmp = -2.0 + ((4.0 * (x - y)) / z); end
code[x_, y_, z_] := N[(-2.0 + N[(N[(4.0 * N[(x - y), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
-2 + \frac{4 \cdot \left(x - y\right)}{z}
\end{array}
Initial program 99.6%
associate-*l/N/A
sub-negN/A
distribute-rgt-inN/A
*-commutativeN/A
+-commutativeN/A
+-lowering-+.f64N/A
associate-*l/N/A
associate-/l*N/A
distribute-neg-fracN/A
*-commutativeN/A
associate-/l*N/A
distribute-lft-neg-inN/A
metadata-evalN/A
*-inversesN/A
metadata-evalN/A
metadata-evalN/A
associate-*r/N/A
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
--lowering--.f6499.6%
Simplified99.6%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (/ x (/ z 4.0))))
(if (<= x -3.2e-12)
t_0
(if (<= x 1.3e-251) -2.0 (if (<= x 1.2e+81) (* -4.0 (/ y z)) t_0)))))
double code(double x, double y, double z) {
double t_0 = x / (z / 4.0);
double tmp;
if (x <= -3.2e-12) {
tmp = t_0;
} else if (x <= 1.3e-251) {
tmp = -2.0;
} else if (x <= 1.2e+81) {
tmp = -4.0 * (y / z);
} 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) :: tmp
t_0 = x / (z / 4.0d0)
if (x <= (-3.2d-12)) then
tmp = t_0
else if (x <= 1.3d-251) then
tmp = -2.0d0
else if (x <= 1.2d+81) then
tmp = (-4.0d0) * (y / z)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = x / (z / 4.0);
double tmp;
if (x <= -3.2e-12) {
tmp = t_0;
} else if (x <= 1.3e-251) {
tmp = -2.0;
} else if (x <= 1.2e+81) {
tmp = -4.0 * (y / z);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = x / (z / 4.0) tmp = 0 if x <= -3.2e-12: tmp = t_0 elif x <= 1.3e-251: tmp = -2.0 elif x <= 1.2e+81: tmp = -4.0 * (y / z) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(x / Float64(z / 4.0)) tmp = 0.0 if (x <= -3.2e-12) tmp = t_0; elseif (x <= 1.3e-251) tmp = -2.0; elseif (x <= 1.2e+81) tmp = Float64(-4.0 * Float64(y / z)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = x / (z / 4.0); tmp = 0.0; if (x <= -3.2e-12) tmp = t_0; elseif (x <= 1.3e-251) tmp = -2.0; elseif (x <= 1.2e+81) tmp = -4.0 * (y / z); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x / N[(z / 4.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -3.2e-12], t$95$0, If[LessEqual[x, 1.3e-251], -2.0, If[LessEqual[x, 1.2e+81], N[(-4.0 * N[(y / z), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x}{\frac{z}{4}}\\
\mathbf{if}\;x \leq -3.2 \cdot 10^{-12}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 1.3 \cdot 10^{-251}:\\
\;\;\;\;-2\\
\mathbf{elif}\;x \leq 1.2 \cdot 10^{+81}:\\
\;\;\;\;-4 \cdot \frac{y}{z}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -3.2000000000000001e-12 or 1.19999999999999995e81 < x Initial program 100.0%
associate-*l/N/A
sub-negN/A
distribute-rgt-inN/A
*-commutativeN/A
+-commutativeN/A
+-lowering-+.f64N/A
associate-*l/N/A
associate-/l*N/A
distribute-neg-fracN/A
*-commutativeN/A
associate-/l*N/A
distribute-lft-neg-inN/A
metadata-evalN/A
*-inversesN/A
metadata-evalN/A
metadata-evalN/A
associate-*r/N/A
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
--lowering--.f64100.0%
Simplified100.0%
Taylor expanded in x around inf
*-lft-identityN/A
associate-*l/N/A
associate-*l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
associate-*r/N/A
metadata-evalN/A
/-lowering-/.f6471.6%
Simplified71.6%
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
/-lowering-/.f6471.9%
Applied egg-rr71.9%
if -3.2000000000000001e-12 < x < 1.3e-251Initial program 100.0%
associate-*l/N/A
sub-negN/A
distribute-rgt-inN/A
*-commutativeN/A
+-commutativeN/A
+-lowering-+.f64N/A
associate-*l/N/A
associate-/l*N/A
distribute-neg-fracN/A
*-commutativeN/A
associate-/l*N/A
distribute-lft-neg-inN/A
metadata-evalN/A
*-inversesN/A
metadata-evalN/A
metadata-evalN/A
associate-*r/N/A
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
--lowering--.f64100.0%
Simplified100.0%
Taylor expanded in z around inf
Simplified54.1%
if 1.3e-251 < x < 1.19999999999999995e81Initial program 98.6%
associate-*l/N/A
sub-negN/A
distribute-rgt-inN/A
*-commutativeN/A
+-commutativeN/A
+-lowering-+.f64N/A
associate-*l/N/A
associate-/l*N/A
distribute-neg-fracN/A
*-commutativeN/A
associate-/l*N/A
distribute-lft-neg-inN/A
metadata-evalN/A
*-inversesN/A
metadata-evalN/A
metadata-evalN/A
associate-*r/N/A
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
--lowering--.f6498.7%
Simplified98.7%
Taylor expanded in y around inf
*-lowering-*.f64N/A
/-lowering-/.f6452.4%
Simplified52.4%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (/ 4.0 (/ z x))))
(if (<= x -3.2e-12)
t_0
(if (<= x 2.3e-254) -2.0 (if (<= x 4.1e+82) (* -4.0 (/ y z)) t_0)))))
double code(double x, double y, double z) {
double t_0 = 4.0 / (z / x);
double tmp;
if (x <= -3.2e-12) {
tmp = t_0;
} else if (x <= 2.3e-254) {
tmp = -2.0;
} else if (x <= 4.1e+82) {
tmp = -4.0 * (y / z);
} 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) :: tmp
t_0 = 4.0d0 / (z / x)
if (x <= (-3.2d-12)) then
tmp = t_0
else if (x <= 2.3d-254) then
tmp = -2.0d0
else if (x <= 4.1d+82) then
tmp = (-4.0d0) * (y / z)
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 / (z / x);
double tmp;
if (x <= -3.2e-12) {
tmp = t_0;
} else if (x <= 2.3e-254) {
tmp = -2.0;
} else if (x <= 4.1e+82) {
tmp = -4.0 * (y / z);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = 4.0 / (z / x) tmp = 0 if x <= -3.2e-12: tmp = t_0 elif x <= 2.3e-254: tmp = -2.0 elif x <= 4.1e+82: tmp = -4.0 * (y / z) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(4.0 / Float64(z / x)) tmp = 0.0 if (x <= -3.2e-12) tmp = t_0; elseif (x <= 2.3e-254) tmp = -2.0; elseif (x <= 4.1e+82) tmp = Float64(-4.0 * Float64(y / z)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = 4.0 / (z / x); tmp = 0.0; if (x <= -3.2e-12) tmp = t_0; elseif (x <= 2.3e-254) tmp = -2.0; elseif (x <= 4.1e+82) tmp = -4.0 * (y / z); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(4.0 / N[(z / x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -3.2e-12], t$95$0, If[LessEqual[x, 2.3e-254], -2.0, If[LessEqual[x, 4.1e+82], N[(-4.0 * N[(y / z), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{4}{\frac{z}{x}}\\
\mathbf{if}\;x \leq -3.2 \cdot 10^{-12}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 2.3 \cdot 10^{-254}:\\
\;\;\;\;-2\\
\mathbf{elif}\;x \leq 4.1 \cdot 10^{+82}:\\
\;\;\;\;-4 \cdot \frac{y}{z}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -3.2000000000000001e-12 or 4.09999999999999995e82 < x Initial program 100.0%
associate-*l/N/A
sub-negN/A
distribute-rgt-inN/A
*-commutativeN/A
+-commutativeN/A
+-lowering-+.f64N/A
associate-*l/N/A
associate-/l*N/A
distribute-neg-fracN/A
*-commutativeN/A
associate-/l*N/A
distribute-lft-neg-inN/A
metadata-evalN/A
*-inversesN/A
metadata-evalN/A
metadata-evalN/A
associate-*r/N/A
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
--lowering--.f64100.0%
Simplified100.0%
Taylor expanded in x around inf
*-lft-identityN/A
associate-*l/N/A
associate-*l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
associate-*r/N/A
metadata-evalN/A
/-lowering-/.f6471.6%
Simplified71.6%
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
/-lowering-/.f6471.9%
Applied egg-rr71.9%
associate-/r/N/A
*-commutativeN/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
/-lowering-/.f6471.7%
Applied egg-rr71.7%
if -3.2000000000000001e-12 < x < 2.2999999999999999e-254Initial program 100.0%
associate-*l/N/A
sub-negN/A
distribute-rgt-inN/A
*-commutativeN/A
+-commutativeN/A
+-lowering-+.f64N/A
associate-*l/N/A
associate-/l*N/A
distribute-neg-fracN/A
*-commutativeN/A
associate-/l*N/A
distribute-lft-neg-inN/A
metadata-evalN/A
*-inversesN/A
metadata-evalN/A
metadata-evalN/A
associate-*r/N/A
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
--lowering--.f64100.0%
Simplified100.0%
Taylor expanded in z around inf
Simplified54.1%
if 2.2999999999999999e-254 < x < 4.09999999999999995e82Initial program 98.6%
associate-*l/N/A
sub-negN/A
distribute-rgt-inN/A
*-commutativeN/A
+-commutativeN/A
+-lowering-+.f64N/A
associate-*l/N/A
associate-/l*N/A
distribute-neg-fracN/A
*-commutativeN/A
associate-/l*N/A
distribute-lft-neg-inN/A
metadata-evalN/A
*-inversesN/A
metadata-evalN/A
metadata-evalN/A
associate-*r/N/A
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
--lowering--.f6498.7%
Simplified98.7%
Taylor expanded in y around inf
*-lowering-*.f64N/A
/-lowering-/.f6452.4%
Simplified52.4%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* x (/ 4.0 z))))
(if (<= x -3.2e-12)
t_0
(if (<= x 7.5e-255) -2.0 (if (<= x 1.45e+82) (* -4.0 (/ y z)) t_0)))))
double code(double x, double y, double z) {
double t_0 = x * (4.0 / z);
double tmp;
if (x <= -3.2e-12) {
tmp = t_0;
} else if (x <= 7.5e-255) {
tmp = -2.0;
} else if (x <= 1.45e+82) {
tmp = -4.0 * (y / z);
} 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) :: tmp
t_0 = x * (4.0d0 / z)
if (x <= (-3.2d-12)) then
tmp = t_0
else if (x <= 7.5d-255) then
tmp = -2.0d0
else if (x <= 1.45d+82) then
tmp = (-4.0d0) * (y / z)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = x * (4.0 / z);
double tmp;
if (x <= -3.2e-12) {
tmp = t_0;
} else if (x <= 7.5e-255) {
tmp = -2.0;
} else if (x <= 1.45e+82) {
tmp = -4.0 * (y / z);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = x * (4.0 / z) tmp = 0 if x <= -3.2e-12: tmp = t_0 elif x <= 7.5e-255: tmp = -2.0 elif x <= 1.45e+82: tmp = -4.0 * (y / z) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(x * Float64(4.0 / z)) tmp = 0.0 if (x <= -3.2e-12) tmp = t_0; elseif (x <= 7.5e-255) tmp = -2.0; elseif (x <= 1.45e+82) tmp = Float64(-4.0 * Float64(y / z)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = x * (4.0 / z); tmp = 0.0; if (x <= -3.2e-12) tmp = t_0; elseif (x <= 7.5e-255) tmp = -2.0; elseif (x <= 1.45e+82) tmp = -4.0 * (y / z); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x * N[(4.0 / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -3.2e-12], t$95$0, If[LessEqual[x, 7.5e-255], -2.0, If[LessEqual[x, 1.45e+82], N[(-4.0 * N[(y / z), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \frac{4}{z}\\
\mathbf{if}\;x \leq -3.2 \cdot 10^{-12}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 7.5 \cdot 10^{-255}:\\
\;\;\;\;-2\\
\mathbf{elif}\;x \leq 1.45 \cdot 10^{+82}:\\
\;\;\;\;-4 \cdot \frac{y}{z}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -3.2000000000000001e-12 or 1.4500000000000001e82 < x Initial program 100.0%
associate-*l/N/A
sub-negN/A
distribute-rgt-inN/A
*-commutativeN/A
+-commutativeN/A
+-lowering-+.f64N/A
associate-*l/N/A
associate-/l*N/A
distribute-neg-fracN/A
*-commutativeN/A
associate-/l*N/A
distribute-lft-neg-inN/A
metadata-evalN/A
*-inversesN/A
metadata-evalN/A
metadata-evalN/A
associate-*r/N/A
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
--lowering--.f64100.0%
Simplified100.0%
Taylor expanded in x around inf
*-lft-identityN/A
associate-*l/N/A
associate-*l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
associate-*r/N/A
metadata-evalN/A
/-lowering-/.f6471.6%
Simplified71.6%
if -3.2000000000000001e-12 < x < 7.50000000000000029e-255Initial program 100.0%
associate-*l/N/A
sub-negN/A
distribute-rgt-inN/A
*-commutativeN/A
+-commutativeN/A
+-lowering-+.f64N/A
associate-*l/N/A
associate-/l*N/A
distribute-neg-fracN/A
*-commutativeN/A
associate-/l*N/A
distribute-lft-neg-inN/A
metadata-evalN/A
*-inversesN/A
metadata-evalN/A
metadata-evalN/A
associate-*r/N/A
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
--lowering--.f64100.0%
Simplified100.0%
Taylor expanded in z around inf
Simplified54.1%
if 7.50000000000000029e-255 < x < 1.4500000000000001e82Initial program 98.6%
associate-*l/N/A
sub-negN/A
distribute-rgt-inN/A
*-commutativeN/A
+-commutativeN/A
+-lowering-+.f64N/A
associate-*l/N/A
associate-/l*N/A
distribute-neg-fracN/A
*-commutativeN/A
associate-/l*N/A
distribute-lft-neg-inN/A
metadata-evalN/A
*-inversesN/A
metadata-evalN/A
metadata-evalN/A
associate-*r/N/A
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
--lowering--.f6498.7%
Simplified98.7%
Taylor expanded in y around inf
*-lowering-*.f64N/A
/-lowering-/.f6452.4%
Simplified52.4%
(FPCore (x y z) :precision binary64 (if (<= y -1.3e-61) (* 4.0 (/ (- x y) z)) (if (<= y 2.3e-8) (+ -2.0 (* x (/ 4.0 z))) (+ -2.0 (/ (* y -4.0) z)))))
double code(double x, double y, double z) {
double tmp;
if (y <= -1.3e-61) {
tmp = 4.0 * ((x - y) / z);
} else if (y <= 2.3e-8) {
tmp = -2.0 + (x * (4.0 / z));
} else {
tmp = -2.0 + ((y * -4.0) / z);
}
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) :: tmp
if (y <= (-1.3d-61)) then
tmp = 4.0d0 * ((x - y) / z)
else if (y <= 2.3d-8) then
tmp = (-2.0d0) + (x * (4.0d0 / z))
else
tmp = (-2.0d0) + ((y * (-4.0d0)) / z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -1.3e-61) {
tmp = 4.0 * ((x - y) / z);
} else if (y <= 2.3e-8) {
tmp = -2.0 + (x * (4.0 / z));
} else {
tmp = -2.0 + ((y * -4.0) / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -1.3e-61: tmp = 4.0 * ((x - y) / z) elif y <= 2.3e-8: tmp = -2.0 + (x * (4.0 / z)) else: tmp = -2.0 + ((y * -4.0) / z) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -1.3e-61) tmp = Float64(4.0 * Float64(Float64(x - y) / z)); elseif (y <= 2.3e-8) tmp = Float64(-2.0 + Float64(x * Float64(4.0 / z))); else tmp = Float64(-2.0 + Float64(Float64(y * -4.0) / z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -1.3e-61) tmp = 4.0 * ((x - y) / z); elseif (y <= 2.3e-8) tmp = -2.0 + (x * (4.0 / z)); else tmp = -2.0 + ((y * -4.0) / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -1.3e-61], N[(4.0 * N[(N[(x - y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.3e-8], N[(-2.0 + N[(x * N[(4.0 / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-2.0 + N[(N[(y * -4.0), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.3 \cdot 10^{-61}:\\
\;\;\;\;4 \cdot \frac{x - y}{z}\\
\mathbf{elif}\;y \leq 2.3 \cdot 10^{-8}:\\
\;\;\;\;-2 + x \cdot \frac{4}{z}\\
\mathbf{else}:\\
\;\;\;\;-2 + \frac{y \cdot -4}{z}\\
\end{array}
\end{array}
if y < -1.30000000000000005e-61Initial program 100.0%
associate-*l/N/A
sub-negN/A
distribute-rgt-inN/A
*-commutativeN/A
+-commutativeN/A
+-lowering-+.f64N/A
associate-*l/N/A
associate-/l*N/A
distribute-neg-fracN/A
*-commutativeN/A
associate-/l*N/A
distribute-lft-neg-inN/A
metadata-evalN/A
*-inversesN/A
metadata-evalN/A
metadata-evalN/A
associate-*r/N/A
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
--lowering--.f64100.0%
Simplified100.0%
Taylor expanded in z around 0
*-lowering-*.f64N/A
/-lowering-/.f64N/A
--lowering--.f6484.8%
Simplified84.8%
if -1.30000000000000005e-61 < y < 2.3000000000000001e-8Initial program 100.0%
associate-*l/N/A
sub-negN/A
distribute-rgt-inN/A
*-commutativeN/A
+-commutativeN/A
+-lowering-+.f64N/A
associate-*l/N/A
associate-/l*N/A
distribute-neg-fracN/A
*-commutativeN/A
associate-/l*N/A
distribute-lft-neg-inN/A
metadata-evalN/A
*-inversesN/A
metadata-evalN/A
metadata-evalN/A
associate-*r/N/A
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
--lowering--.f64100.0%
Simplified100.0%
Taylor expanded in y around 0
sub-negN/A
metadata-evalN/A
+-lowering-+.f64N/A
*-lft-identityN/A
associate-*l/N/A
associate-*l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
associate-*r/N/A
metadata-evalN/A
/-lowering-/.f6495.4%
Simplified95.4%
if 2.3000000000000001e-8 < y Initial program 98.6%
associate-*l/N/A
sub-negN/A
distribute-rgt-inN/A
*-commutativeN/A
+-commutativeN/A
+-lowering-+.f64N/A
associate-*l/N/A
associate-/l*N/A
distribute-neg-fracN/A
*-commutativeN/A
associate-/l*N/A
distribute-lft-neg-inN/A
metadata-evalN/A
*-inversesN/A
metadata-evalN/A
metadata-evalN/A
associate-*r/N/A
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
--lowering--.f6498.6%
Simplified98.6%
Taylor expanded in x around 0
*-lowering-*.f6483.1%
Simplified83.1%
Final simplification89.0%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* 4.0 (/ (- x y) z))))
(if (<= x -3.2e-12)
t_0
(if (<= x 4.4e+111) (+ -2.0 (/ (* y -4.0) z)) t_0))))
double code(double x, double y, double z) {
double t_0 = 4.0 * ((x - y) / z);
double tmp;
if (x <= -3.2e-12) {
tmp = t_0;
} else if (x <= 4.4e+111) {
tmp = -2.0 + ((y * -4.0) / z);
} 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) :: tmp
t_0 = 4.0d0 * ((x - y) / z)
if (x <= (-3.2d-12)) then
tmp = t_0
else if (x <= 4.4d+111) then
tmp = (-2.0d0) + ((y * (-4.0d0)) / z)
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) / z);
double tmp;
if (x <= -3.2e-12) {
tmp = t_0;
} else if (x <= 4.4e+111) {
tmp = -2.0 + ((y * -4.0) / z);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = 4.0 * ((x - y) / z) tmp = 0 if x <= -3.2e-12: tmp = t_0 elif x <= 4.4e+111: tmp = -2.0 + ((y * -4.0) / z) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(4.0 * Float64(Float64(x - y) / z)) tmp = 0.0 if (x <= -3.2e-12) tmp = t_0; elseif (x <= 4.4e+111) tmp = Float64(-2.0 + Float64(Float64(y * -4.0) / z)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = 4.0 * ((x - y) / z); tmp = 0.0; if (x <= -3.2e-12) tmp = t_0; elseif (x <= 4.4e+111) tmp = -2.0 + ((y * -4.0) / z); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(4.0 * N[(N[(x - y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -3.2e-12], t$95$0, If[LessEqual[x, 4.4e+111], N[(-2.0 + N[(N[(y * -4.0), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 4 \cdot \frac{x - y}{z}\\
\mathbf{if}\;x \leq -3.2 \cdot 10^{-12}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 4.4 \cdot 10^{+111}:\\
\;\;\;\;-2 + \frac{y \cdot -4}{z}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -3.2000000000000001e-12 or 4.39999999999999997e111 < x Initial program 100.0%
associate-*l/N/A
sub-negN/A
distribute-rgt-inN/A
*-commutativeN/A
+-commutativeN/A
+-lowering-+.f64N/A
associate-*l/N/A
associate-/l*N/A
distribute-neg-fracN/A
*-commutativeN/A
associate-/l*N/A
distribute-lft-neg-inN/A
metadata-evalN/A
*-inversesN/A
metadata-evalN/A
metadata-evalN/A
associate-*r/N/A
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
--lowering--.f64100.0%
Simplified100.0%
Taylor expanded in z around 0
*-lowering-*.f64N/A
/-lowering-/.f64N/A
--lowering--.f6490.0%
Simplified90.0%
if -3.2000000000000001e-12 < x < 4.39999999999999997e111Initial program 99.3%
associate-*l/N/A
sub-negN/A
distribute-rgt-inN/A
*-commutativeN/A
+-commutativeN/A
+-lowering-+.f64N/A
associate-*l/N/A
associate-/l*N/A
distribute-neg-fracN/A
*-commutativeN/A
associate-/l*N/A
distribute-lft-neg-inN/A
metadata-evalN/A
*-inversesN/A
metadata-evalN/A
metadata-evalN/A
associate-*r/N/A
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
--lowering--.f6499.3%
Simplified99.3%
Taylor expanded in x around 0
*-lowering-*.f6488.0%
Simplified88.0%
Final simplification88.9%
(FPCore (x y z) :precision binary64 (if (<= z -1.3e+170) -2.0 (if (<= z 9.5e+129) (* 4.0 (/ (- x y) z)) -2.0)))
double code(double x, double y, double z) {
double tmp;
if (z <= -1.3e+170) {
tmp = -2.0;
} else if (z <= 9.5e+129) {
tmp = 4.0 * ((x - y) / z);
} else {
tmp = -2.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) :: tmp
if (z <= (-1.3d+170)) then
tmp = -2.0d0
else if (z <= 9.5d+129) then
tmp = 4.0d0 * ((x - y) / z)
else
tmp = -2.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -1.3e+170) {
tmp = -2.0;
} else if (z <= 9.5e+129) {
tmp = 4.0 * ((x - y) / z);
} else {
tmp = -2.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1.3e+170: tmp = -2.0 elif z <= 9.5e+129: tmp = 4.0 * ((x - y) / z) else: tmp = -2.0 return tmp
function code(x, y, z) tmp = 0.0 if (z <= -1.3e+170) tmp = -2.0; elseif (z <= 9.5e+129) tmp = Float64(4.0 * Float64(Float64(x - y) / z)); else tmp = -2.0; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -1.3e+170) tmp = -2.0; elseif (z <= 9.5e+129) tmp = 4.0 * ((x - y) / z); else tmp = -2.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -1.3e+170], -2.0, If[LessEqual[z, 9.5e+129], N[(4.0 * N[(N[(x - y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], -2.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.3 \cdot 10^{+170}:\\
\;\;\;\;-2\\
\mathbf{elif}\;z \leq 9.5 \cdot 10^{+129}:\\
\;\;\;\;4 \cdot \frac{x - y}{z}\\
\mathbf{else}:\\
\;\;\;\;-2\\
\end{array}
\end{array}
if z < -1.2999999999999999e170 or 9.5000000000000004e129 < z Initial program 98.4%
associate-*l/N/A
sub-negN/A
distribute-rgt-inN/A
*-commutativeN/A
+-commutativeN/A
+-lowering-+.f64N/A
associate-*l/N/A
associate-/l*N/A
distribute-neg-fracN/A
*-commutativeN/A
associate-/l*N/A
distribute-lft-neg-inN/A
metadata-evalN/A
*-inversesN/A
metadata-evalN/A
metadata-evalN/A
associate-*r/N/A
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
--lowering--.f6498.4%
Simplified98.4%
Taylor expanded in z around inf
Simplified75.0%
if -1.2999999999999999e170 < z < 9.5000000000000004e129Initial program 100.0%
associate-*l/N/A
sub-negN/A
distribute-rgt-inN/A
*-commutativeN/A
+-commutativeN/A
+-lowering-+.f64N/A
associate-*l/N/A
associate-/l*N/A
distribute-neg-fracN/A
*-commutativeN/A
associate-/l*N/A
distribute-lft-neg-inN/A
metadata-evalN/A
*-inversesN/A
metadata-evalN/A
metadata-evalN/A
associate-*r/N/A
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
--lowering--.f64100.0%
Simplified100.0%
Taylor expanded in z around 0
*-lowering-*.f64N/A
/-lowering-/.f64N/A
--lowering--.f6483.5%
Simplified83.5%
(FPCore (x y z) :precision binary64 (let* ((t_0 (* -4.0 (/ y z)))) (if (<= y -5.5e+50) t_0 (if (<= y 4.2e-24) -2.0 t_0))))
double code(double x, double y, double z) {
double t_0 = -4.0 * (y / z);
double tmp;
if (y <= -5.5e+50) {
tmp = t_0;
} else if (y <= 4.2e-24) {
tmp = -2.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) :: tmp
t_0 = (-4.0d0) * (y / z)
if (y <= (-5.5d+50)) then
tmp = t_0
else if (y <= 4.2d-24) then
tmp = -2.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 / z);
double tmp;
if (y <= -5.5e+50) {
tmp = t_0;
} else if (y <= 4.2e-24) {
tmp = -2.0;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = -4.0 * (y / z) tmp = 0 if y <= -5.5e+50: tmp = t_0 elif y <= 4.2e-24: tmp = -2.0 else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(-4.0 * Float64(y / z)) tmp = 0.0 if (y <= -5.5e+50) tmp = t_0; elseif (y <= 4.2e-24) tmp = -2.0; else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = -4.0 * (y / z); tmp = 0.0; if (y <= -5.5e+50) tmp = t_0; elseif (y <= 4.2e-24) tmp = -2.0; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(-4.0 * N[(y / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -5.5e+50], t$95$0, If[LessEqual[y, 4.2e-24], -2.0, t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -4 \cdot \frac{y}{z}\\
\mathbf{if}\;y \leq -5.5 \cdot 10^{+50}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 4.2 \cdot 10^{-24}:\\
\;\;\;\;-2\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -5.4999999999999998e50 or 4.1999999999999999e-24 < y Initial program 99.2%
associate-*l/N/A
sub-negN/A
distribute-rgt-inN/A
*-commutativeN/A
+-commutativeN/A
+-lowering-+.f64N/A
associate-*l/N/A
associate-/l*N/A
distribute-neg-fracN/A
*-commutativeN/A
associate-/l*N/A
distribute-lft-neg-inN/A
metadata-evalN/A
*-inversesN/A
metadata-evalN/A
metadata-evalN/A
associate-*r/N/A
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
--lowering--.f6499.2%
Simplified99.2%
Taylor expanded in y around inf
*-lowering-*.f64N/A
/-lowering-/.f6465.2%
Simplified65.2%
if -5.4999999999999998e50 < y < 4.1999999999999999e-24Initial program 100.0%
associate-*l/N/A
sub-negN/A
distribute-rgt-inN/A
*-commutativeN/A
+-commutativeN/A
+-lowering-+.f64N/A
associate-*l/N/A
associate-/l*N/A
distribute-neg-fracN/A
*-commutativeN/A
associate-/l*N/A
distribute-lft-neg-inN/A
metadata-evalN/A
*-inversesN/A
metadata-evalN/A
metadata-evalN/A
associate-*r/N/A
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
--lowering--.f64100.0%
Simplified100.0%
Taylor expanded in z around inf
Simplified43.5%
(FPCore (x y z) :precision binary64 -2.0)
double code(double x, double y, double z) {
return -2.0;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = -2.0d0
end function
public static double code(double x, double y, double z) {
return -2.0;
}
def code(x, y, z): return -2.0
function code(x, y, z) return -2.0 end
function tmp = code(x, y, z) tmp = -2.0; end
code[x_, y_, z_] := -2.0
\begin{array}{l}
\\
-2
\end{array}
Initial program 99.6%
associate-*l/N/A
sub-negN/A
distribute-rgt-inN/A
*-commutativeN/A
+-commutativeN/A
+-lowering-+.f64N/A
associate-*l/N/A
associate-/l*N/A
distribute-neg-fracN/A
*-commutativeN/A
associate-/l*N/A
distribute-lft-neg-inN/A
metadata-evalN/A
*-inversesN/A
metadata-evalN/A
metadata-evalN/A
associate-*r/N/A
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
--lowering--.f6499.6%
Simplified99.6%
Taylor expanded in z around inf
Simplified31.0%
(FPCore (x y z) :precision binary64 (- (* 4.0 (/ x z)) (+ 2.0 (* 4.0 (/ y z)))))
double code(double x, double y, double z) {
return (4.0 * (x / z)) - (2.0 + (4.0 * (y / z)));
}
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 * (x / z)) - (2.0d0 + (4.0d0 * (y / z)))
end function
public static double code(double x, double y, double z) {
return (4.0 * (x / z)) - (2.0 + (4.0 * (y / z)));
}
def code(x, y, z): return (4.0 * (x / z)) - (2.0 + (4.0 * (y / z)))
function code(x, y, z) return Float64(Float64(4.0 * Float64(x / z)) - Float64(2.0 + Float64(4.0 * Float64(y / z)))) end
function tmp = code(x, y, z) tmp = (4.0 * (x / z)) - (2.0 + (4.0 * (y / z))); end
code[x_, y_, z_] := N[(N[(4.0 * N[(x / z), $MachinePrecision]), $MachinePrecision] - N[(2.0 + N[(4.0 * N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
4 \cdot \frac{x}{z} - \left(2 + 4 \cdot \frac{y}{z}\right)
\end{array}
herbie shell --seed 2024138
(FPCore (x y z)
:name "Data.Array.Repa.Algorithms.ColorRamp:rampColorHotToCold from repa-algorithms-3.4.0.1, B"
:precision binary64
:alt
(! :herbie-platform default (- (* 4 (/ x z)) (+ 2 (* 4 (/ y z)))))
(/ (* 4.0 (- (- x y) (* z 0.5))) z))