
(FPCore (x y z t) :precision binary64 (/ (* x (- y z)) (- t z)))
double code(double x, double y, double z, double t) {
return (x * (y - z)) / (t - z);
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (x * (y - z)) / (t - z)
end function
public static double code(double x, double y, double z, double t) {
return (x * (y - z)) / (t - z);
}
def code(x, y, z, t): return (x * (y - z)) / (t - z)
function code(x, y, z, t) return Float64(Float64(x * Float64(y - z)) / Float64(t - z)) end
function tmp = code(x, y, z, t) tmp = (x * (y - z)) / (t - z); end
code[x_, y_, z_, t_] := N[(N[(x * N[(y - z), $MachinePrecision]), $MachinePrecision] / N[(t - z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot \left(y - z\right)}{t - z}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (/ (* x (- y z)) (- t z)))
double code(double x, double y, double z, double t) {
return (x * (y - z)) / (t - z);
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (x * (y - z)) / (t - z)
end function
public static double code(double x, double y, double z, double t) {
return (x * (y - z)) / (t - z);
}
def code(x, y, z, t): return (x * (y - z)) / (t - z)
function code(x, y, z, t) return Float64(Float64(x * Float64(y - z)) / Float64(t - z)) end
function tmp = code(x, y, z, t) tmp = (x * (y - z)) / (t - z); end
code[x_, y_, z_, t_] := N[(N[(x * N[(y - z), $MachinePrecision]), $MachinePrecision] / N[(t - z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot \left(y - z\right)}{t - z}
\end{array}
(FPCore (x y z t) :precision binary64 (* x (/ (- y z) (- t z))))
double code(double x, double y, double z, double t) {
return x * ((y - z) / (t - z));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x * ((y - z) / (t - z))
end function
public static double code(double x, double y, double z, double t) {
return x * ((y - z) / (t - z));
}
def code(x, y, z, t): return x * ((y - z) / (t - z))
function code(x, y, z, t) return Float64(x * Float64(Float64(y - z) / Float64(t - z))) end
function tmp = code(x, y, z, t) tmp = x * ((y - z) / (t - z)); end
code[x_, y_, z_, t_] := N[(x * N[(N[(y - z), $MachinePrecision] / N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \frac{y - z}{t - z}
\end{array}
Initial program 85.9%
associate-*r/97.3%
Simplified97.3%
Final simplification97.3%
(FPCore (x y z t)
:precision binary64
(if (<= z -2.8e+56)
(* x (/ z (- z t)))
(if (<= z 1.4e-229)
(/ x (/ (- t z) y))
(if (<= z 1.7e-113)
(* (- y z) (/ x t))
(if (<= z 4.9e+72) (* x (- (/ y t) (/ z t))) (* x (- 1.0 (/ y z))))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -2.8e+56) {
tmp = x * (z / (z - t));
} else if (z <= 1.4e-229) {
tmp = x / ((t - z) / y);
} else if (z <= 1.7e-113) {
tmp = (y - z) * (x / t);
} else if (z <= 4.9e+72) {
tmp = x * ((y / t) - (z / t));
} else {
tmp = x * (1.0 - (y / z));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= (-2.8d+56)) then
tmp = x * (z / (z - t))
else if (z <= 1.4d-229) then
tmp = x / ((t - z) / y)
else if (z <= 1.7d-113) then
tmp = (y - z) * (x / t)
else if (z <= 4.9d+72) then
tmp = x * ((y / t) - (z / t))
else
tmp = x * (1.0d0 - (y / z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -2.8e+56) {
tmp = x * (z / (z - t));
} else if (z <= 1.4e-229) {
tmp = x / ((t - z) / y);
} else if (z <= 1.7e-113) {
tmp = (y - z) * (x / t);
} else if (z <= 4.9e+72) {
tmp = x * ((y / t) - (z / t));
} else {
tmp = x * (1.0 - (y / z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -2.8e+56: tmp = x * (z / (z - t)) elif z <= 1.4e-229: tmp = x / ((t - z) / y) elif z <= 1.7e-113: tmp = (y - z) * (x / t) elif z <= 4.9e+72: tmp = x * ((y / t) - (z / t)) else: tmp = x * (1.0 - (y / z)) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -2.8e+56) tmp = Float64(x * Float64(z / Float64(z - t))); elseif (z <= 1.4e-229) tmp = Float64(x / Float64(Float64(t - z) / y)); elseif (z <= 1.7e-113) tmp = Float64(Float64(y - z) * Float64(x / t)); elseif (z <= 4.9e+72) tmp = Float64(x * Float64(Float64(y / t) - Float64(z / t))); else tmp = Float64(x * Float64(1.0 - Float64(y / z))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -2.8e+56) tmp = x * (z / (z - t)); elseif (z <= 1.4e-229) tmp = x / ((t - z) / y); elseif (z <= 1.7e-113) tmp = (y - z) * (x / t); elseif (z <= 4.9e+72) tmp = x * ((y / t) - (z / t)); else tmp = x * (1.0 - (y / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -2.8e+56], N[(x * N[(z / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.4e-229], N[(x / N[(N[(t - z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.7e-113], N[(N[(y - z), $MachinePrecision] * N[(x / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 4.9e+72], N[(x * N[(N[(y / t), $MachinePrecision] - N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.8 \cdot 10^{+56}:\\
\;\;\;\;x \cdot \frac{z}{z - t}\\
\mathbf{elif}\;z \leq 1.4 \cdot 10^{-229}:\\
\;\;\;\;\frac{x}{\frac{t - z}{y}}\\
\mathbf{elif}\;z \leq 1.7 \cdot 10^{-113}:\\
\;\;\;\;\left(y - z\right) \cdot \frac{x}{t}\\
\mathbf{elif}\;z \leq 4.9 \cdot 10^{+72}:\\
\;\;\;\;x \cdot \left(\frac{y}{t} - \frac{z}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - \frac{y}{z}\right)\\
\end{array}
\end{array}
if z < -2.80000000000000008e56Initial program 75.0%
associate-*r/99.9%
Simplified99.9%
Taylor expanded in y around 0 89.6%
neg-mul-189.6%
distribute-neg-frac89.6%
Simplified89.6%
frac-2neg89.6%
div-inv89.6%
remove-double-neg89.6%
sub-neg89.6%
distribute-neg-in89.6%
remove-double-neg89.6%
Applied egg-rr89.6%
associate-*r/89.6%
*-rgt-identity89.6%
+-commutative89.6%
unsub-neg89.6%
Simplified89.6%
if -2.80000000000000008e56 < z < 1.39999999999999995e-229Initial program 93.0%
associate-/l*97.4%
Simplified97.4%
Taylor expanded in y around inf 81.9%
if 1.39999999999999995e-229 < z < 1.7000000000000001e-113Initial program 99.8%
associate-*l/93.4%
Simplified93.4%
Taylor expanded in t around inf 87.1%
if 1.7000000000000001e-113 < z < 4.90000000000000006e72Initial program 88.7%
associate-*r/97.7%
Simplified97.7%
Taylor expanded in t around inf 72.9%
Taylor expanded in y around 0 72.9%
+-commutative72.9%
neg-mul-172.9%
sub-neg72.9%
Simplified72.9%
if 4.90000000000000006e72 < z Initial program 75.2%
associate-*r/99.9%
Simplified99.9%
div-sub99.9%
Applied egg-rr99.9%
Taylor expanded in t around 0 83.7%
mul-1-neg83.7%
unsub-neg83.7%
Simplified83.7%
Final simplification83.0%
(FPCore (x y z t)
:precision binary64
(if (<= z -1.62e+59)
(* x (/ z (- z t)))
(if (<= z 4.7e-228)
(/ x (/ (- t z) y))
(if (<= z 1.5e-113)
(* (- y z) (/ x t))
(if (<= z 4.5e+71) (* x (/ (- y z) t)) (* x (- 1.0 (/ y z))))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.62e+59) {
tmp = x * (z / (z - t));
} else if (z <= 4.7e-228) {
tmp = x / ((t - z) / y);
} else if (z <= 1.5e-113) {
tmp = (y - z) * (x / t);
} else if (z <= 4.5e+71) {
tmp = x * ((y - z) / t);
} else {
tmp = x * (1.0 - (y / z));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= (-1.62d+59)) then
tmp = x * (z / (z - t))
else if (z <= 4.7d-228) then
tmp = x / ((t - z) / y)
else if (z <= 1.5d-113) then
tmp = (y - z) * (x / t)
else if (z <= 4.5d+71) then
tmp = x * ((y - z) / t)
else
tmp = x * (1.0d0 - (y / z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.62e+59) {
tmp = x * (z / (z - t));
} else if (z <= 4.7e-228) {
tmp = x / ((t - z) / y);
} else if (z <= 1.5e-113) {
tmp = (y - z) * (x / t);
} else if (z <= 4.5e+71) {
tmp = x * ((y - z) / t);
} else {
tmp = x * (1.0 - (y / z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.62e+59: tmp = x * (z / (z - t)) elif z <= 4.7e-228: tmp = x / ((t - z) / y) elif z <= 1.5e-113: tmp = (y - z) * (x / t) elif z <= 4.5e+71: tmp = x * ((y - z) / t) else: tmp = x * (1.0 - (y / z)) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.62e+59) tmp = Float64(x * Float64(z / Float64(z - t))); elseif (z <= 4.7e-228) tmp = Float64(x / Float64(Float64(t - z) / y)); elseif (z <= 1.5e-113) tmp = Float64(Float64(y - z) * Float64(x / t)); elseif (z <= 4.5e+71) tmp = Float64(x * Float64(Float64(y - z) / t)); else tmp = Float64(x * Float64(1.0 - Float64(y / z))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -1.62e+59) tmp = x * (z / (z - t)); elseif (z <= 4.7e-228) tmp = x / ((t - z) / y); elseif (z <= 1.5e-113) tmp = (y - z) * (x / t); elseif (z <= 4.5e+71) tmp = x * ((y - z) / t); else tmp = x * (1.0 - (y / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.62e+59], N[(x * N[(z / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 4.7e-228], N[(x / N[(N[(t - z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.5e-113], N[(N[(y - z), $MachinePrecision] * N[(x / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 4.5e+71], N[(x * N[(N[(y - z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.62 \cdot 10^{+59}:\\
\;\;\;\;x \cdot \frac{z}{z - t}\\
\mathbf{elif}\;z \leq 4.7 \cdot 10^{-228}:\\
\;\;\;\;\frac{x}{\frac{t - z}{y}}\\
\mathbf{elif}\;z \leq 1.5 \cdot 10^{-113}:\\
\;\;\;\;\left(y - z\right) \cdot \frac{x}{t}\\
\mathbf{elif}\;z \leq 4.5 \cdot 10^{+71}:\\
\;\;\;\;x \cdot \frac{y - z}{t}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - \frac{y}{z}\right)\\
\end{array}
\end{array}
if z < -1.6200000000000001e59Initial program 75.0%
associate-*r/99.9%
Simplified99.9%
Taylor expanded in y around 0 89.6%
neg-mul-189.6%
distribute-neg-frac89.6%
Simplified89.6%
frac-2neg89.6%
div-inv89.6%
remove-double-neg89.6%
sub-neg89.6%
distribute-neg-in89.6%
remove-double-neg89.6%
Applied egg-rr89.6%
associate-*r/89.6%
*-rgt-identity89.6%
+-commutative89.6%
unsub-neg89.6%
Simplified89.6%
if -1.6200000000000001e59 < z < 4.7000000000000002e-228Initial program 93.0%
associate-/l*97.4%
Simplified97.4%
Taylor expanded in y around inf 81.9%
if 4.7000000000000002e-228 < z < 1.5e-113Initial program 99.8%
associate-*l/93.4%
Simplified93.4%
Taylor expanded in t around inf 87.1%
if 1.5e-113 < z < 4.50000000000000043e71Initial program 88.7%
associate-*r/97.7%
Simplified97.7%
Taylor expanded in t around inf 72.9%
if 4.50000000000000043e71 < z Initial program 75.2%
associate-*r/99.9%
Simplified99.9%
div-sub99.9%
Applied egg-rr99.9%
Taylor expanded in t around 0 83.7%
mul-1-neg83.7%
unsub-neg83.7%
Simplified83.7%
Final simplification83.0%
(FPCore (x y z t) :precision binary64 (if (<= z -9.5e+83) x (if (<= z -4.6e-8) (* x (/ (- z) t)) (if (<= z 2.05e+71) (* x (/ y t)) x))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -9.5e+83) {
tmp = x;
} else if (z <= -4.6e-8) {
tmp = x * (-z / t);
} else if (z <= 2.05e+71) {
tmp = x * (y / t);
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= (-9.5d+83)) then
tmp = x
else if (z <= (-4.6d-8)) then
tmp = x * (-z / t)
else if (z <= 2.05d+71) then
tmp = x * (y / t)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -9.5e+83) {
tmp = x;
} else if (z <= -4.6e-8) {
tmp = x * (-z / t);
} else if (z <= 2.05e+71) {
tmp = x * (y / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -9.5e+83: tmp = x elif z <= -4.6e-8: tmp = x * (-z / t) elif z <= 2.05e+71: tmp = x * (y / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -9.5e+83) tmp = x; elseif (z <= -4.6e-8) tmp = Float64(x * Float64(Float64(-z) / t)); elseif (z <= 2.05e+71) tmp = Float64(x * Float64(y / t)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -9.5e+83) tmp = x; elseif (z <= -4.6e-8) tmp = x * (-z / t); elseif (z <= 2.05e+71) tmp = x * (y / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -9.5e+83], x, If[LessEqual[z, -4.6e-8], N[(x * N[((-z) / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.05e+71], N[(x * N[(y / t), $MachinePrecision]), $MachinePrecision], x]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -9.5 \cdot 10^{+83}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq -4.6 \cdot 10^{-8}:\\
\;\;\;\;x \cdot \frac{-z}{t}\\
\mathbf{elif}\;z \leq 2.05 \cdot 10^{+71}:\\
\;\;\;\;x \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -9.5000000000000002e83 or 2.0500000000000001e71 < z Initial program 73.9%
associate-*r/99.9%
Simplified99.9%
Taylor expanded in z around inf 75.3%
if -9.5000000000000002e83 < z < -4.6000000000000002e-8Initial program 90.0%
associate-*r/99.5%
Simplified99.5%
Taylor expanded in t around inf 60.3%
Taylor expanded in y around 0 47.4%
neg-mul-147.4%
distribute-neg-frac47.4%
Simplified47.4%
if -4.6000000000000002e-8 < z < 2.0500000000000001e71Initial program 93.8%
associate-*r/95.1%
Simplified95.1%
Taylor expanded in z around 0 66.7%
Final simplification68.5%
(FPCore (x y z t) :precision binary64 (if (<= z -1.05e+101) x (if (<= z -1.35) (/ (- x) (/ t z)) (if (<= z 1.6e+72) (* x (/ y t)) x))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.05e+101) {
tmp = x;
} else if (z <= -1.35) {
tmp = -x / (t / z);
} else if (z <= 1.6e+72) {
tmp = x * (y / t);
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= (-1.05d+101)) then
tmp = x
else if (z <= (-1.35d0)) then
tmp = -x / (t / z)
else if (z <= 1.6d+72) then
tmp = x * (y / t)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.05e+101) {
tmp = x;
} else if (z <= -1.35) {
tmp = -x / (t / z);
} else if (z <= 1.6e+72) {
tmp = x * (y / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.05e+101: tmp = x elif z <= -1.35: tmp = -x / (t / z) elif z <= 1.6e+72: tmp = x * (y / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.05e+101) tmp = x; elseif (z <= -1.35) tmp = Float64(Float64(-x) / Float64(t / z)); elseif (z <= 1.6e+72) tmp = Float64(x * Float64(y / t)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -1.05e+101) tmp = x; elseif (z <= -1.35) tmp = -x / (t / z); elseif (z <= 1.6e+72) tmp = x * (y / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.05e+101], x, If[LessEqual[z, -1.35], N[((-x) / N[(t / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.6e+72], N[(x * N[(y / t), $MachinePrecision]), $MachinePrecision], x]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.05 \cdot 10^{+101}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq -1.35:\\
\;\;\;\;\frac{-x}{\frac{t}{z}}\\
\mathbf{elif}\;z \leq 1.6 \cdot 10^{+72}:\\
\;\;\;\;x \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -1.05e101 or 1.6000000000000001e72 < z Initial program 73.3%
associate-*r/99.9%
Simplified99.9%
Taylor expanded in z around inf 75.8%
if -1.05e101 < z < -1.3500000000000001Initial program 90.9%
associate-*r/99.5%
Simplified99.5%
Taylor expanded in t around inf 59.5%
Taylor expanded in y around 0 47.9%
mul-1-neg47.9%
associate-/l*48.0%
distribute-neg-frac48.0%
Simplified48.0%
if -1.3500000000000001 < z < 1.6000000000000001e72Initial program 93.8%
associate-*r/95.1%
Simplified95.1%
Taylor expanded in z around 0 66.7%
Final simplification68.5%
(FPCore (x y z t) :precision binary64 (if (or (<= z -9e-21) (not (<= z 5.5e+32))) (* x (- 1.0 (/ y z))) (* x (/ y t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -9e-21) || !(z <= 5.5e+32)) {
tmp = x * (1.0 - (y / z));
} else {
tmp = x * (y / t);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((z <= (-9d-21)) .or. (.not. (z <= 5.5d+32))) then
tmp = x * (1.0d0 - (y / z))
else
tmp = x * (y / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -9e-21) || !(z <= 5.5e+32)) {
tmp = x * (1.0 - (y / z));
} else {
tmp = x * (y / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -9e-21) or not (z <= 5.5e+32): tmp = x * (1.0 - (y / z)) else: tmp = x * (y / t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -9e-21) || !(z <= 5.5e+32)) tmp = Float64(x * Float64(1.0 - Float64(y / z))); else tmp = Float64(x * Float64(y / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -9e-21) || ~((z <= 5.5e+32))) tmp = x * (1.0 - (y / z)); else tmp = x * (y / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -9e-21], N[Not[LessEqual[z, 5.5e+32]], $MachinePrecision]], N[(x * N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(y / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -9 \cdot 10^{-21} \lor \neg \left(z \leq 5.5 \cdot 10^{+32}\right):\\
\;\;\;\;x \cdot \left(1 - \frac{y}{z}\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y}{t}\\
\end{array}
\end{array}
if z < -8.99999999999999936e-21 or 5.49999999999999984e32 < z Initial program 78.4%
associate-*r/99.8%
Simplified99.8%
div-sub99.8%
Applied egg-rr99.8%
Taylor expanded in t around 0 74.3%
mul-1-neg74.3%
unsub-neg74.3%
Simplified74.3%
if -8.99999999999999936e-21 < z < 5.49999999999999984e32Initial program 93.8%
associate-*r/94.6%
Simplified94.6%
Taylor expanded in z around 0 68.4%
Final simplification71.5%
(FPCore (x y z t) :precision binary64 (if (<= z -1.8e-10) (* x (/ z (- z t))) (if (<= z 5e+33) (* x (/ y t)) (* x (- 1.0 (/ y z))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.8e-10) {
tmp = x * (z / (z - t));
} else if (z <= 5e+33) {
tmp = x * (y / t);
} else {
tmp = x * (1.0 - (y / z));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= (-1.8d-10)) then
tmp = x * (z / (z - t))
else if (z <= 5d+33) then
tmp = x * (y / t)
else
tmp = x * (1.0d0 - (y / z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.8e-10) {
tmp = x * (z / (z - t));
} else if (z <= 5e+33) {
tmp = x * (y / t);
} else {
tmp = x * (1.0 - (y / z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.8e-10: tmp = x * (z / (z - t)) elif z <= 5e+33: tmp = x * (y / t) else: tmp = x * (1.0 - (y / z)) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.8e-10) tmp = Float64(x * Float64(z / Float64(z - t))); elseif (z <= 5e+33) tmp = Float64(x * Float64(y / t)); else tmp = Float64(x * Float64(1.0 - Float64(y / z))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -1.8e-10) tmp = x * (z / (z - t)); elseif (z <= 5e+33) tmp = x * (y / t); else tmp = x * (1.0 - (y / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.8e-10], N[(x * N[(z / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 5e+33], N[(x * N[(y / t), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.8 \cdot 10^{-10}:\\
\;\;\;\;x \cdot \frac{z}{z - t}\\
\mathbf{elif}\;z \leq 5 \cdot 10^{+33}:\\
\;\;\;\;x \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - \frac{y}{z}\right)\\
\end{array}
\end{array}
if z < -1.8e-10Initial program 77.5%
associate-*r/99.8%
Simplified99.8%
Taylor expanded in y around 0 80.7%
neg-mul-180.7%
distribute-neg-frac80.7%
Simplified80.7%
frac-2neg80.7%
div-inv80.7%
remove-double-neg80.7%
sub-neg80.7%
distribute-neg-in80.7%
remove-double-neg80.7%
Applied egg-rr80.7%
associate-*r/80.7%
*-rgt-identity80.7%
+-commutative80.7%
unsub-neg80.7%
Simplified80.7%
if -1.8e-10 < z < 4.99999999999999973e33Initial program 94.0%
associate-*r/94.8%
Simplified94.8%
Taylor expanded in z around 0 67.9%
if 4.99999999999999973e33 < z Initial program 78.0%
associate-*r/99.9%
Simplified99.9%
div-sub99.9%
Applied egg-rr99.9%
Taylor expanded in t around 0 79.8%
mul-1-neg79.8%
unsub-neg79.8%
Simplified79.8%
Final simplification74.1%
(FPCore (x y z t) :precision binary64 (if (<= z -5.7e+79) (* x (/ z (- z t))) (if (<= z 2.05e+77) (* x (/ (- y z) t)) (* x (- 1.0 (/ y z))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -5.7e+79) {
tmp = x * (z / (z - t));
} else if (z <= 2.05e+77) {
tmp = x * ((y - z) / t);
} else {
tmp = x * (1.0 - (y / z));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= (-5.7d+79)) then
tmp = x * (z / (z - t))
else if (z <= 2.05d+77) then
tmp = x * ((y - z) / t)
else
tmp = x * (1.0d0 - (y / z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -5.7e+79) {
tmp = x * (z / (z - t));
} else if (z <= 2.05e+77) {
tmp = x * ((y - z) / t);
} else {
tmp = x * (1.0 - (y / z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -5.7e+79: tmp = x * (z / (z - t)) elif z <= 2.05e+77: tmp = x * ((y - z) / t) else: tmp = x * (1.0 - (y / z)) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -5.7e+79) tmp = Float64(x * Float64(z / Float64(z - t))); elseif (z <= 2.05e+77) tmp = Float64(x * Float64(Float64(y - z) / t)); else tmp = Float64(x * Float64(1.0 - Float64(y / z))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -5.7e+79) tmp = x * (z / (z - t)); elseif (z <= 2.05e+77) tmp = x * ((y - z) / t); else tmp = x * (1.0 - (y / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -5.7e+79], N[(x * N[(z / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.05e+77], N[(x * N[(N[(y - z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.7 \cdot 10^{+79}:\\
\;\;\;\;x \cdot \frac{z}{z - t}\\
\mathbf{elif}\;z \leq 2.05 \cdot 10^{+77}:\\
\;\;\;\;x \cdot \frac{y - z}{t}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - \frac{y}{z}\right)\\
\end{array}
\end{array}
if z < -5.6999999999999997e79Initial program 72.7%
associate-*r/99.9%
Simplified99.9%
Taylor expanded in y around 0 91.6%
neg-mul-191.6%
distribute-neg-frac91.6%
Simplified91.6%
frac-2neg91.6%
div-inv91.5%
remove-double-neg91.5%
sub-neg91.5%
distribute-neg-in91.5%
remove-double-neg91.5%
Applied egg-rr91.5%
associate-*r/91.6%
*-rgt-identity91.6%
+-commutative91.6%
unsub-neg91.6%
Simplified91.6%
if -5.6999999999999997e79 < z < 2.05e77Initial program 93.3%
associate-*r/95.7%
Simplified95.7%
Taylor expanded in t around inf 77.1%
if 2.05e77 < z Initial program 75.2%
associate-*r/99.9%
Simplified99.9%
div-sub99.9%
Applied egg-rr99.9%
Taylor expanded in t around 0 83.7%
mul-1-neg83.7%
unsub-neg83.7%
Simplified83.7%
Final simplification81.2%
(FPCore (x y z t) :precision binary64 (if (<= z -1.45e+49) x (if (<= z 4.5e+74) (* x (/ y t)) x)))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.45e+49) {
tmp = x;
} else if (z <= 4.5e+74) {
tmp = x * (y / t);
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= (-1.45d+49)) then
tmp = x
else if (z <= 4.5d+74) then
tmp = x * (y / t)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.45e+49) {
tmp = x;
} else if (z <= 4.5e+74) {
tmp = x * (y / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.45e+49: tmp = x elif z <= 4.5e+74: tmp = x * (y / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.45e+49) tmp = x; elseif (z <= 4.5e+74) tmp = Float64(x * Float64(y / t)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -1.45e+49) tmp = x; elseif (z <= 4.5e+74) tmp = x * (y / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.45e+49], x, If[LessEqual[z, 4.5e+74], N[(x * N[(y / t), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.45 \cdot 10^{+49}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 4.5 \cdot 10^{+74}:\\
\;\;\;\;x \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -1.45e49 or 4.5e74 < z Initial program 75.4%
associate-*r/99.9%
Simplified99.9%
Taylor expanded in z around inf 71.4%
if -1.45e49 < z < 4.5e74Initial program 93.0%
associate-*r/95.5%
Simplified95.5%
Taylor expanded in z around 0 63.6%
Final simplification66.7%
(FPCore (x y z t) :precision binary64 x)
double code(double x, double y, double z, double t) {
return x;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x
end function
public static double code(double x, double y, double z, double t) {
return x;
}
def code(x, y, z, t): return x
function code(x, y, z, t) return x end
function tmp = code(x, y, z, t) tmp = x; end
code[x_, y_, z_, t_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 85.9%
associate-*r/97.3%
Simplified97.3%
Taylor expanded in z around inf 35.0%
Final simplification35.0%
(FPCore (x y z t) :precision binary64 (/ x (/ (- t z) (- y z))))
double code(double x, double y, double z, double t) {
return x / ((t - z) / (y - z));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x / ((t - z) / (y - z))
end function
public static double code(double x, double y, double z, double t) {
return x / ((t - z) / (y - z));
}
def code(x, y, z, t): return x / ((t - z) / (y - z))
function code(x, y, z, t) return Float64(x / Float64(Float64(t - z) / Float64(y - z))) end
function tmp = code(x, y, z, t) tmp = x / ((t - z) / (y - z)); end
code[x_, y_, z_, t_] := N[(x / N[(N[(t - z), $MachinePrecision] / N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{\frac{t - z}{y - z}}
\end{array}
herbie shell --seed 2023320
(FPCore (x y z t)
:name "Graphics.Rendering.Chart.Plot.AreaSpots:renderAreaSpots4D from Chart-1.5.3"
:precision binary64
:herbie-target
(/ x (/ (- t z) (- y z)))
(/ (* x (- y z)) (- t z)))