
(FPCore (x y z t) :precision binary64 (+ x (/ (* (- y x) z) t)))
double code(double x, double y, double z, double t) {
return x + (((y - x) * z) / 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 - x) * z) / t)
end function
public static double code(double x, double y, double z, double t) {
return x + (((y - x) * z) / t);
}
def code(x, y, z, t): return x + (((y - x) * z) / t)
function code(x, y, z, t) return Float64(x + Float64(Float64(Float64(y - x) * z) / t)) end
function tmp = code(x, y, z, t) tmp = x + (((y - x) * z) / t); end
code[x_, y_, z_, t_] := N[(x + N[(N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{\left(y - x\right) \cdot z}{t}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (+ x (/ (* (- y x) z) t)))
double code(double x, double y, double z, double t) {
return x + (((y - x) * z) / 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 - x) * z) / t)
end function
public static double code(double x, double y, double z, double t) {
return x + (((y - x) * z) / t);
}
def code(x, y, z, t): return x + (((y - x) * z) / t)
function code(x, y, z, t) return Float64(x + Float64(Float64(Float64(y - x) * z) / t)) end
function tmp = code(x, y, z, t) tmp = x + (((y - x) * z) / t); end
code[x_, y_, z_, t_] := N[(x + N[(N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{\left(y - x\right) \cdot z}{t}
\end{array}
(FPCore (x y z t) :precision binary64 (+ x (/ (- y x) (/ t z))))
double code(double x, double y, double z, double t) {
return x + ((y - x) / (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 - x) / (t / z))
end function
public static double code(double x, double y, double z, double t) {
return x + ((y - x) / (t / z));
}
def code(x, y, z, t): return x + ((y - x) / (t / z))
function code(x, y, z, t) return Float64(x + Float64(Float64(y - x) / Float64(t / z))) end
function tmp = code(x, y, z, t) tmp = x + ((y - x) / (t / z)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(y - x), $MachinePrecision] / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y - x}{\frac{t}{z}}
\end{array}
Initial program 90.2%
+-commutativeN/A
+-lowering-+.f64N/A
associate-/l*N/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
--lowering--.f64N/A
/-lowering-/.f6497.7%
Applied egg-rr97.7%
Final simplification97.7%
(FPCore (x y z t) :precision binary64 (if (<= y -7.5e-55) (+ x (/ y (/ t z))) (if (<= y 6.3e-21) (* x (- 1.0 (/ z t))) (+ x (* y (/ z t))))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -7.5e-55) {
tmp = x + (y / (t / z));
} else if (y <= 6.3e-21) {
tmp = x * (1.0 - (z / t));
} else {
tmp = x + (y * (z / 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 (y <= (-7.5d-55)) then
tmp = x + (y / (t / z))
else if (y <= 6.3d-21) then
tmp = x * (1.0d0 - (z / t))
else
tmp = x + (y * (z / t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -7.5e-55) {
tmp = x + (y / (t / z));
} else if (y <= 6.3e-21) {
tmp = x * (1.0 - (z / t));
} else {
tmp = x + (y * (z / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -7.5e-55: tmp = x + (y / (t / z)) elif y <= 6.3e-21: tmp = x * (1.0 - (z / t)) else: tmp = x + (y * (z / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -7.5e-55) tmp = Float64(x + Float64(y / Float64(t / z))); elseif (y <= 6.3e-21) tmp = Float64(x * Float64(1.0 - Float64(z / t))); else tmp = Float64(x + Float64(y * Float64(z / t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -7.5e-55) tmp = x + (y / (t / z)); elseif (y <= 6.3e-21) tmp = x * (1.0 - (z / t)); else tmp = x + (y * (z / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -7.5e-55], N[(x + N[(y / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 6.3e-21], N[(x * N[(1.0 - N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7.5 \cdot 10^{-55}:\\
\;\;\;\;x + \frac{y}{\frac{t}{z}}\\
\mathbf{elif}\;y \leq 6.3 \cdot 10^{-21}:\\
\;\;\;\;x \cdot \left(1 - \frac{z}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\end{array}
\end{array}
if y < -7.50000000000000023e-55Initial program 86.9%
Taylor expanded in y around inf
/-lowering-/.f64N/A
*-lowering-*.f6484.0%
Simplified84.0%
+-commutativeN/A
+-lowering-+.f64N/A
associate-/l*N/A
clear-numN/A
div-invN/A
/-lowering-/.f64N/A
/-lowering-/.f6490.7%
Applied egg-rr90.7%
if -7.50000000000000023e-55 < y < 6.3e-21Initial program 91.7%
Taylor expanded in x around inf
*-lowering-*.f64N/A
mul-1-negN/A
unsub-negN/A
--lowering--.f64N/A
/-lowering-/.f6489.0%
Simplified89.0%
if 6.3e-21 < y Initial program 92.3%
Taylor expanded in y around inf
/-lowering-/.f64N/A
*-lowering-*.f6481.9%
Simplified81.9%
associate-/l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
/-lowering-/.f6483.9%
Applied egg-rr83.9%
Final simplification88.3%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (+ x (* y (/ z t))))) (if (<= y -2.3e-54) t_1 (if (<= y 1.02e-25) (* x (- 1.0 (/ z t))) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = x + (y * (z / t));
double tmp;
if (y <= -2.3e-54) {
tmp = t_1;
} else if (y <= 1.02e-25) {
tmp = x * (1.0 - (z / 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 / t))
if (y <= (-2.3d-54)) then
tmp = t_1
else if (y <= 1.02d-25) then
tmp = x * (1.0d0 - (z / 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 / t));
double tmp;
if (y <= -2.3e-54) {
tmp = t_1;
} else if (y <= 1.02e-25) {
tmp = x * (1.0 - (z / t));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x + (y * (z / t)) tmp = 0 if y <= -2.3e-54: tmp = t_1 elif y <= 1.02e-25: tmp = x * (1.0 - (z / t)) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x + Float64(y * Float64(z / t))) tmp = 0.0 if (y <= -2.3e-54) tmp = t_1; elseif (y <= 1.02e-25) tmp = Float64(x * Float64(1.0 - Float64(z / t))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x + (y * (z / t)); tmp = 0.0; if (y <= -2.3e-54) tmp = t_1; elseif (y <= 1.02e-25) tmp = x * (1.0 - (z / t)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x + N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -2.3e-54], t$95$1, If[LessEqual[y, 1.02e-25], N[(x * N[(1.0 - N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + y \cdot \frac{z}{t}\\
\mathbf{if}\;y \leq -2.3 \cdot 10^{-54}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 1.02 \cdot 10^{-25}:\\
\;\;\;\;x \cdot \left(1 - \frac{z}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -2.2999999999999999e-54 or 1.01999999999999998e-25 < y Initial program 89.2%
Taylor expanded in y around inf
/-lowering-/.f64N/A
*-lowering-*.f6483.1%
Simplified83.1%
associate-/l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
/-lowering-/.f6487.8%
Applied egg-rr87.8%
if -2.2999999999999999e-54 < y < 1.01999999999999998e-25Initial program 91.7%
Taylor expanded in x around inf
*-lowering-*.f64N/A
mul-1-negN/A
unsub-negN/A
--lowering--.f64N/A
/-lowering-/.f6489.0%
Simplified89.0%
Final simplification88.3%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* x (- 1.0 (/ z t))))) (if (<= x -1.1e-27) t_1 (if (<= x 8.5e-34) (* z (/ (- y x) t)) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = x * (1.0 - (z / t));
double tmp;
if (x <= -1.1e-27) {
tmp = t_1;
} else if (x <= 8.5e-34) {
tmp = z * ((y - x) / 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 - (z / t))
if (x <= (-1.1d-27)) then
tmp = t_1
else if (x <= 8.5d-34) then
tmp = z * ((y - x) / 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 - (z / t));
double tmp;
if (x <= -1.1e-27) {
tmp = t_1;
} else if (x <= 8.5e-34) {
tmp = z * ((y - x) / t);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (1.0 - (z / t)) tmp = 0 if x <= -1.1e-27: tmp = t_1 elif x <= 8.5e-34: tmp = z * ((y - x) / t) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(1.0 - Float64(z / t))) tmp = 0.0 if (x <= -1.1e-27) tmp = t_1; elseif (x <= 8.5e-34) tmp = Float64(z * Float64(Float64(y - x) / t)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (1.0 - (z / t)); tmp = 0.0; if (x <= -1.1e-27) tmp = t_1; elseif (x <= 8.5e-34) tmp = z * ((y - x) / 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[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.1e-27], t$95$1, If[LessEqual[x, 8.5e-34], N[(z * N[(N[(y - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(1 - \frac{z}{t}\right)\\
\mathbf{if}\;x \leq -1.1 \cdot 10^{-27}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 8.5 \cdot 10^{-34}:\\
\;\;\;\;z \cdot \frac{y - x}{t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -1.09999999999999993e-27 or 8.5000000000000001e-34 < x Initial program 87.4%
Taylor expanded in x around inf
*-lowering-*.f64N/A
mul-1-negN/A
unsub-negN/A
--lowering--.f64N/A
/-lowering-/.f6485.8%
Simplified85.8%
if -1.09999999999999993e-27 < x < 8.5000000000000001e-34Initial program 93.9%
Taylor expanded in z around inf
div-subN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
--lowering--.f6472.8%
Simplified72.8%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* x (- 1.0 (/ z t))))) (if (<= x -4.5e-104) t_1 (if (<= x 1.82e-62) (* y (/ z t)) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = x * (1.0 - (z / t));
double tmp;
if (x <= -4.5e-104) {
tmp = t_1;
} else if (x <= 1.82e-62) {
tmp = y * (z / 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 - (z / t))
if (x <= (-4.5d-104)) then
tmp = t_1
else if (x <= 1.82d-62) then
tmp = y * (z / 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 - (z / t));
double tmp;
if (x <= -4.5e-104) {
tmp = t_1;
} else if (x <= 1.82e-62) {
tmp = y * (z / t);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (1.0 - (z / t)) tmp = 0 if x <= -4.5e-104: tmp = t_1 elif x <= 1.82e-62: tmp = y * (z / t) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(1.0 - Float64(z / t))) tmp = 0.0 if (x <= -4.5e-104) tmp = t_1; elseif (x <= 1.82e-62) tmp = Float64(y * Float64(z / t)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (1.0 - (z / t)); tmp = 0.0; if (x <= -4.5e-104) tmp = t_1; elseif (x <= 1.82e-62) tmp = y * (z / 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[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -4.5e-104], t$95$1, If[LessEqual[x, 1.82e-62], N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(1 - \frac{z}{t}\right)\\
\mathbf{if}\;x \leq -4.5 \cdot 10^{-104}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 1.82 \cdot 10^{-62}:\\
\;\;\;\;y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -4.4999999999999997e-104 or 1.81999999999999999e-62 < x Initial program 87.9%
Taylor expanded in x around inf
*-lowering-*.f64N/A
mul-1-negN/A
unsub-negN/A
--lowering--.f64N/A
/-lowering-/.f6481.0%
Simplified81.0%
if -4.4999999999999997e-104 < x < 1.81999999999999999e-62Initial program 94.6%
+-commutativeN/A
+-lowering-+.f64N/A
associate-/l*N/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
--lowering--.f64N/A
/-lowering-/.f6494.3%
Applied egg-rr94.3%
Taylor expanded in y around inf
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f6463.9%
Simplified63.9%
associate-*l/N/A
*-lowering-*.f64N/A
/-lowering-/.f6466.4%
Applied egg-rr66.4%
Final simplification75.9%
(FPCore (x y z t) :precision binary64 (if (<= t -1.8e-32) x (if (<= t 5e-73) (/ y (/ t z)) x)))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1.8e-32) {
tmp = x;
} else if (t <= 5e-73) {
tmp = y / (t / z);
} 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.8d-32)) then
tmp = x
else if (t <= 5d-73) then
tmp = y / (t / z)
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.8e-32) {
tmp = x;
} else if (t <= 5e-73) {
tmp = y / (t / z);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -1.8e-32: tmp = x elif t <= 5e-73: tmp = y / (t / z) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -1.8e-32) tmp = x; elseif (t <= 5e-73) tmp = Float64(y / Float64(t / z)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -1.8e-32) tmp = x; elseif (t <= 5e-73) tmp = y / (t / z); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -1.8e-32], x, If[LessEqual[t, 5e-73], N[(y / N[(t / z), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.8 \cdot 10^{-32}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq 5 \cdot 10^{-73}:\\
\;\;\;\;\frac{y}{\frac{t}{z}}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if t < -1.79999999999999996e-32 or 4.9999999999999998e-73 < t Initial program 84.7%
Taylor expanded in z around 0
Simplified58.2%
if -1.79999999999999996e-32 < t < 4.9999999999999998e-73Initial program 98.8%
+-commutativeN/A
+-lowering-+.f64N/A
associate-/l*N/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
--lowering--.f64N/A
/-lowering-/.f6496.5%
Applied egg-rr96.5%
Taylor expanded in y around inf
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f6457.3%
Simplified57.3%
*-commutativeN/A
associate-*l/N/A
associate-/r/N/A
/-lowering-/.f64N/A
/-lowering-/.f6458.7%
Applied egg-rr58.7%
(FPCore (x y z t) :precision binary64 (if (<= t -1.8e-32) x (if (<= t 4e-73) (* y (/ z t)) x)))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1.8e-32) {
tmp = x;
} else if (t <= 4e-73) {
tmp = y * (z / 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.8d-32)) then
tmp = x
else if (t <= 4d-73) then
tmp = y * (z / 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.8e-32) {
tmp = x;
} else if (t <= 4e-73) {
tmp = y * (z / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -1.8e-32: tmp = x elif t <= 4e-73: tmp = y * (z / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -1.8e-32) tmp = x; elseif (t <= 4e-73) tmp = Float64(y * Float64(z / t)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -1.8e-32) tmp = x; elseif (t <= 4e-73) tmp = y * (z / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -1.8e-32], x, If[LessEqual[t, 4e-73], N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.8 \cdot 10^{-32}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq 4 \cdot 10^{-73}:\\
\;\;\;\;y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if t < -1.79999999999999996e-32 or 3.99999999999999999e-73 < t Initial program 84.7%
Taylor expanded in z around 0
Simplified58.2%
if -1.79999999999999996e-32 < t < 3.99999999999999999e-73Initial program 98.8%
+-commutativeN/A
+-lowering-+.f64N/A
associate-/l*N/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
--lowering--.f64N/A
/-lowering-/.f6496.5%
Applied egg-rr96.5%
Taylor expanded in y around inf
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f6457.3%
Simplified57.3%
associate-*l/N/A
*-lowering-*.f64N/A
/-lowering-/.f6458.7%
Applied egg-rr58.7%
Final simplification58.4%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* z (/ y t)))) (if (<= z -2.05e-72) t_1 (if (<= z 6.6e+25) x t_1))))
double code(double x, double y, double z, double t) {
double t_1 = z * (y / t);
double tmp;
if (z <= -2.05e-72) {
tmp = t_1;
} else if (z <= 6.6e+25) {
tmp = x;
} 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 = z * (y / t)
if (z <= (-2.05d-72)) then
tmp = t_1
else if (z <= 6.6d+25) then
tmp = x
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 = z * (y / t);
double tmp;
if (z <= -2.05e-72) {
tmp = t_1;
} else if (z <= 6.6e+25) {
tmp = x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = z * (y / t) tmp = 0 if z <= -2.05e-72: tmp = t_1 elif z <= 6.6e+25: tmp = x else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(z * Float64(y / t)) tmp = 0.0 if (z <= -2.05e-72) tmp = t_1; elseif (z <= 6.6e+25) tmp = x; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = z * (y / t); tmp = 0.0; if (z <= -2.05e-72) tmp = t_1; elseif (z <= 6.6e+25) tmp = x; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -2.05e-72], t$95$1, If[LessEqual[z, 6.6e+25], x, t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \frac{y}{t}\\
\mathbf{if}\;z \leq -2.05 \cdot 10^{-72}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 6.6 \cdot 10^{+25}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -2.05000000000000002e-72 or 6.6000000000000002e25 < z Initial program 82.9%
+-commutativeN/A
+-lowering-+.f64N/A
associate-/l*N/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
--lowering--.f64N/A
/-lowering-/.f6497.4%
Applied egg-rr97.4%
Taylor expanded in y around inf
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f6445.8%
Simplified45.8%
*-commutativeN/A
associate-*l/N/A
*-lowering-*.f64N/A
/-lowering-/.f6449.9%
Applied egg-rr49.9%
if -2.05000000000000002e-72 < z < 6.6000000000000002e25Initial program 98.3%
Taylor expanded in z around 0
Simplified63.4%
Final simplification56.3%
(FPCore (x y z t) :precision binary64 (+ x (* (- y x) (/ z t))))
double code(double x, double y, double z, double t) {
return x + ((y - x) * (z / 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 - x) * (z / t))
end function
public static double code(double x, double y, double z, double t) {
return x + ((y - x) * (z / t));
}
def code(x, y, z, t): return x + ((y - x) * (z / t))
function code(x, y, z, t) return Float64(x + Float64(Float64(y - x) * Float64(z / t))) end
function tmp = code(x, y, z, t) tmp = x + ((y - x) * (z / t)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(y - x), $MachinePrecision] * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(y - x\right) \cdot \frac{z}{t}
\end{array}
Initial program 90.2%
associate-/l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
--lowering--.f6497.5%
Applied egg-rr97.5%
Final simplification97.5%
(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 90.2%
Taylor expanded in z around 0
Simplified40.3%
(FPCore (x y z t)
:precision binary64
(if (< x -9.025511195533005e-135)
(- x (* (/ z t) (- x y)))
(if (< x 4.275032163700715e-250)
(+ x (* (/ (- y x) t) z))
(+ x (/ (- y x) (/ t z))))))
double code(double x, double y, double z, double t) {
double tmp;
if (x < -9.025511195533005e-135) {
tmp = x - ((z / t) * (x - y));
} else if (x < 4.275032163700715e-250) {
tmp = x + (((y - x) / t) * z);
} else {
tmp = x + ((y - x) / (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 (x < (-9.025511195533005d-135)) then
tmp = x - ((z / t) * (x - y))
else if (x < 4.275032163700715d-250) then
tmp = x + (((y - x) / t) * z)
else
tmp = x + ((y - x) / (t / z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x < -9.025511195533005e-135) {
tmp = x - ((z / t) * (x - y));
} else if (x < 4.275032163700715e-250) {
tmp = x + (((y - x) / t) * z);
} else {
tmp = x + ((y - x) / (t / z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x < -9.025511195533005e-135: tmp = x - ((z / t) * (x - y)) elif x < 4.275032163700715e-250: tmp = x + (((y - x) / t) * z) else: tmp = x + ((y - x) / (t / z)) return tmp
function code(x, y, z, t) tmp = 0.0 if (x < -9.025511195533005e-135) tmp = Float64(x - Float64(Float64(z / t) * Float64(x - y))); elseif (x < 4.275032163700715e-250) tmp = Float64(x + Float64(Float64(Float64(y - x) / t) * z)); else tmp = Float64(x + Float64(Float64(y - x) / Float64(t / z))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x < -9.025511195533005e-135) tmp = x - ((z / t) * (x - y)); elseif (x < 4.275032163700715e-250) tmp = x + (((y - x) / t) * z); else tmp = x + ((y - x) / (t / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Less[x, -9.025511195533005e-135], N[(x - N[(N[(z / t), $MachinePrecision] * N[(x - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Less[x, 4.275032163700715e-250], N[(x + N[(N[(N[(y - x), $MachinePrecision] / t), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y - x), $MachinePrecision] / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x < -9.025511195533005 \cdot 10^{-135}:\\
\;\;\;\;x - \frac{z}{t} \cdot \left(x - y\right)\\
\mathbf{elif}\;x < 4.275032163700715 \cdot 10^{-250}:\\
\;\;\;\;x + \frac{y - x}{t} \cdot z\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y - x}{\frac{t}{z}}\\
\end{array}
\end{array}
herbie shell --seed 2024155
(FPCore (x y z t)
:name "Numeric.Histogram:binBounds from Chart-1.5.3"
:precision binary64
:alt
(! :herbie-platform default (if (< x -1805102239106601/200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (- x (* (/ z t) (- x y))) (if (< x 855006432740143/2000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (+ x (* (/ (- y x) t) z)) (+ x (/ (- y x) (/ t z))))))
(+ x (/ (* (- y x) z) t)))