
(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 (* -4.0 (- (/ (- y x) z) -0.5)))
double code(double x, double y, double z) {
return -4.0 * (((y - x) / z) - -0.5);
}
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) * (((y - x) / z) - (-0.5d0))
end function
public static double code(double x, double y, double z) {
return -4.0 * (((y - x) / z) - -0.5);
}
def code(x, y, z): return -4.0 * (((y - x) / z) - -0.5)
function code(x, y, z) return Float64(-4.0 * Float64(Float64(Float64(y - x) / z) - -0.5)) end
function tmp = code(x, y, z) tmp = -4.0 * (((y - x) / z) - -0.5); end
code[x_, y_, z_] := N[(-4.0 * N[(N[(N[(y - x), $MachinePrecision] / z), $MachinePrecision] - -0.5), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
-4 \cdot \left(\frac{y - x}{z} - -0.5\right)
\end{array}
Initial program 100.0%
remove-double-neg100.0%
neg-mul-1100.0%
times-frac100.0%
metadata-eval100.0%
div-sub100.0%
distribute-frac-neg2100.0%
distribute-frac-neg100.0%
sub-neg100.0%
+-commutative100.0%
distribute-neg-out100.0%
remove-double-neg100.0%
sub-neg100.0%
*-commutative100.0%
neg-mul-1100.0%
times-frac100.0%
metadata-eval100.0%
*-inverses100.0%
metadata-eval100.0%
Simplified100.0%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* -4.0 (/ y z))))
(if (<= y -8.6e+74)
t_0
(if (<= y -1.45e-113)
-2.0
(if (<= y -1.1e-201) (/ (* x 4.0) z) (if (<= y 1.46e+87) -2.0 t_0))))))
double code(double x, double y, double z) {
double t_0 = -4.0 * (y / z);
double tmp;
if (y <= -8.6e+74) {
tmp = t_0;
} else if (y <= -1.45e-113) {
tmp = -2.0;
} else if (y <= -1.1e-201) {
tmp = (x * 4.0) / z;
} else if (y <= 1.46e+87) {
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 <= (-8.6d+74)) then
tmp = t_0
else if (y <= (-1.45d-113)) then
tmp = -2.0d0
else if (y <= (-1.1d-201)) then
tmp = (x * 4.0d0) / z
else if (y <= 1.46d+87) 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 <= -8.6e+74) {
tmp = t_0;
} else if (y <= -1.45e-113) {
tmp = -2.0;
} else if (y <= -1.1e-201) {
tmp = (x * 4.0) / z;
} else if (y <= 1.46e+87) {
tmp = -2.0;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = -4.0 * (y / z) tmp = 0 if y <= -8.6e+74: tmp = t_0 elif y <= -1.45e-113: tmp = -2.0 elif y <= -1.1e-201: tmp = (x * 4.0) / z elif y <= 1.46e+87: 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 <= -8.6e+74) tmp = t_0; elseif (y <= -1.45e-113) tmp = -2.0; elseif (y <= -1.1e-201) tmp = Float64(Float64(x * 4.0) / z); elseif (y <= 1.46e+87) 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 <= -8.6e+74) tmp = t_0; elseif (y <= -1.45e-113) tmp = -2.0; elseif (y <= -1.1e-201) tmp = (x * 4.0) / z; elseif (y <= 1.46e+87) 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, -8.6e+74], t$95$0, If[LessEqual[y, -1.45e-113], -2.0, If[LessEqual[y, -1.1e-201], N[(N[(x * 4.0), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[y, 1.46e+87], -2.0, t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -4 \cdot \frac{y}{z}\\
\mathbf{if}\;y \leq -8.6 \cdot 10^{+74}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq -1.45 \cdot 10^{-113}:\\
\;\;\;\;-2\\
\mathbf{elif}\;y \leq -1.1 \cdot 10^{-201}:\\
\;\;\;\;\frac{x \cdot 4}{z}\\
\mathbf{elif}\;y \leq 1.46 \cdot 10^{+87}:\\
\;\;\;\;-2\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -8.60000000000000001e74 or 1.46e87 < y Initial program 100.0%
Taylor expanded in y around inf 73.8%
*-commutative73.8%
Simplified73.8%
if -8.60000000000000001e74 < y < -1.45000000000000002e-113 or -1.1e-201 < y < 1.46e87Initial program 100.0%
Taylor expanded in z around inf 54.0%
if -1.45000000000000002e-113 < y < -1.1e-201Initial program 100.0%
Taylor expanded in x around inf 65.9%
*-commutative65.9%
associate-*l/65.9%
Simplified65.9%
Final simplification61.8%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* -4.0 (/ y z))))
(if (<= y -2.4e+74)
t_0
(if (<= y -7e-111)
-2.0
(if (<= y -5e-202) (* x (/ 4.0 z)) (if (<= y 5.2e+85) -2.0 t_0))))))
double code(double x, double y, double z) {
double t_0 = -4.0 * (y / z);
double tmp;
if (y <= -2.4e+74) {
tmp = t_0;
} else if (y <= -7e-111) {
tmp = -2.0;
} else if (y <= -5e-202) {
tmp = x * (4.0 / z);
} else if (y <= 5.2e+85) {
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 <= (-2.4d+74)) then
tmp = t_0
else if (y <= (-7d-111)) then
tmp = -2.0d0
else if (y <= (-5d-202)) then
tmp = x * (4.0d0 / z)
else if (y <= 5.2d+85) 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 <= -2.4e+74) {
tmp = t_0;
} else if (y <= -7e-111) {
tmp = -2.0;
} else if (y <= -5e-202) {
tmp = x * (4.0 / z);
} else if (y <= 5.2e+85) {
tmp = -2.0;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = -4.0 * (y / z) tmp = 0 if y <= -2.4e+74: tmp = t_0 elif y <= -7e-111: tmp = -2.0 elif y <= -5e-202: tmp = x * (4.0 / z) elif y <= 5.2e+85: 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 <= -2.4e+74) tmp = t_0; elseif (y <= -7e-111) tmp = -2.0; elseif (y <= -5e-202) tmp = Float64(x * Float64(4.0 / z)); elseif (y <= 5.2e+85) 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 <= -2.4e+74) tmp = t_0; elseif (y <= -7e-111) tmp = -2.0; elseif (y <= -5e-202) tmp = x * (4.0 / z); elseif (y <= 5.2e+85) 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, -2.4e+74], t$95$0, If[LessEqual[y, -7e-111], -2.0, If[LessEqual[y, -5e-202], N[(x * N[(4.0 / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 5.2e+85], -2.0, t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -4 \cdot \frac{y}{z}\\
\mathbf{if}\;y \leq -2.4 \cdot 10^{+74}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq -7 \cdot 10^{-111}:\\
\;\;\;\;-2\\
\mathbf{elif}\;y \leq -5 \cdot 10^{-202}:\\
\;\;\;\;x \cdot \frac{4}{z}\\
\mathbf{elif}\;y \leq 5.2 \cdot 10^{+85}:\\
\;\;\;\;-2\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -2.40000000000000008e74 or 5.20000000000000021e85 < y Initial program 100.0%
Taylor expanded in y around inf 73.8%
*-commutative73.8%
Simplified73.8%
if -2.40000000000000008e74 < y < -7.0000000000000001e-111 or -4.99999999999999973e-202 < y < 5.20000000000000021e85Initial program 100.0%
Taylor expanded in z around inf 54.0%
if -7.0000000000000001e-111 < y < -4.99999999999999973e-202Initial program 100.0%
Taylor expanded in x around inf 65.9%
*-commutative65.9%
associate-*l/65.9%
associate-*r/65.7%
Simplified65.7%
Final simplification61.8%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* y (/ -4.0 z))))
(if (<= y -5.1e+73)
t_0
(if (<= y -1.42e-112)
-2.0
(if (<= y -1.3e-201) (* x (/ 4.0 z)) (if (<= y 4.2e+89) -2.0 t_0))))))
double code(double x, double y, double z) {
double t_0 = y * (-4.0 / z);
double tmp;
if (y <= -5.1e+73) {
tmp = t_0;
} else if (y <= -1.42e-112) {
tmp = -2.0;
} else if (y <= -1.3e-201) {
tmp = x * (4.0 / z);
} else if (y <= 4.2e+89) {
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 = y * ((-4.0d0) / z)
if (y <= (-5.1d+73)) then
tmp = t_0
else if (y <= (-1.42d-112)) then
tmp = -2.0d0
else if (y <= (-1.3d-201)) then
tmp = x * (4.0d0 / z)
else if (y <= 4.2d+89) 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 = y * (-4.0 / z);
double tmp;
if (y <= -5.1e+73) {
tmp = t_0;
} else if (y <= -1.42e-112) {
tmp = -2.0;
} else if (y <= -1.3e-201) {
tmp = x * (4.0 / z);
} else if (y <= 4.2e+89) {
tmp = -2.0;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = y * (-4.0 / z) tmp = 0 if y <= -5.1e+73: tmp = t_0 elif y <= -1.42e-112: tmp = -2.0 elif y <= -1.3e-201: tmp = x * (4.0 / z) elif y <= 4.2e+89: tmp = -2.0 else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(y * Float64(-4.0 / z)) tmp = 0.0 if (y <= -5.1e+73) tmp = t_0; elseif (y <= -1.42e-112) tmp = -2.0; elseif (y <= -1.3e-201) tmp = Float64(x * Float64(4.0 / z)); elseif (y <= 4.2e+89) tmp = -2.0; else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = y * (-4.0 / z); tmp = 0.0; if (y <= -5.1e+73) tmp = t_0; elseif (y <= -1.42e-112) tmp = -2.0; elseif (y <= -1.3e-201) tmp = x * (4.0 / z); elseif (y <= 4.2e+89) tmp = -2.0; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(y * N[(-4.0 / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -5.1e+73], t$95$0, If[LessEqual[y, -1.42e-112], -2.0, If[LessEqual[y, -1.3e-201], N[(x * N[(4.0 / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4.2e+89], -2.0, t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y \cdot \frac{-4}{z}\\
\mathbf{if}\;y \leq -5.1 \cdot 10^{+73}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq -1.42 \cdot 10^{-112}:\\
\;\;\;\;-2\\
\mathbf{elif}\;y \leq -1.3 \cdot 10^{-201}:\\
\;\;\;\;x \cdot \frac{4}{z}\\
\mathbf{elif}\;y \leq 4.2 \cdot 10^{+89}:\\
\;\;\;\;-2\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -5.10000000000000024e73 or 4.19999999999999972e89 < y Initial program 100.0%
Taylor expanded in y around inf 73.8%
*-commutative73.8%
associate-*l/73.8%
associate-*r/73.7%
Simplified73.7%
if -5.10000000000000024e73 < y < -1.42e-112 or -1.29999999999999991e-201 < y < 4.19999999999999972e89Initial program 100.0%
Taylor expanded in z around inf 54.0%
if -1.42e-112 < y < -1.29999999999999991e-201Initial program 100.0%
Taylor expanded in x around inf 65.9%
*-commutative65.9%
associate-*l/65.9%
associate-*r/65.7%
Simplified65.7%
(FPCore (x y z) :precision binary64 (if (or (<= y -5e+52) (not (<= y 9.2e+50))) (* -4.0 (- (/ y z) -0.5)) (* -4.0 (- 0.5 (/ x z)))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -5e+52) || !(y <= 9.2e+50)) {
tmp = -4.0 * ((y / z) - -0.5);
} else {
tmp = -4.0 * (0.5 - (x / 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 <= (-5d+52)) .or. (.not. (y <= 9.2d+50))) then
tmp = (-4.0d0) * ((y / z) - (-0.5d0))
else
tmp = (-4.0d0) * (0.5d0 - (x / z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -5e+52) || !(y <= 9.2e+50)) {
tmp = -4.0 * ((y / z) - -0.5);
} else {
tmp = -4.0 * (0.5 - (x / z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -5e+52) or not (y <= 9.2e+50): tmp = -4.0 * ((y / z) - -0.5) else: tmp = -4.0 * (0.5 - (x / z)) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -5e+52) || !(y <= 9.2e+50)) tmp = Float64(-4.0 * Float64(Float64(y / z) - -0.5)); else tmp = Float64(-4.0 * Float64(0.5 - Float64(x / z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -5e+52) || ~((y <= 9.2e+50))) tmp = -4.0 * ((y / z) - -0.5); else tmp = -4.0 * (0.5 - (x / z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -5e+52], N[Not[LessEqual[y, 9.2e+50]], $MachinePrecision]], N[(-4.0 * N[(N[(y / z), $MachinePrecision] - -0.5), $MachinePrecision]), $MachinePrecision], N[(-4.0 * N[(0.5 - N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5 \cdot 10^{+52} \lor \neg \left(y \leq 9.2 \cdot 10^{+50}\right):\\
\;\;\;\;-4 \cdot \left(\frac{y}{z} - -0.5\right)\\
\mathbf{else}:\\
\;\;\;\;-4 \cdot \left(0.5 - \frac{x}{z}\right)\\
\end{array}
\end{array}
if y < -5e52 or 9.19999999999999987e50 < y Initial program 100.0%
remove-double-neg100.0%
neg-mul-1100.0%
times-frac100.0%
metadata-eval100.0%
div-sub100.0%
distribute-frac-neg2100.0%
distribute-frac-neg100.0%
sub-neg100.0%
+-commutative100.0%
distribute-neg-out100.0%
remove-double-neg100.0%
sub-neg100.0%
*-commutative100.0%
neg-mul-1100.0%
times-frac100.0%
metadata-eval100.0%
*-inverses100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 85.7%
if -5e52 < y < 9.19999999999999987e50Initial program 100.0%
remove-double-neg100.0%
neg-mul-1100.0%
times-frac100.0%
metadata-eval100.0%
div-sub100.0%
distribute-frac-neg2100.0%
distribute-frac-neg100.0%
sub-neg100.0%
+-commutative100.0%
distribute-neg-out100.0%
remove-double-neg100.0%
sub-neg100.0%
*-commutative100.0%
neg-mul-1100.0%
times-frac100.0%
metadata-eval100.0%
*-inverses100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 94.2%
Final simplification90.9%
(FPCore (x y z) :precision binary64 (if (or (<= y -5.5e+75) (not (<= y 2e+96))) (* -4.0 (/ y z)) (* -4.0 (- 0.5 (/ x z)))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -5.5e+75) || !(y <= 2e+96)) {
tmp = -4.0 * (y / z);
} else {
tmp = -4.0 * (0.5 - (x / 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 <= (-5.5d+75)) .or. (.not. (y <= 2d+96))) then
tmp = (-4.0d0) * (y / z)
else
tmp = (-4.0d0) * (0.5d0 - (x / z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -5.5e+75) || !(y <= 2e+96)) {
tmp = -4.0 * (y / z);
} else {
tmp = -4.0 * (0.5 - (x / z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -5.5e+75) or not (y <= 2e+96): tmp = -4.0 * (y / z) else: tmp = -4.0 * (0.5 - (x / z)) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -5.5e+75) || !(y <= 2e+96)) tmp = Float64(-4.0 * Float64(y / z)); else tmp = Float64(-4.0 * Float64(0.5 - Float64(x / z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -5.5e+75) || ~((y <= 2e+96))) tmp = -4.0 * (y / z); else tmp = -4.0 * (0.5 - (x / z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -5.5e+75], N[Not[LessEqual[y, 2e+96]], $MachinePrecision]], N[(-4.0 * N[(y / z), $MachinePrecision]), $MachinePrecision], N[(-4.0 * N[(0.5 - N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.5 \cdot 10^{+75} \lor \neg \left(y \leq 2 \cdot 10^{+96}\right):\\
\;\;\;\;-4 \cdot \frac{y}{z}\\
\mathbf{else}:\\
\;\;\;\;-4 \cdot \left(0.5 - \frac{x}{z}\right)\\
\end{array}
\end{array}
if y < -5.5000000000000001e75 or 2.0000000000000001e96 < y Initial program 100.0%
Taylor expanded in y around inf 74.7%
*-commutative74.7%
Simplified74.7%
if -5.5000000000000001e75 < y < 2.0000000000000001e96Initial program 100.0%
remove-double-neg100.0%
neg-mul-1100.0%
times-frac100.0%
metadata-eval100.0%
div-sub100.0%
distribute-frac-neg2100.0%
distribute-frac-neg100.0%
sub-neg100.0%
+-commutative100.0%
distribute-neg-out100.0%
remove-double-neg100.0%
sub-neg100.0%
*-commutative100.0%
neg-mul-1100.0%
times-frac100.0%
metadata-eval100.0%
*-inverses100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 92.9%
Final simplification86.6%
(FPCore (x y z) :precision binary64 (if (<= y -4.8e+52) (* -4.0 (- (/ y z) -0.5)) (if (<= y 2.1e+91) (* -4.0 (- 0.5 (/ x z))) (* (- x y) (/ 4.0 z)))))
double code(double x, double y, double z) {
double tmp;
if (y <= -4.8e+52) {
tmp = -4.0 * ((y / z) - -0.5);
} else if (y <= 2.1e+91) {
tmp = -4.0 * (0.5 - (x / z));
} else {
tmp = (x - 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 <= (-4.8d+52)) then
tmp = (-4.0d0) * ((y / z) - (-0.5d0))
else if (y <= 2.1d+91) then
tmp = (-4.0d0) * (0.5d0 - (x / z))
else
tmp = (x - y) * (4.0d0 / z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -4.8e+52) {
tmp = -4.0 * ((y / z) - -0.5);
} else if (y <= 2.1e+91) {
tmp = -4.0 * (0.5 - (x / z));
} else {
tmp = (x - y) * (4.0 / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -4.8e+52: tmp = -4.0 * ((y / z) - -0.5) elif y <= 2.1e+91: tmp = -4.0 * (0.5 - (x / z)) else: tmp = (x - y) * (4.0 / z) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -4.8e+52) tmp = Float64(-4.0 * Float64(Float64(y / z) - -0.5)); elseif (y <= 2.1e+91) tmp = Float64(-4.0 * Float64(0.5 - Float64(x / z))); else tmp = Float64(Float64(x - y) * Float64(4.0 / z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -4.8e+52) tmp = -4.0 * ((y / z) - -0.5); elseif (y <= 2.1e+91) tmp = -4.0 * (0.5 - (x / z)); else tmp = (x - y) * (4.0 / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -4.8e+52], N[(-4.0 * N[(N[(y / z), $MachinePrecision] - -0.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.1e+91], N[(-4.0 * N[(0.5 - N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x - y), $MachinePrecision] * N[(4.0 / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.8 \cdot 10^{+52}:\\
\;\;\;\;-4 \cdot \left(\frac{y}{z} - -0.5\right)\\
\mathbf{elif}\;y \leq 2.1 \cdot 10^{+91}:\\
\;\;\;\;-4 \cdot \left(0.5 - \frac{x}{z}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x - y\right) \cdot \frac{4}{z}\\
\end{array}
\end{array}
if y < -4.8e52Initial program 99.9%
remove-double-neg99.9%
neg-mul-199.9%
times-frac99.9%
metadata-eval99.9%
div-sub99.9%
distribute-frac-neg299.9%
distribute-frac-neg99.9%
sub-neg99.9%
+-commutative99.9%
distribute-neg-out99.9%
remove-double-neg99.9%
sub-neg99.9%
*-commutative99.9%
neg-mul-199.9%
times-frac99.9%
metadata-eval99.9%
*-inverses99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in y around inf 86.4%
if -4.8e52 < y < 2.10000000000000008e91Initial program 100.0%
remove-double-neg100.0%
neg-mul-1100.0%
times-frac100.0%
metadata-eval100.0%
div-sub100.0%
distribute-frac-neg2100.0%
distribute-frac-neg100.0%
sub-neg100.0%
+-commutative100.0%
distribute-neg-out100.0%
remove-double-neg100.0%
sub-neg100.0%
*-commutative100.0%
neg-mul-1100.0%
times-frac100.0%
metadata-eval100.0%
*-inverses100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 93.8%
if 2.10000000000000008e91 < y Initial program 100.0%
Taylor expanded in z around 0 90.7%
associate-*r/90.7%
*-commutative90.7%
associate-/l*90.5%
Simplified90.5%
(FPCore (x y z) :precision binary64 (if (<= z -1.65e+14) -2.0 (if (<= z 3.25e+122) (* x (/ 4.0 z)) -2.0)))
double code(double x, double y, double z) {
double tmp;
if (z <= -1.65e+14) {
tmp = -2.0;
} else if (z <= 3.25e+122) {
tmp = x * (4.0 / 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.65d+14)) then
tmp = -2.0d0
else if (z <= 3.25d+122) then
tmp = x * (4.0d0 / 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.65e+14) {
tmp = -2.0;
} else if (z <= 3.25e+122) {
tmp = x * (4.0 / z);
} else {
tmp = -2.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1.65e+14: tmp = -2.0 elif z <= 3.25e+122: tmp = x * (4.0 / z) else: tmp = -2.0 return tmp
function code(x, y, z) tmp = 0.0 if (z <= -1.65e+14) tmp = -2.0; elseif (z <= 3.25e+122) tmp = Float64(x * Float64(4.0 / z)); else tmp = -2.0; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -1.65e+14) tmp = -2.0; elseif (z <= 3.25e+122) tmp = x * (4.0 / z); else tmp = -2.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -1.65e+14], -2.0, If[LessEqual[z, 3.25e+122], N[(x * N[(4.0 / z), $MachinePrecision]), $MachinePrecision], -2.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.65 \cdot 10^{+14}:\\
\;\;\;\;-2\\
\mathbf{elif}\;z \leq 3.25 \cdot 10^{+122}:\\
\;\;\;\;x \cdot \frac{4}{z}\\
\mathbf{else}:\\
\;\;\;\;-2\\
\end{array}
\end{array}
if z < -1.65e14 or 3.24999999999999982e122 < z Initial program 100.0%
Taylor expanded in z around inf 68.7%
if -1.65e14 < z < 3.24999999999999982e122Initial program 100.0%
Taylor expanded in x around inf 51.1%
*-commutative51.1%
associate-*l/51.1%
associate-*r/50.9%
Simplified50.9%
(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 100.0%
Taylor expanded in z around inf 37.8%
(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 2024093
(FPCore (x y z)
:name "Data.Array.Repa.Algorithms.ColorRamp:rampColorHotToCold from repa-algorithms-3.4.0.1, B"
:precision binary64
:alt
(- (* 4.0 (/ x z)) (+ 2.0 (* 4.0 (/ y z))))
(/ (* 4.0 (- (- x y) (* z 0.5))) z))