
(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 11 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 (fma (/ z t) (- y x) x))
double code(double x, double y, double z, double t) {
return fma((z / t), (y - x), x);
}
function code(x, y, z, t) return fma(Float64(z / t), Float64(y - x), x) end
code[x_, y_, z_, t_] := N[(N[(z / t), $MachinePrecision] * N[(y - x), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\frac{z}{t}, y - x, x\right)
\end{array}
Initial program 91.0%
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f64N/A
--lowering--.f6497.3
Applied egg-rr97.3%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (/ z t) (- y x))) (t_2 (+ x (/ (* z (- y x)) t))))
(if (<= t_2 (- INFINITY))
t_1
(if (<= t_2 5e+74)
(+ x (/ (* z y) t))
(if (<= t_2 1e+307) (- x (/ (* z x) t)) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = (z / t) * (y - x);
double t_2 = x + ((z * (y - x)) / t);
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = t_1;
} else if (t_2 <= 5e+74) {
tmp = x + ((z * y) / t);
} else if (t_2 <= 1e+307) {
tmp = x - ((z * x) / t);
} else {
tmp = t_1;
}
return tmp;
}
public static double code(double x, double y, double z, double t) {
double t_1 = (z / t) * (y - x);
double t_2 = x + ((z * (y - x)) / t);
double tmp;
if (t_2 <= -Double.POSITIVE_INFINITY) {
tmp = t_1;
} else if (t_2 <= 5e+74) {
tmp = x + ((z * y) / t);
} else if (t_2 <= 1e+307) {
tmp = x - ((z * x) / t);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (z / t) * (y - x) t_2 = x + ((z * (y - x)) / t) tmp = 0 if t_2 <= -math.inf: tmp = t_1 elif t_2 <= 5e+74: tmp = x + ((z * y) / t) elif t_2 <= 1e+307: tmp = x - ((z * x) / t) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(z / t) * Float64(y - x)) t_2 = Float64(x + Float64(Float64(z * Float64(y - x)) / t)) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = t_1; elseif (t_2 <= 5e+74) tmp = Float64(x + Float64(Float64(z * y) / t)); elseif (t_2 <= 1e+307) tmp = Float64(x - Float64(Float64(z * x) / t)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (z / t) * (y - x); t_2 = x + ((z * (y - x)) / t); tmp = 0.0; if (t_2 <= -Inf) tmp = t_1; elseif (t_2 <= 5e+74) tmp = x + ((z * y) / t); elseif (t_2 <= 1e+307) tmp = x - ((z * x) / t); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(z / t), $MachinePrecision] * N[(y - x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x + N[(N[(z * N[(y - x), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], t$95$1, If[LessEqual[t$95$2, 5e+74], N[(x + N[(N[(z * y), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 1e+307], N[(x - N[(N[(z * x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z}{t} \cdot \left(y - x\right)\\
t_2 := x + \frac{z \cdot \left(y - x\right)}{t}\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+74}:\\
\;\;\;\;x + \frac{z \cdot y}{t}\\
\mathbf{elif}\;t\_2 \leq 10^{+307}:\\
\;\;\;\;x - \frac{z \cdot x}{t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (+.f64 x (/.f64 (*.f64 (-.f64 y x) z) t)) < -inf.0 or 9.99999999999999986e306 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) z) t)) Initial program 72.3%
Taylor expanded in z around inf
div-subN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
--lowering--.f6493.8
Simplified93.8%
associate-*r/N/A
associate-*l/N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
--lowering--.f6493.9
Applied egg-rr93.9%
if -inf.0 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) z) t)) < 4.99999999999999963e74Initial program 99.1%
Taylor expanded in y around inf
*-lowering-*.f6487.5
Simplified87.5%
if 4.99999999999999963e74 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) z) t)) < 9.99999999999999986e306Initial program 99.8%
Taylor expanded in x around inf
mul-1-negN/A
unsub-negN/A
distribute-lft-out--N/A
*-rgt-identityN/A
associate-/l*N/A
--lowering--.f64N/A
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f6483.3
Simplified83.3%
Final simplification88.7%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* z (/ (- y x) t))) (t_2 (+ x (/ (* z (- y x)) t)))) (if (<= t_2 (- INFINITY)) t_1 (if (<= t_2 1e+307) (fma (/ z t) y x) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = z * ((y - x) / t);
double t_2 = x + ((z * (y - x)) / t);
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = t_1;
} else if (t_2 <= 1e+307) {
tmp = fma((z / t), y, x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(z * Float64(Float64(y - x) / t)) t_2 = Float64(x + Float64(Float64(z * Float64(y - x)) / t)) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = t_1; elseif (t_2 <= 1e+307) tmp = fma(Float64(z / t), y, x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(z * N[(N[(y - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x + N[(N[(z * N[(y - x), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], t$95$1, If[LessEqual[t$95$2, 1e+307], N[(N[(z / t), $MachinePrecision] * y + x), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \frac{y - x}{t}\\
t_2 := x + \frac{z \cdot \left(y - x\right)}{t}\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 10^{+307}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{t}, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (+.f64 x (/.f64 (*.f64 (-.f64 y x) z) t)) < -inf.0 or 9.99999999999999986e306 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) z) t)) Initial program 72.3%
Taylor expanded in z around inf
div-subN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
--lowering--.f6493.8
Simplified93.8%
if -inf.0 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) z) t)) < 9.99999999999999986e306Initial program 99.3%
Taylor expanded in y around inf
*-lowering-*.f6478.6
Simplified78.6%
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f6478.0
Applied egg-rr78.0%
Final simplification82.9%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (fma (/ z t) y x))) (if (<= y -5.5e+47) t_1 (if (<= y 2.6e-217) (fma (/ z t) (- x) x) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = fma((z / t), y, x);
double tmp;
if (y <= -5.5e+47) {
tmp = t_1;
} else if (y <= 2.6e-217) {
tmp = fma((z / t), -x, x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = fma(Float64(z / t), y, x) tmp = 0.0 if (y <= -5.5e+47) tmp = t_1; elseif (y <= 2.6e-217) tmp = fma(Float64(z / t), Float64(-x), x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(z / t), $MachinePrecision] * y + x), $MachinePrecision]}, If[LessEqual[y, -5.5e+47], t$95$1, If[LessEqual[y, 2.6e-217], N[(N[(z / t), $MachinePrecision] * (-x) + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{z}{t}, y, x\right)\\
\mathbf{if}\;y \leq -5.5 \cdot 10^{+47}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 2.6 \cdot 10^{-217}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{t}, -x, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -5.4999999999999998e47 or 2.59999999999999993e-217 < y Initial program 88.6%
Taylor expanded in y around inf
*-lowering-*.f6478.3
Simplified78.3%
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f6487.2
Applied egg-rr87.2%
if -5.4999999999999998e47 < y < 2.59999999999999993e-217Initial program 94.4%
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f64N/A
--lowering--.f6495.5
Applied egg-rr95.5%
Taylor expanded in y around 0
mul-1-negN/A
neg-lowering-neg.f6487.4
Simplified87.4%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (fma (/ z t) y x))) (if (<= t -3.3e-106) t_1 (if (<= t 4.4e+16) (* (/ z t) (- y x)) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = fma((z / t), y, x);
double tmp;
if (t <= -3.3e-106) {
tmp = t_1;
} else if (t <= 4.4e+16) {
tmp = (z / t) * (y - x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = fma(Float64(z / t), y, x) tmp = 0.0 if (t <= -3.3e-106) tmp = t_1; elseif (t <= 4.4e+16) tmp = Float64(Float64(z / t) * Float64(y - x)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(z / t), $MachinePrecision] * y + x), $MachinePrecision]}, If[LessEqual[t, -3.3e-106], t$95$1, If[LessEqual[t, 4.4e+16], N[(N[(z / t), $MachinePrecision] * N[(y - x), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{z}{t}, y, x\right)\\
\mathbf{if}\;t \leq -3.3 \cdot 10^{-106}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 4.4 \cdot 10^{+16}:\\
\;\;\;\;\frac{z}{t} \cdot \left(y - x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -3.30000000000000016e-106 or 4.4e16 < t Initial program 85.7%
Taylor expanded in y around inf
*-lowering-*.f6477.2
Simplified77.2%
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f6485.7
Applied egg-rr85.7%
if -3.30000000000000016e-106 < t < 4.4e16Initial program 98.1%
Taylor expanded in z around inf
div-subN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
--lowering--.f6478.0
Simplified78.0%
associate-*r/N/A
associate-*l/N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
--lowering--.f6483.1
Applied egg-rr83.1%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (fma (/ z t) y x))) (if (<= t -5.3e-253) t_1 (if (<= t 7.5e-186) (* x (/ z (- t))) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = fma((z / t), y, x);
double tmp;
if (t <= -5.3e-253) {
tmp = t_1;
} else if (t <= 7.5e-186) {
tmp = x * (z / -t);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = fma(Float64(z / t), y, x) tmp = 0.0 if (t <= -5.3e-253) tmp = t_1; elseif (t <= 7.5e-186) tmp = Float64(x * Float64(z / Float64(-t))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(z / t), $MachinePrecision] * y + x), $MachinePrecision]}, If[LessEqual[t, -5.3e-253], t$95$1, If[LessEqual[t, 7.5e-186], N[(x * N[(z / (-t)), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{z}{t}, y, x\right)\\
\mathbf{if}\;t \leq -5.3 \cdot 10^{-253}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 7.5 \cdot 10^{-186}:\\
\;\;\;\;x \cdot \frac{z}{-t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -5.3000000000000002e-253 or 7.50000000000000076e-186 < t Initial program 90.0%
Taylor expanded in y around inf
*-lowering-*.f6472.3
Simplified72.3%
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f6478.4
Applied egg-rr78.4%
if -5.3000000000000002e-253 < t < 7.50000000000000076e-186Initial program 97.1%
Taylor expanded in z around inf
div-subN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
--lowering--.f6480.2
Simplified80.2%
Taylor expanded in y around 0
mul-1-negN/A
neg-lowering-neg.f6447.5
Simplified47.5%
clear-numN/A
associate-/r/N/A
associate-*r*N/A
div-invN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
neg-lowering-neg.f6465.2
Applied egg-rr65.2%
Final simplification76.5%
(FPCore (x y z t) :precision binary64 (if (<= z -1.22e+88) (* (/ z t) y) (if (<= z 9.2e-47) x (* z (/ y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.22e+88) {
tmp = (z / t) * y;
} else if (z <= 9.2e-47) {
tmp = x;
} else {
tmp = z * (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 <= (-1.22d+88)) then
tmp = (z / t) * y
else if (z <= 9.2d-47) then
tmp = x
else
tmp = z * (y / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.22e+88) {
tmp = (z / t) * y;
} else if (z <= 9.2e-47) {
tmp = x;
} else {
tmp = z * (y / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.22e+88: tmp = (z / t) * y elif z <= 9.2e-47: tmp = x else: tmp = z * (y / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.22e+88) tmp = Float64(Float64(z / t) * y); elseif (z <= 9.2e-47) tmp = x; else tmp = Float64(z * Float64(y / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -1.22e+88) tmp = (z / t) * y; elseif (z <= 9.2e-47) tmp = x; else tmp = z * (y / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.22e+88], N[(N[(z / t), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[z, 9.2e-47], x, N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.22 \cdot 10^{+88}:\\
\;\;\;\;\frac{z}{t} \cdot y\\
\mathbf{elif}\;z \leq 9.2 \cdot 10^{-47}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;z \cdot \frac{y}{t}\\
\end{array}
\end{array}
if z < -1.22e88Initial program 84.1%
Taylor expanded in x around 0
*-commutativeN/A
associate-/l*N/A
*-lowering-*.f64N/A
/-lowering-/.f6441.8
Simplified41.8%
clear-numN/A
associate-/r/N/A
associate-*r*N/A
div-invN/A
*-lowering-*.f64N/A
/-lowering-/.f6446.6
Applied egg-rr46.6%
if -1.22e88 < z < 9.19999999999999928e-47Initial program 98.4%
Taylor expanded in z around 0
Simplified61.0%
if 9.19999999999999928e-47 < z Initial program 83.7%
Taylor expanded in x around 0
*-commutativeN/A
associate-/l*N/A
*-lowering-*.f64N/A
/-lowering-/.f6449.0
Simplified49.0%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* z (/ y t)))) (if (<= z -9e+87) t_1 (if (<= z 1.5e-46) x t_1))))
double code(double x, double y, double z, double t) {
double t_1 = z * (y / t);
double tmp;
if (z <= -9e+87) {
tmp = t_1;
} else if (z <= 1.5e-46) {
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 <= (-9d+87)) then
tmp = t_1
else if (z <= 1.5d-46) 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 <= -9e+87) {
tmp = t_1;
} else if (z <= 1.5e-46) {
tmp = x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = z * (y / t) tmp = 0 if z <= -9e+87: tmp = t_1 elif z <= 1.5e-46: 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 <= -9e+87) tmp = t_1; elseif (z <= 1.5e-46) 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 <= -9e+87) tmp = t_1; elseif (z <= 1.5e-46) 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, -9e+87], t$95$1, If[LessEqual[z, 1.5e-46], x, t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \frac{y}{t}\\
\mathbf{if}\;z \leq -9 \cdot 10^{+87}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.5 \cdot 10^{-46}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -9.0000000000000005e87 or 1.49999999999999994e-46 < z Initial program 83.8%
Taylor expanded in x around 0
*-commutativeN/A
associate-/l*N/A
*-lowering-*.f64N/A
/-lowering-/.f6446.4
Simplified46.4%
if -9.0000000000000005e87 < z < 1.49999999999999994e-46Initial program 98.4%
Taylor expanded in z around 0
Simplified61.0%
(FPCore (x y z t) :precision binary64 (if (<= z -9e+247) (* z (/ x (- t))) (fma (/ z t) y x)))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -9e+247) {
tmp = z * (x / -t);
} else {
tmp = fma((z / t), y, x);
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (z <= -9e+247) tmp = Float64(z * Float64(x / Float64(-t))); else tmp = fma(Float64(z / t), y, x); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[z, -9e+247], N[(z * N[(x / (-t)), $MachinePrecision]), $MachinePrecision], N[(N[(z / t), $MachinePrecision] * y + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -9 \cdot 10^{+247}:\\
\;\;\;\;z \cdot \frac{x}{-t}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{t}, y, x\right)\\
\end{array}
\end{array}
if z < -9.00000000000000004e247Initial program 87.0%
Taylor expanded in z around inf
div-subN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
--lowering--.f6489.3
Simplified89.3%
Taylor expanded in y around 0
mul-1-negN/A
neg-lowering-neg.f6463.4
Simplified63.4%
if -9.00000000000000004e247 < z Initial program 91.3%
Taylor expanded in y around inf
*-lowering-*.f6469.9
Simplified69.9%
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f6474.6
Applied egg-rr74.6%
Final simplification74.0%
(FPCore (x y z t) :precision binary64 (fma (/ z t) y x))
double code(double x, double y, double z, double t) {
return fma((z / t), y, x);
}
function code(x, y, z, t) return fma(Float64(z / t), y, x) end
code[x_, y_, z_, t_] := N[(N[(z / t), $MachinePrecision] * y + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\frac{z}{t}, y, x\right)
\end{array}
Initial program 91.0%
Taylor expanded in y around inf
*-lowering-*.f6467.4
Simplified67.4%
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f6472.3
Applied egg-rr72.3%
(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 91.0%
Taylor expanded in z around 0
Simplified38.4%
(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 2024199
(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)))