
(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 9 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 89.4%
associate-*r/97.7%
Simplified97.7%
Final simplification97.7%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (- 1.0 (/ y z)))))
(if (<= z -1.25e+50)
t_1
(if (<= z -1.05e-7)
(* x (/ (- y z) t))
(if (<= z -4.4e-35)
t_1
(if (<= z 75000000.0)
(* x (/ y (- t z)))
(/ (- x) (+ (/ t z) -1.0))))))))
double code(double x, double y, double z, double t) {
double t_1 = x * (1.0 - (y / z));
double tmp;
if (z <= -1.25e+50) {
tmp = t_1;
} else if (z <= -1.05e-7) {
tmp = x * ((y - z) / t);
} else if (z <= -4.4e-35) {
tmp = t_1;
} else if (z <= 75000000.0) {
tmp = x * (y / (t - z));
} else {
tmp = -x / ((t / z) + -1.0);
}
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) :: t_1
real(8) :: tmp
t_1 = x * (1.0d0 - (y / z))
if (z <= (-1.25d+50)) then
tmp = t_1
else if (z <= (-1.05d-7)) then
tmp = x * ((y - z) / t)
else if (z <= (-4.4d-35)) then
tmp = t_1
else if (z <= 75000000.0d0) then
tmp = x * (y / (t - z))
else
tmp = -x / ((t / z) + (-1.0d0))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x * (1.0 - (y / z));
double tmp;
if (z <= -1.25e+50) {
tmp = t_1;
} else if (z <= -1.05e-7) {
tmp = x * ((y - z) / t);
} else if (z <= -4.4e-35) {
tmp = t_1;
} else if (z <= 75000000.0) {
tmp = x * (y / (t - z));
} else {
tmp = -x / ((t / z) + -1.0);
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (1.0 - (y / z)) tmp = 0 if z <= -1.25e+50: tmp = t_1 elif z <= -1.05e-7: tmp = x * ((y - z) / t) elif z <= -4.4e-35: tmp = t_1 elif z <= 75000000.0: tmp = x * (y / (t - z)) else: tmp = -x / ((t / z) + -1.0) return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(1.0 - Float64(y / z))) tmp = 0.0 if (z <= -1.25e+50) tmp = t_1; elseif (z <= -1.05e-7) tmp = Float64(x * Float64(Float64(y - z) / t)); elseif (z <= -4.4e-35) tmp = t_1; elseif (z <= 75000000.0) tmp = Float64(x * Float64(y / Float64(t - z))); else tmp = Float64(Float64(-x) / Float64(Float64(t / z) + -1.0)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (1.0 - (y / z)); tmp = 0.0; if (z <= -1.25e+50) tmp = t_1; elseif (z <= -1.05e-7) tmp = x * ((y - z) / t); elseif (z <= -4.4e-35) tmp = t_1; elseif (z <= 75000000.0) tmp = x * (y / (t - z)); else tmp = -x / ((t / z) + -1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.25e+50], t$95$1, If[LessEqual[z, -1.05e-7], N[(x * N[(N[(y - z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -4.4e-35], t$95$1, If[LessEqual[z, 75000000.0], N[(x * N[(y / N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[((-x) / N[(N[(t / z), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(1 - \frac{y}{z}\right)\\
\mathbf{if}\;z \leq -1.25 \cdot 10^{+50}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -1.05 \cdot 10^{-7}:\\
\;\;\;\;x \cdot \frac{y - z}{t}\\
\mathbf{elif}\;z \leq -4.4 \cdot 10^{-35}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 75000000:\\
\;\;\;\;x \cdot \frac{y}{t - z}\\
\mathbf{else}:\\
\;\;\;\;\frac{-x}{\frac{t}{z} + -1}\\
\end{array}
\end{array}
if z < -1.25e50 or -1.05e-7 < z < -4.39999999999999987e-35Initial program 84.9%
associate-*r/98.7%
Simplified98.7%
Taylor expanded in t around 0 83.8%
mul-1-neg83.8%
div-sub83.8%
sub-neg83.8%
*-inverses83.8%
metadata-eval83.8%
Simplified83.8%
Taylor expanded in x around 0 83.8%
if -1.25e50 < z < -1.05e-7Initial program 85.3%
associate-*r/99.8%
Simplified99.8%
Taylor expanded in t around inf 76.9%
if -4.39999999999999987e-35 < z < 7.5e7Initial program 95.6%
associate-*r/95.8%
Simplified95.8%
Taylor expanded in y around inf 86.1%
if 7.5e7 < z Initial program 82.7%
associate-*r/99.9%
Simplified99.9%
Taylor expanded in y around 0 70.9%
mul-1-neg70.9%
associate-/l*86.4%
distribute-neg-frac86.4%
div-sub86.4%
sub-neg86.4%
*-inverses86.4%
metadata-eval86.4%
Simplified86.4%
Final simplification85.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (- 1.0 (/ y z)))))
(if (<= z -1.7e+49)
t_1
(if (<= z -0.017)
(* x (/ y t))
(if (or (<= z -2.1e-78) (not (<= z 2.05e-83))) t_1 (/ x (/ t y)))))))
double code(double x, double y, double z, double t) {
double t_1 = x * (1.0 - (y / z));
double tmp;
if (z <= -1.7e+49) {
tmp = t_1;
} else if (z <= -0.017) {
tmp = x * (y / t);
} else if ((z <= -2.1e-78) || !(z <= 2.05e-83)) {
tmp = t_1;
} else {
tmp = x / (t / y);
}
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) :: t_1
real(8) :: tmp
t_1 = x * (1.0d0 - (y / z))
if (z <= (-1.7d+49)) then
tmp = t_1
else if (z <= (-0.017d0)) then
tmp = x * (y / t)
else if ((z <= (-2.1d-78)) .or. (.not. (z <= 2.05d-83))) then
tmp = t_1
else
tmp = x / (t / y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x * (1.0 - (y / z));
double tmp;
if (z <= -1.7e+49) {
tmp = t_1;
} else if (z <= -0.017) {
tmp = x * (y / t);
} else if ((z <= -2.1e-78) || !(z <= 2.05e-83)) {
tmp = t_1;
} else {
tmp = x / (t / y);
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (1.0 - (y / z)) tmp = 0 if z <= -1.7e+49: tmp = t_1 elif z <= -0.017: tmp = x * (y / t) elif (z <= -2.1e-78) or not (z <= 2.05e-83): tmp = t_1 else: tmp = x / (t / y) return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(1.0 - Float64(y / z))) tmp = 0.0 if (z <= -1.7e+49) tmp = t_1; elseif (z <= -0.017) tmp = Float64(x * Float64(y / t)); elseif ((z <= -2.1e-78) || !(z <= 2.05e-83)) tmp = t_1; else tmp = Float64(x / Float64(t / y)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (1.0 - (y / z)); tmp = 0.0; if (z <= -1.7e+49) tmp = t_1; elseif (z <= -0.017) tmp = x * (y / t); elseif ((z <= -2.1e-78) || ~((z <= 2.05e-83))) tmp = t_1; else tmp = x / (t / y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.7e+49], t$95$1, If[LessEqual[z, -0.017], N[(x * N[(y / t), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[z, -2.1e-78], N[Not[LessEqual[z, 2.05e-83]], $MachinePrecision]], t$95$1, N[(x / N[(t / y), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(1 - \frac{y}{z}\right)\\
\mathbf{if}\;z \leq -1.7 \cdot 10^{+49}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -0.017:\\
\;\;\;\;x \cdot \frac{y}{t}\\
\mathbf{elif}\;z \leq -2.1 \cdot 10^{-78} \lor \neg \left(z \leq 2.05 \cdot 10^{-83}\right):\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{t}{y}}\\
\end{array}
\end{array}
if z < -1.7e49 or -0.017000000000000001 < z < -2.1000000000000001e-78 or 2.05e-83 < z Initial program 85.6%
associate-*r/99.2%
Simplified99.2%
Taylor expanded in t around 0 79.6%
mul-1-neg79.6%
div-sub79.6%
sub-neg79.6%
*-inverses79.6%
metadata-eval79.6%
Simplified79.6%
Taylor expanded in x around 0 79.6%
if -1.7e49 < z < -0.017000000000000001Initial program 85.3%
associate-*r/99.8%
Simplified99.8%
Taylor expanded in z around 0 59.6%
if -2.1000000000000001e-78 < z < 2.05e-83Initial program 95.7%
associate-*r/95.0%
Simplified95.0%
Taylor expanded in z around 0 72.9%
associate-/l*73.2%
Simplified73.2%
Final simplification76.2%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (- 1.0 (/ y z)))))
(if (<= z -4.3e+54)
t_1
(if (<= z -2.3)
(* x (/ (- y z) t))
(if (or (<= z -2.6e-35) (not (<= z 7000000000000.0)))
t_1
(* x (/ y (- t z))))))))
double code(double x, double y, double z, double t) {
double t_1 = x * (1.0 - (y / z));
double tmp;
if (z <= -4.3e+54) {
tmp = t_1;
} else if (z <= -2.3) {
tmp = x * ((y - z) / t);
} else if ((z <= -2.6e-35) || !(z <= 7000000000000.0)) {
tmp = t_1;
} else {
tmp = x * (y / (t - 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) :: t_1
real(8) :: tmp
t_1 = x * (1.0d0 - (y / z))
if (z <= (-4.3d+54)) then
tmp = t_1
else if (z <= (-2.3d0)) then
tmp = x * ((y - z) / t)
else if ((z <= (-2.6d-35)) .or. (.not. (z <= 7000000000000.0d0))) then
tmp = t_1
else
tmp = x * (y / (t - z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x * (1.0 - (y / z));
double tmp;
if (z <= -4.3e+54) {
tmp = t_1;
} else if (z <= -2.3) {
tmp = x * ((y - z) / t);
} else if ((z <= -2.6e-35) || !(z <= 7000000000000.0)) {
tmp = t_1;
} else {
tmp = x * (y / (t - z));
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (1.0 - (y / z)) tmp = 0 if z <= -4.3e+54: tmp = t_1 elif z <= -2.3: tmp = x * ((y - z) / t) elif (z <= -2.6e-35) or not (z <= 7000000000000.0): tmp = t_1 else: tmp = x * (y / (t - z)) return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(1.0 - Float64(y / z))) tmp = 0.0 if (z <= -4.3e+54) tmp = t_1; elseif (z <= -2.3) tmp = Float64(x * Float64(Float64(y - z) / t)); elseif ((z <= -2.6e-35) || !(z <= 7000000000000.0)) tmp = t_1; else tmp = Float64(x * Float64(y / Float64(t - z))); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (1.0 - (y / z)); tmp = 0.0; if (z <= -4.3e+54) tmp = t_1; elseif (z <= -2.3) tmp = x * ((y - z) / t); elseif ((z <= -2.6e-35) || ~((z <= 7000000000000.0))) tmp = t_1; else tmp = x * (y / (t - z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -4.3e+54], t$95$1, If[LessEqual[z, -2.3], N[(x * N[(N[(y - z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[z, -2.6e-35], N[Not[LessEqual[z, 7000000000000.0]], $MachinePrecision]], t$95$1, N[(x * N[(y / N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(1 - \frac{y}{z}\right)\\
\mathbf{if}\;z \leq -4.3 \cdot 10^{+54}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -2.3:\\
\;\;\;\;x \cdot \frac{y - z}{t}\\
\mathbf{elif}\;z \leq -2.6 \cdot 10^{-35} \lor \neg \left(z \leq 7000000000000\right):\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y}{t - z}\\
\end{array}
\end{array}
if z < -4.29999999999999976e54 or -2.2999999999999998 < z < -2.60000000000000005e-35 or 7e12 < z Initial program 83.9%
associate-*r/99.2%
Simplified99.2%
Taylor expanded in t around 0 83.0%
mul-1-neg83.0%
div-sub83.0%
sub-neg83.0%
*-inverses83.0%
metadata-eval83.0%
Simplified83.0%
Taylor expanded in x around 0 83.0%
if -4.29999999999999976e54 < z < -2.2999999999999998Initial program 85.3%
associate-*r/99.8%
Simplified99.8%
Taylor expanded in t around inf 76.9%
if -2.60000000000000005e-35 < z < 7e12Initial program 95.7%
associate-*r/95.8%
Simplified95.8%
Taylor expanded in y around inf 86.3%
Final simplification84.2%
(FPCore (x y z t)
:precision binary64
(if (<= z -4.3e+49)
x
(if (<= z 2.15e-82)
(* x (/ y t))
(if (<= z 60000000000000.0) (/ (- x) (/ z y)) x))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -4.3e+49) {
tmp = x;
} else if (z <= 2.15e-82) {
tmp = x * (y / t);
} else if (z <= 60000000000000.0) {
tmp = -x / (z / y);
} 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 <= (-4.3d+49)) then
tmp = x
else if (z <= 2.15d-82) then
tmp = x * (y / t)
else if (z <= 60000000000000.0d0) then
tmp = -x / (z / y)
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 <= -4.3e+49) {
tmp = x;
} else if (z <= 2.15e-82) {
tmp = x * (y / t);
} else if (z <= 60000000000000.0) {
tmp = -x / (z / y);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -4.3e+49: tmp = x elif z <= 2.15e-82: tmp = x * (y / t) elif z <= 60000000000000.0: tmp = -x / (z / y) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -4.3e+49) tmp = x; elseif (z <= 2.15e-82) tmp = Float64(x * Float64(y / t)); elseif (z <= 60000000000000.0) tmp = Float64(Float64(-x) / Float64(z / y)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -4.3e+49) tmp = x; elseif (z <= 2.15e-82) tmp = x * (y / t); elseif (z <= 60000000000000.0) tmp = -x / (z / y); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -4.3e+49], x, If[LessEqual[z, 2.15e-82], N[(x * N[(y / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 60000000000000.0], N[((-x) / N[(z / y), $MachinePrecision]), $MachinePrecision], x]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.3 \cdot 10^{+49}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 2.15 \cdot 10^{-82}:\\
\;\;\;\;x \cdot \frac{y}{t}\\
\mathbf{elif}\;z \leq 60000000000000:\\
\;\;\;\;\frac{-x}{\frac{z}{y}}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -4.2999999999999999e49 or 6e13 < z Initial program 82.6%
associate-*r/99.9%
Simplified99.9%
Taylor expanded in z around inf 72.4%
if -4.2999999999999999e49 < z < 2.15000000000000009e-82Initial program 95.2%
associate-*r/95.4%
Simplified95.4%
Taylor expanded in z around 0 65.2%
if 2.15000000000000009e-82 < z < 6e13Initial program 92.9%
associate-*r/99.6%
Simplified99.6%
Taylor expanded in y around inf 83.9%
Taylor expanded in t around 0 61.7%
associate-*r/61.7%
neg-mul-161.7%
Simplified61.7%
distribute-frac-neg61.7%
distribute-rgt-neg-out61.7%
add-sqr-sqrt25.1%
sqrt-unprod19.5%
sqr-neg19.5%
sqrt-unprod1.3%
add-sqr-sqrt9.5%
clear-num9.5%
un-div-inv9.5%
add-sqr-sqrt1.3%
sqrt-unprod19.6%
sqr-neg19.6%
sqrt-unprod25.2%
add-sqr-sqrt61.7%
Applied egg-rr61.7%
Final simplification68.2%
(FPCore (x y z t) :precision binary64 (if (<= z -1.6e+49) x (if (<= z 9.5e-88) (* x (/ y t)) (if (<= z 1e+14) (/ y (/ z (- x))) x))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.6e+49) {
tmp = x;
} else if (z <= 9.5e-88) {
tmp = x * (y / t);
} else if (z <= 1e+14) {
tmp = y / (z / -x);
} 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.6d+49)) then
tmp = x
else if (z <= 9.5d-88) then
tmp = x * (y / t)
else if (z <= 1d+14) then
tmp = y / (z / -x)
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.6e+49) {
tmp = x;
} else if (z <= 9.5e-88) {
tmp = x * (y / t);
} else if (z <= 1e+14) {
tmp = y / (z / -x);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.6e+49: tmp = x elif z <= 9.5e-88: tmp = x * (y / t) elif z <= 1e+14: tmp = y / (z / -x) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.6e+49) tmp = x; elseif (z <= 9.5e-88) tmp = Float64(x * Float64(y / t)); elseif (z <= 1e+14) tmp = Float64(y / Float64(z / Float64(-x))); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -1.6e+49) tmp = x; elseif (z <= 9.5e-88) tmp = x * (y / t); elseif (z <= 1e+14) tmp = y / (z / -x); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.6e+49], x, If[LessEqual[z, 9.5e-88], N[(x * N[(y / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1e+14], N[(y / N[(z / (-x)), $MachinePrecision]), $MachinePrecision], x]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.6 \cdot 10^{+49}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 9.5 \cdot 10^{-88}:\\
\;\;\;\;x \cdot \frac{y}{t}\\
\mathbf{elif}\;z \leq 10^{+14}:\\
\;\;\;\;\frac{y}{\frac{z}{-x}}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -1.60000000000000007e49 or 1e14 < z Initial program 82.6%
associate-*r/99.9%
Simplified99.9%
Taylor expanded in z around inf 72.4%
if -1.60000000000000007e49 < z < 9.5e-88Initial program 95.2%
associate-*r/95.4%
Simplified95.4%
Taylor expanded in z around 0 65.2%
if 9.5e-88 < z < 1e14Initial program 92.9%
associate-*r/99.6%
Simplified99.6%
Taylor expanded in y around inf 83.9%
Taylor expanded in t around 0 61.7%
associate-*r/61.7%
associate-*r*61.7%
neg-mul-161.7%
*-commutative61.7%
associate-/l*61.7%
Simplified61.7%
Final simplification68.2%
(FPCore (x y z t) :precision binary64 (if (or (<= z -2e+49) (not (<= z 1300000000000.0))) (* x (- 1.0 (/ y z))) (* x (/ y (- t z)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -2e+49) || !(z <= 1300000000000.0)) {
tmp = x * (1.0 - (y / z));
} else {
tmp = x * (y / (t - 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 <= (-2d+49)) .or. (.not. (z <= 1300000000000.0d0))) then
tmp = x * (1.0d0 - (y / z))
else
tmp = x * (y / (t - z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -2e+49) || !(z <= 1300000000000.0)) {
tmp = x * (1.0 - (y / z));
} else {
tmp = x * (y / (t - z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -2e+49) or not (z <= 1300000000000.0): tmp = x * (1.0 - (y / z)) else: tmp = x * (y / (t - z)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -2e+49) || !(z <= 1300000000000.0)) tmp = Float64(x * Float64(1.0 - Float64(y / z))); else tmp = Float64(x * Float64(y / Float64(t - z))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -2e+49) || ~((z <= 1300000000000.0))) tmp = x * (1.0 - (y / z)); else tmp = x * (y / (t - z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -2e+49], N[Not[LessEqual[z, 1300000000000.0]], $MachinePrecision]], N[(x * N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(y / N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2 \cdot 10^{+49} \lor \neg \left(z \leq 1300000000000\right):\\
\;\;\;\;x \cdot \left(1 - \frac{y}{z}\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y}{t - z}\\
\end{array}
\end{array}
if z < -1.99999999999999989e49 or 1.3e12 < z Initial program 82.6%
associate-*r/99.9%
Simplified99.9%
Taylor expanded in t around 0 83.9%
mul-1-neg83.9%
div-sub83.9%
sub-neg83.9%
*-inverses83.9%
metadata-eval83.9%
Simplified83.9%
Taylor expanded in x around 0 83.9%
if -1.99999999999999989e49 < z < 1.3e12Initial program 95.0%
associate-*r/95.8%
Simplified95.8%
Taylor expanded in y around inf 80.7%
Final simplification82.1%
(FPCore (x y z t) :precision binary64 (if (<= z -6.6e+52) x (if (<= z 3.7e+14) (* x (/ y t)) x)))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -6.6e+52) {
tmp = x;
} else if (z <= 3.7e+14) {
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 <= (-6.6d+52)) then
tmp = x
else if (z <= 3.7d+14) 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 <= -6.6e+52) {
tmp = x;
} else if (z <= 3.7e+14) {
tmp = x * (y / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -6.6e+52: tmp = x elif z <= 3.7e+14: tmp = x * (y / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -6.6e+52) tmp = x; elseif (z <= 3.7e+14) 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 <= -6.6e+52) tmp = x; elseif (z <= 3.7e+14) tmp = x * (y / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -6.6e+52], x, If[LessEqual[z, 3.7e+14], N[(x * N[(y / t), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.6 \cdot 10^{+52}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 3.7 \cdot 10^{+14}:\\
\;\;\;\;x \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -6.6e52 or 3.7e14 < z Initial program 82.6%
associate-*r/99.9%
Simplified99.9%
Taylor expanded in z around inf 72.4%
if -6.6e52 < z < 3.7e14Initial program 95.0%
associate-*r/95.8%
Simplified95.8%
Taylor expanded in z around 0 61.8%
Final simplification66.6%
(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 89.4%
associate-*r/97.7%
Simplified97.7%
Taylor expanded in z around inf 38.9%
Final simplification38.9%
(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 2023310
(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)))