
(FPCore (x y z t) :precision binary64 (+ x (/ (* y (- z x)) t)))
double code(double x, double y, double z, double t) {
return x + ((y * (z - x)) / t);
}
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 - x)) / t)
end function
public static double code(double x, double y, double z, double t) {
return x + ((y * (z - x)) / t);
}
def code(x, y, z, t): return x + ((y * (z - x)) / t)
function code(x, y, z, t) return Float64(x + Float64(Float64(y * Float64(z - x)) / t)) end
function tmp = code(x, y, z, t) tmp = x + ((y * (z - x)) / t); end
code[x_, y_, z_, t_] := N[(x + N[(N[(y * N[(z - x), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y \cdot \left(z - x\right)}{t}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (+ x (/ (* y (- z x)) t)))
double code(double x, double y, double z, double t) {
return x + ((y * (z - x)) / t);
}
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 - x)) / t)
end function
public static double code(double x, double y, double z, double t) {
return x + ((y * (z - x)) / t);
}
def code(x, y, z, t): return x + ((y * (z - x)) / t)
function code(x, y, z, t) return Float64(x + Float64(Float64(y * Float64(z - x)) / t)) end
function tmp = code(x, y, z, t) tmp = x + ((y * (z - x)) / t); end
code[x_, y_, z_, t_] := N[(x + N[(N[(y * N[(z - x), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y \cdot \left(z - x\right)}{t}
\end{array}
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (+ x (/ (* (- z x) y) t))))
(if (<= t_1 (- INFINITY))
(+ x (/ y (/ t (- z x))))
(if (<= t_1 1e+294) t_1 (+ x (* y (/ (- z x) t)))))))
double code(double x, double y, double z, double t) {
double t_1 = x + (((z - x) * y) / t);
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = x + (y / (t / (z - x)));
} else if (t_1 <= 1e+294) {
tmp = t_1;
} else {
tmp = x + (y * ((z - x) / t));
}
return tmp;
}
public static double code(double x, double y, double z, double t) {
double t_1 = x + (((z - x) * y) / t);
double tmp;
if (t_1 <= -Double.POSITIVE_INFINITY) {
tmp = x + (y / (t / (z - x)));
} else if (t_1 <= 1e+294) {
tmp = t_1;
} else {
tmp = x + (y * ((z - x) / t));
}
return tmp;
}
def code(x, y, z, t): t_1 = x + (((z - x) * y) / t) tmp = 0 if t_1 <= -math.inf: tmp = x + (y / (t / (z - x))) elif t_1 <= 1e+294: tmp = t_1 else: tmp = x + (y * ((z - x) / t)) return tmp
function code(x, y, z, t) t_1 = Float64(x + Float64(Float64(Float64(z - x) * y) / t)) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(x + Float64(y / Float64(t / Float64(z - x)))); elseif (t_1 <= 1e+294) tmp = t_1; else tmp = Float64(x + Float64(y * Float64(Float64(z - x) / t))); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x + (((z - x) * y) / t); tmp = 0.0; if (t_1 <= -Inf) tmp = x + (y / (t / (z - x))); elseif (t_1 <= 1e+294) tmp = t_1; else tmp = x + (y * ((z - x) / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x + N[(N[(N[(z - x), $MachinePrecision] * y), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(x + N[(y / N[(t / N[(z - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e+294], t$95$1, N[(x + N[(y * N[(N[(z - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \frac{\left(z - x\right) \cdot y}{t}\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;x + \frac{y}{\frac{t}{z - x}}\\
\mathbf{elif}\;t\_1 \leq 10^{+294}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{z - x}{t}\\
\end{array}
\end{array}
if (+.f64 x (/.f64 (*.f64 y (-.f64 z x)) t)) < -inf.0Initial program 78.4%
associate-/l*N/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
--lowering--.f64100.0%
Applied egg-rr100.0%
if -inf.0 < (+.f64 x (/.f64 (*.f64 y (-.f64 z x)) t)) < 1.00000000000000007e294Initial program 98.7%
if 1.00000000000000007e294 < (+.f64 x (/.f64 (*.f64 y (-.f64 z x)) t)) Initial program 80.9%
associate-/l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
--lowering--.f64100.0%
Applied egg-rr100.0%
Final simplification99.1%
(FPCore (x y z t) :precision binary64 (if (<= y -2.35e-92) (+ x (* y (/ (- z x) t))) (if (<= y 2.3e-135) (+ x (* z (/ y t))) (+ x (/ y (/ t (- z x)))))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -2.35e-92) {
tmp = x + (y * ((z - x) / t));
} else if (y <= 2.3e-135) {
tmp = x + (z * (y / t));
} else {
tmp = x + (y / (t / (z - 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 (y <= (-2.35d-92)) then
tmp = x + (y * ((z - x) / t))
else if (y <= 2.3d-135) then
tmp = x + (z * (y / t))
else
tmp = x + (y / (t / (z - x)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -2.35e-92) {
tmp = x + (y * ((z - x) / t));
} else if (y <= 2.3e-135) {
tmp = x + (z * (y / t));
} else {
tmp = x + (y / (t / (z - x)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -2.35e-92: tmp = x + (y * ((z - x) / t)) elif y <= 2.3e-135: tmp = x + (z * (y / t)) else: tmp = x + (y / (t / (z - x))) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -2.35e-92) tmp = Float64(x + Float64(y * Float64(Float64(z - x) / t))); elseif (y <= 2.3e-135) tmp = Float64(x + Float64(z * Float64(y / t))); else tmp = Float64(x + Float64(y / Float64(t / Float64(z - x)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -2.35e-92) tmp = x + (y * ((z - x) / t)); elseif (y <= 2.3e-135) tmp = x + (z * (y / t)); else tmp = x + (y / (t / (z - x))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -2.35e-92], N[(x + N[(y * N[(N[(z - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.3e-135], N[(x + N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y / N[(t / N[(z - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.35 \cdot 10^{-92}:\\
\;\;\;\;x + y \cdot \frac{z - x}{t}\\
\mathbf{elif}\;y \leq 2.3 \cdot 10^{-135}:\\
\;\;\;\;x + z \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{\frac{t}{z - x}}\\
\end{array}
\end{array}
if y < -2.34999999999999996e-92Initial program 91.2%
associate-/l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
--lowering--.f6499.4%
Applied egg-rr99.4%
if -2.34999999999999996e-92 < y < 2.2999999999999999e-135Initial program 98.8%
+-commutativeN/A
+-lowering-+.f64N/A
*-commutativeN/A
associate-/l*N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
/-lowering-/.f64100.0%
Applied egg-rr100.0%
Taylor expanded in z around inf
Simplified96.4%
if 2.2999999999999999e-135 < y Initial program 86.9%
associate-/l*N/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
--lowering--.f6498.9%
Applied egg-rr98.9%
Final simplification98.2%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (+ x (* y (/ (- z x) t))))) (if (<= y -9.5e-93) t_1 (if (<= y 2e-155) (+ x (* z (/ y t))) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = x + (y * ((z - x) / t));
double tmp;
if (y <= -9.5e-93) {
tmp = t_1;
} else if (y <= 2e-155) {
tmp = x + (z * (y / t));
} else {
tmp = t_1;
}
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 + (y * ((z - x) / t))
if (y <= (-9.5d-93)) then
tmp = t_1
else if (y <= 2d-155) then
tmp = x + (z * (y / t))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x + (y * ((z - x) / t));
double tmp;
if (y <= -9.5e-93) {
tmp = t_1;
} else if (y <= 2e-155) {
tmp = x + (z * (y / t));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x + (y * ((z - x) / t)) tmp = 0 if y <= -9.5e-93: tmp = t_1 elif y <= 2e-155: tmp = x + (z * (y / t)) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x + Float64(y * Float64(Float64(z - x) / t))) tmp = 0.0 if (y <= -9.5e-93) tmp = t_1; elseif (y <= 2e-155) tmp = Float64(x + Float64(z * Float64(y / t))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x + (y * ((z - x) / t)); tmp = 0.0; if (y <= -9.5e-93) tmp = t_1; elseif (y <= 2e-155) tmp = x + (z * (y / t)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x + N[(y * N[(N[(z - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -9.5e-93], t$95$1, If[LessEqual[y, 2e-155], N[(x + N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + y \cdot \frac{z - x}{t}\\
\mathbf{if}\;y \leq -9.5 \cdot 10^{-93}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 2 \cdot 10^{-155}:\\
\;\;\;\;x + z \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -9.5000000000000001e-93 or 2.00000000000000003e-155 < y Initial program 89.0%
associate-/l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
--lowering--.f6499.1%
Applied egg-rr99.1%
if -9.5000000000000001e-93 < y < 2.00000000000000003e-155Initial program 98.7%
+-commutativeN/A
+-lowering-+.f64N/A
*-commutativeN/A
associate-/l*N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
/-lowering-/.f64100.0%
Applied egg-rr100.0%
Taylor expanded in z around inf
Simplified96.2%
Final simplification98.2%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* x (- 1.0 (/ y t))))) (if (<= x -5.2e+220) t_1 (if (<= x 6.5e+103) (+ x (* z (/ y t))) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = x * (1.0 - (y / t));
double tmp;
if (x <= -5.2e+220) {
tmp = t_1;
} else if (x <= 6.5e+103) {
tmp = x + (z * (y / t));
} else {
tmp = t_1;
}
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 / t))
if (x <= (-5.2d+220)) then
tmp = t_1
else if (x <= 6.5d+103) then
tmp = x + (z * (y / t))
else
tmp = t_1
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 / t));
double tmp;
if (x <= -5.2e+220) {
tmp = t_1;
} else if (x <= 6.5e+103) {
tmp = x + (z * (y / t));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (1.0 - (y / t)) tmp = 0 if x <= -5.2e+220: tmp = t_1 elif x <= 6.5e+103: tmp = x + (z * (y / t)) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(1.0 - Float64(y / t))) tmp = 0.0 if (x <= -5.2e+220) tmp = t_1; elseif (x <= 6.5e+103) tmp = Float64(x + Float64(z * Float64(y / t))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (1.0 - (y / t)); tmp = 0.0; if (x <= -5.2e+220) tmp = t_1; elseif (x <= 6.5e+103) tmp = x + (z * (y / t)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -5.2e+220], t$95$1, If[LessEqual[x, 6.5e+103], N[(x + N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(1 - \frac{y}{t}\right)\\
\mathbf{if}\;x \leq -5.2 \cdot 10^{+220}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 6.5 \cdot 10^{+103}:\\
\;\;\;\;x + z \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -5.19999999999999988e220 or 6.50000000000000001e103 < x Initial program 87.6%
Taylor expanded in x around inf
*-lowering-*.f64N/A
mul-1-negN/A
unsub-negN/A
--lowering--.f64N/A
/-lowering-/.f64100.0%
Simplified100.0%
if -5.19999999999999988e220 < x < 6.50000000000000001e103Initial program 93.6%
+-commutativeN/A
+-lowering-+.f64N/A
*-commutativeN/A
associate-/l*N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
/-lowering-/.f6498.7%
Applied egg-rr98.7%
Taylor expanded in z around inf
Simplified91.0%
Final simplification93.1%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* y (/ (- z x) t)))) (if (<= y -0.0033) t_1 (if (<= y 2.5e+53) (+ x (/ (* z y) t)) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = y * ((z - x) / t);
double tmp;
if (y <= -0.0033) {
tmp = t_1;
} else if (y <= 2.5e+53) {
tmp = x + ((z * y) / t);
} else {
tmp = t_1;
}
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 = y * ((z - x) / t)
if (y <= (-0.0033d0)) then
tmp = t_1
else if (y <= 2.5d+53) then
tmp = x + ((z * y) / t)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = y * ((z - x) / t);
double tmp;
if (y <= -0.0033) {
tmp = t_1;
} else if (y <= 2.5e+53) {
tmp = x + ((z * y) / t);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = y * ((z - x) / t) tmp = 0 if y <= -0.0033: tmp = t_1 elif y <= 2.5e+53: tmp = x + ((z * y) / t) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(y * Float64(Float64(z - x) / t)) tmp = 0.0 if (y <= -0.0033) tmp = t_1; elseif (y <= 2.5e+53) tmp = Float64(x + Float64(Float64(z * y) / t)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = y * ((z - x) / t); tmp = 0.0; if (y <= -0.0033) tmp = t_1; elseif (y <= 2.5e+53) tmp = x + ((z * y) / t); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * N[(N[(z - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -0.0033], t$95$1, If[LessEqual[y, 2.5e+53], N[(x + N[(N[(z * y), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \frac{z - x}{t}\\
\mathbf{if}\;y \leq -0.0033:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 2.5 \cdot 10^{+53}:\\
\;\;\;\;x + \frac{z \cdot y}{t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -0.0033 or 2.5000000000000002e53 < y Initial program 84.8%
Taylor expanded in y around inf
div-subN/A
associate-/l*N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
--lowering--.f6477.9%
Simplified77.9%
associate-/l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
--lowering--.f6486.9%
Applied egg-rr86.9%
if -0.0033 < y < 2.5000000000000002e53Initial program 97.9%
Taylor expanded in z around inf
/-lowering-/.f64N/A
*-lowering-*.f6493.7%
Simplified93.7%
Final simplification90.7%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* y (/ (- z x) t)))) (if (<= z -3.2e+117) t_1 (if (<= z 4.2e+74) (* x (- 1.0 (/ y t))) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = y * ((z - x) / t);
double tmp;
if (z <= -3.2e+117) {
tmp = t_1;
} else if (z <= 4.2e+74) {
tmp = x * (1.0 - (y / t));
} else {
tmp = t_1;
}
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 = y * ((z - x) / t)
if (z <= (-3.2d+117)) then
tmp = t_1
else if (z <= 4.2d+74) then
tmp = x * (1.0d0 - (y / t))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = y * ((z - x) / t);
double tmp;
if (z <= -3.2e+117) {
tmp = t_1;
} else if (z <= 4.2e+74) {
tmp = x * (1.0 - (y / t));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = y * ((z - x) / t) tmp = 0 if z <= -3.2e+117: tmp = t_1 elif z <= 4.2e+74: tmp = x * (1.0 - (y / t)) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(y * Float64(Float64(z - x) / t)) tmp = 0.0 if (z <= -3.2e+117) tmp = t_1; elseif (z <= 4.2e+74) tmp = Float64(x * Float64(1.0 - Float64(y / t))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = y * ((z - x) / t); tmp = 0.0; if (z <= -3.2e+117) tmp = t_1; elseif (z <= 4.2e+74) tmp = x * (1.0 - (y / t)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * N[(N[(z - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -3.2e+117], t$95$1, If[LessEqual[z, 4.2e+74], N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \frac{z - x}{t}\\
\mathbf{if}\;z \leq -3.2 \cdot 10^{+117}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 4.2 \cdot 10^{+74}:\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -3.20000000000000005e117 or 4.1999999999999998e74 < z Initial program 86.3%
Taylor expanded in y around inf
div-subN/A
associate-/l*N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
--lowering--.f6468.5%
Simplified68.5%
associate-/l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
--lowering--.f6475.5%
Applied egg-rr75.5%
if -3.20000000000000005e117 < z < 4.1999999999999998e74Initial program 95.7%
Taylor expanded in x around inf
*-lowering-*.f64N/A
mul-1-negN/A
unsub-negN/A
--lowering--.f64N/A
/-lowering-/.f6482.6%
Simplified82.6%
Final simplification79.9%
(FPCore (x y z t) :precision binary64 (if (<= z -3.85e+117) (* z (/ y t)) (if (<= z 4.6e+91) (* x (- 1.0 (/ y t))) (/ z (/ t y)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -3.85e+117) {
tmp = z * (y / t);
} else if (z <= 4.6e+91) {
tmp = x * (1.0 - (y / t));
} else {
tmp = z / (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) :: tmp
if (z <= (-3.85d+117)) then
tmp = z * (y / t)
else if (z <= 4.6d+91) then
tmp = x * (1.0d0 - (y / t))
else
tmp = z / (t / y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -3.85e+117) {
tmp = z * (y / t);
} else if (z <= 4.6e+91) {
tmp = x * (1.0 - (y / t));
} else {
tmp = z / (t / y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -3.85e+117: tmp = z * (y / t) elif z <= 4.6e+91: tmp = x * (1.0 - (y / t)) else: tmp = z / (t / y) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -3.85e+117) tmp = Float64(z * Float64(y / t)); elseif (z <= 4.6e+91) tmp = Float64(x * Float64(1.0 - Float64(y / t))); else tmp = Float64(z / Float64(t / y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -3.85e+117) tmp = z * (y / t); elseif (z <= 4.6e+91) tmp = x * (1.0 - (y / t)); else tmp = z / (t / y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -3.85e+117], N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 4.6e+91], N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(z / N[(t / y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.85 \cdot 10^{+117}:\\
\;\;\;\;z \cdot \frac{y}{t}\\
\mathbf{elif}\;z \leq 4.6 \cdot 10^{+91}:\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{z}{\frac{t}{y}}\\
\end{array}
\end{array}
if z < -3.84999999999999975e117Initial program 88.7%
Taylor expanded in x around 0
/-lowering-/.f64N/A
*-lowering-*.f6460.8%
Simplified60.8%
associate-*l/N/A
*-lowering-*.f64N/A
/-lowering-/.f6471.0%
Applied egg-rr71.0%
if -3.84999999999999975e117 < z < 4.59999999999999982e91Initial program 94.7%
Taylor expanded in x around inf
*-lowering-*.f64N/A
mul-1-negN/A
unsub-negN/A
--lowering--.f64N/A
/-lowering-/.f6481.8%
Simplified81.8%
if 4.59999999999999982e91 < z Initial program 86.9%
Taylor expanded in x around 0
/-lowering-/.f64N/A
*-lowering-*.f6463.8%
Simplified63.8%
associate-/l*N/A
*-commutativeN/A
associate-/r/N/A
/-lowering-/.f64N/A
/-lowering-/.f6473.0%
Applied egg-rr73.0%
Final simplification78.3%
(FPCore (x y z t) :precision binary64 (if (<= t -1.7e+51) x (if (<= t 1.15e+90) (* z (/ y t)) x)))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1.7e+51) {
tmp = x;
} else if (t <= 1.15e+90) {
tmp = z * (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 (t <= (-1.7d+51)) then
tmp = x
else if (t <= 1.15d+90) then
tmp = z * (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 (t <= -1.7e+51) {
tmp = x;
} else if (t <= 1.15e+90) {
tmp = z * (y / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -1.7e+51: tmp = x elif t <= 1.15e+90: tmp = z * (y / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -1.7e+51) tmp = x; elseif (t <= 1.15e+90) tmp = Float64(z * Float64(y / t)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -1.7e+51) tmp = x; elseif (t <= 1.15e+90) tmp = z * (y / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -1.7e+51], x, If[LessEqual[t, 1.15e+90], N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.7 \cdot 10^{+51}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq 1.15 \cdot 10^{+90}:\\
\;\;\;\;z \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if t < -1.69999999999999992e51 or 1.15e90 < t Initial program 81.4%
Taylor expanded in y around 0
Simplified75.5%
if -1.69999999999999992e51 < t < 1.15e90Initial program 98.6%
Taylor expanded in x around 0
/-lowering-/.f64N/A
*-lowering-*.f6456.5%
Simplified56.5%
associate-*l/N/A
*-lowering-*.f64N/A
/-lowering-/.f6459.6%
Applied egg-rr59.6%
Final simplification65.5%
(FPCore (x y z t) :precision binary64 (+ x (* (- z x) (/ y t))))
double code(double x, double y, double z, double t) {
return x + ((z - x) * (y / t));
}
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 + ((z - x) * (y / t))
end function
public static double code(double x, double y, double z, double t) {
return x + ((z - x) * (y / t));
}
def code(x, y, z, t): return x + ((z - x) * (y / t))
function code(x, y, z, t) return Float64(x + Float64(Float64(z - x) * Float64(y / t))) end
function tmp = code(x, y, z, t) tmp = x + ((z - x) * (y / t)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(z - x), $MachinePrecision] * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(z - x\right) \cdot \frac{y}{t}
\end{array}
Initial program 92.2%
+-commutativeN/A
+-lowering-+.f64N/A
*-commutativeN/A
associate-/l*N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
/-lowering-/.f6499.0%
Applied egg-rr99.0%
Final simplification99.0%
(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 92.2%
Taylor expanded in y around 0
Simplified42.2%
(FPCore (x y z t) :precision binary64 (- x (+ (* x (/ y t)) (* (- z) (/ y t)))))
double code(double x, double y, double z, double t) {
return x - ((x * (y / t)) + (-z * (y / t)));
}
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 - ((x * (y / t)) + (-z * (y / t)))
end function
public static double code(double x, double y, double z, double t) {
return x - ((x * (y / t)) + (-z * (y / t)));
}
def code(x, y, z, t): return x - ((x * (y / t)) + (-z * (y / t)))
function code(x, y, z, t) return Float64(x - Float64(Float64(x * Float64(y / t)) + Float64(Float64(-z) * Float64(y / t)))) end
function tmp = code(x, y, z, t) tmp = x - ((x * (y / t)) + (-z * (y / t))); end
code[x_, y_, z_, t_] := N[(x - N[(N[(x * N[(y / t), $MachinePrecision]), $MachinePrecision] + N[((-z) * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - \left(x \cdot \frac{y}{t} + \left(-z\right) \cdot \frac{y}{t}\right)
\end{array}
herbie shell --seed 2024161
(FPCore (x y z t)
:name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, D"
:precision binary64
:alt
(! :herbie-platform default (- x (+ (* x (/ y t)) (* (- z) (/ y t)))))
(+ x (/ (* y (- z x)) t)))