
(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 8 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 (* (/ z t) (- y x))))
double code(double x, double y, double z, double t) {
return x + ((z / t) * (y - 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 + ((z / t) * (y - x))
end function
public static double code(double x, double y, double z, double t) {
return x + ((z / t) * (y - x));
}
def code(x, y, z, t): return x + ((z / t) * (y - x))
function code(x, y, z, t) return Float64(x + Float64(Float64(z / t) * Float64(y - x))) end
function tmp = code(x, y, z, t) tmp = x + ((z / t) * (y - x)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(z / t), $MachinePrecision] * N[(y - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{z}{t} \cdot \left(y - x\right)
\end{array}
Initial program 92.8%
associate-/l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
--lowering--.f6498.4%
Applied egg-rr98.4%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* x (+ 1.0 (* z (/ -1.0 t)))))) (if (<= x -4.3e+18) t_1 (if (<= x 3.65e+133) (+ x (/ y (/ t z))) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = x * (1.0 + (z * (-1.0 / t)));
double tmp;
if (x <= -4.3e+18) {
tmp = t_1;
} else if (x <= 3.65e+133) {
tmp = x + (y / (t / z));
} 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 * ((-1.0d0) / t)))
if (x <= (-4.3d+18)) then
tmp = t_1
else if (x <= 3.65d+133) then
tmp = x + (y / (t / z))
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 * (-1.0 / t)));
double tmp;
if (x <= -4.3e+18) {
tmp = t_1;
} else if (x <= 3.65e+133) {
tmp = x + (y / (t / z));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (1.0 + (z * (-1.0 / t))) tmp = 0 if x <= -4.3e+18: tmp = t_1 elif x <= 3.65e+133: tmp = x + (y / (t / z)) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(1.0 + Float64(z * Float64(-1.0 / t)))) tmp = 0.0 if (x <= -4.3e+18) tmp = t_1; elseif (x <= 3.65e+133) tmp = Float64(x + Float64(y / Float64(t / z))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (1.0 + (z * (-1.0 / t))); tmp = 0.0; if (x <= -4.3e+18) tmp = t_1; elseif (x <= 3.65e+133) tmp = x + (y / (t / z)); 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 * N[(-1.0 / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -4.3e+18], t$95$1, If[LessEqual[x, 3.65e+133], N[(x + N[(y / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(1 + z \cdot \frac{-1}{t}\right)\\
\mathbf{if}\;x \leq -4.3 \cdot 10^{+18}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 3.65 \cdot 10^{+133}:\\
\;\;\;\;x + \frac{y}{\frac{t}{z}}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -4.3e18 or 3.65e133 < x Initial program 87.7%
Taylor expanded in x around inf
*-lowering-*.f64N/A
mul-1-negN/A
unsub-negN/A
--lowering--.f64N/A
/-lowering-/.f6496.5%
Simplified96.5%
clear-numN/A
associate-/r/N/A
*-lowering-*.f64N/A
/-lowering-/.f6496.5%
Applied egg-rr96.5%
if -4.3e18 < x < 3.65e133Initial program 95.3%
Taylor expanded in y around inf
/-lowering-/.f64N/A
*-lowering-*.f6484.9%
Simplified84.9%
+-commutativeN/A
+-lowering-+.f64N/A
associate-/l*N/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
/-lowering-/.f6488.3%
Applied egg-rr88.3%
Final simplification91.0%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* x (- 1.0 (/ z t))))) (if (<= x -1.45e+18) t_1 (if (<= x 7e+133) (+ x (/ y (/ t z))) 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.45e+18) {
tmp = t_1;
} else if (x <= 7e+133) {
tmp = x + (y / (t / z));
} 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.45d+18)) then
tmp = t_1
else if (x <= 7d+133) then
tmp = x + (y / (t / z))
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.45e+18) {
tmp = t_1;
} else if (x <= 7e+133) {
tmp = x + (y / (t / z));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (1.0 - (z / t)) tmp = 0 if x <= -1.45e+18: tmp = t_1 elif x <= 7e+133: tmp = x + (y / (t / z)) 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.45e+18) tmp = t_1; elseif (x <= 7e+133) tmp = Float64(x + Float64(y / Float64(t / z))); 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.45e+18) tmp = t_1; elseif (x <= 7e+133) tmp = x + (y / (t / z)); 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.45e+18], t$95$1, If[LessEqual[x, 7e+133], N[(x + N[(y / N[(t / z), $MachinePrecision]), $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.45 \cdot 10^{+18}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 7 \cdot 10^{+133}:\\
\;\;\;\;x + \frac{y}{\frac{t}{z}}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -1.45e18 or 6.9999999999999997e133 < x Initial program 87.7%
Taylor expanded in x around inf
*-lowering-*.f64N/A
mul-1-negN/A
unsub-negN/A
--lowering--.f64N/A
/-lowering-/.f6496.5%
Simplified96.5%
if -1.45e18 < x < 6.9999999999999997e133Initial program 95.3%
Taylor expanded in y around inf
/-lowering-/.f64N/A
*-lowering-*.f6484.9%
Simplified84.9%
+-commutativeN/A
+-lowering-+.f64N/A
associate-/l*N/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
/-lowering-/.f6488.3%
Applied egg-rr88.3%
Final simplification91.0%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* x (- 1.0 (/ z t))))) (if (<= x -5.5e+17) t_1 (if (<= x 2.6e+29) (+ x (/ (* z y) 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 <= -5.5e+17) {
tmp = t_1;
} else if (x <= 2.6e+29) {
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 - (z / t))
if (x <= (-5.5d+17)) then
tmp = t_1
else if (x <= 2.6d+29) 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 - (z / t));
double tmp;
if (x <= -5.5e+17) {
tmp = t_1;
} else if (x <= 2.6e+29) {
tmp = x + ((z * y) / t);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (1.0 - (z / t)) tmp = 0 if x <= -5.5e+17: tmp = t_1 elif x <= 2.6e+29: 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(z / t))) tmp = 0.0 if (x <= -5.5e+17) tmp = t_1; elseif (x <= 2.6e+29) 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 = x * (1.0 - (z / t)); tmp = 0.0; if (x <= -5.5e+17) tmp = t_1; elseif (x <= 2.6e+29) 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[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -5.5e+17], t$95$1, If[LessEqual[x, 2.6e+29], N[(x + N[(N[(z * y), $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 -5.5 \cdot 10^{+17}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 2.6 \cdot 10^{+29}:\\
\;\;\;\;x + \frac{z \cdot y}{t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -5.5e17 or 2.6e29 < x Initial program 88.3%
Taylor expanded in x around inf
*-lowering-*.f64N/A
mul-1-negN/A
unsub-negN/A
--lowering--.f64N/A
/-lowering-/.f6492.2%
Simplified92.2%
if -5.5e17 < x < 2.6e29Initial program 96.3%
Taylor expanded in y around inf
/-lowering-/.f64N/A
*-lowering-*.f6487.9%
Simplified87.9%
Final simplification89.8%
(FPCore (x y z t) :precision binary64 (if (<= y -1.4e+147) (* z (/ (- y x) t)) (if (<= y 7.5e+74) (* x (- 1.0 (/ z t))) (* (/ z t) y))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.4e+147) {
tmp = z * ((y - x) / t);
} else if (y <= 7.5e+74) {
tmp = x * (1.0 - (z / 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 (y <= (-1.4d+147)) then
tmp = z * ((y - x) / t)
else if (y <= 7.5d+74) then
tmp = x * (1.0d0 - (z / 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 (y <= -1.4e+147) {
tmp = z * ((y - x) / t);
} else if (y <= 7.5e+74) {
tmp = x * (1.0 - (z / t));
} else {
tmp = (z / t) * y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -1.4e+147: tmp = z * ((y - x) / t) elif y <= 7.5e+74: tmp = x * (1.0 - (z / t)) else: tmp = (z / t) * y return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -1.4e+147) tmp = Float64(z * Float64(Float64(y - x) / t)); elseif (y <= 7.5e+74) tmp = Float64(x * Float64(1.0 - Float64(z / t))); else tmp = Float64(Float64(z / t) * y); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -1.4e+147) tmp = z * ((y - x) / t); elseif (y <= 7.5e+74) tmp = x * (1.0 - (z / t)); else tmp = (z / t) * y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -1.4e+147], N[(z * N[(N[(y - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 7.5e+74], N[(x * N[(1.0 - N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(z / t), $MachinePrecision] * y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.4 \cdot 10^{+147}:\\
\;\;\;\;z \cdot \frac{y - x}{t}\\
\mathbf{elif}\;y \leq 7.5 \cdot 10^{+74}:\\
\;\;\;\;x \cdot \left(1 - \frac{z}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{z}{t} \cdot y\\
\end{array}
\end{array}
if y < -1.4e147Initial program 92.9%
Taylor expanded in z around inf
div-subN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
--lowering--.f6472.7%
Simplified72.7%
if -1.4e147 < y < 7.5e74Initial program 93.8%
Taylor expanded in x around inf
*-lowering-*.f64N/A
mul-1-negN/A
unsub-negN/A
--lowering--.f64N/A
/-lowering-/.f6481.2%
Simplified81.2%
if 7.5e74 < y Initial program 89.0%
associate-/l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
--lowering--.f6499.8%
Applied egg-rr99.8%
Taylor expanded in x around 0
associate-/l*N/A
*-lowering-*.f64N/A
/-lowering-/.f6477.7%
Simplified77.7%
Final simplification79.6%
(FPCore (x y z t) :precision binary64 (if (<= y -1.1e+183) (/ (* z y) t) (if (<= y 6.3e+74) (* x (- 1.0 (/ z t))) (* (/ z t) y))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.1e+183) {
tmp = (z * y) / t;
} else if (y <= 6.3e+74) {
tmp = x * (1.0 - (z / 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 (y <= (-1.1d+183)) then
tmp = (z * y) / t
else if (y <= 6.3d+74) then
tmp = x * (1.0d0 - (z / 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 (y <= -1.1e+183) {
tmp = (z * y) / t;
} else if (y <= 6.3e+74) {
tmp = x * (1.0 - (z / t));
} else {
tmp = (z / t) * y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -1.1e+183: tmp = (z * y) / t elif y <= 6.3e+74: tmp = x * (1.0 - (z / t)) else: tmp = (z / t) * y return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -1.1e+183) tmp = Float64(Float64(z * y) / t); elseif (y <= 6.3e+74) tmp = Float64(x * Float64(1.0 - Float64(z / t))); else tmp = Float64(Float64(z / t) * y); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -1.1e+183) tmp = (z * y) / t; elseif (y <= 6.3e+74) tmp = x * (1.0 - (z / t)); else tmp = (z / t) * y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -1.1e+183], N[(N[(z * y), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[y, 6.3e+74], N[(x * N[(1.0 - N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(z / t), $MachinePrecision] * y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.1 \cdot 10^{+183}:\\
\;\;\;\;\frac{z \cdot y}{t}\\
\mathbf{elif}\;y \leq 6.3 \cdot 10^{+74}:\\
\;\;\;\;x \cdot \left(1 - \frac{z}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{z}{t} \cdot y\\
\end{array}
\end{array}
if y < -1.09999999999999995e183Initial program 92.3%
Taylor expanded in x around 0
/-lowering-/.f64N/A
*-lowering-*.f6473.7%
Simplified73.7%
if -1.09999999999999995e183 < y < 6.30000000000000016e74Initial program 93.9%
Taylor expanded in x around inf
*-lowering-*.f64N/A
mul-1-negN/A
unsub-negN/A
--lowering--.f64N/A
/-lowering-/.f6480.9%
Simplified80.9%
if 6.30000000000000016e74 < y Initial program 89.0%
associate-/l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
--lowering--.f6499.8%
Applied egg-rr99.8%
Taylor expanded in x around 0
associate-/l*N/A
*-lowering-*.f64N/A
/-lowering-/.f6477.7%
Simplified77.7%
Final simplification79.5%
(FPCore (x y z t) :precision binary64 (if (<= t -1.28e-12) x (if (<= t 2.3e+91) (* (/ z t) y) x)))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1.28e-12) {
tmp = x;
} else if (t <= 2.3e+91) {
tmp = (z / t) * 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 (t <= (-1.28d-12)) then
tmp = x
else if (t <= 2.3d+91) then
tmp = (z / t) * 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 (t <= -1.28e-12) {
tmp = x;
} else if (t <= 2.3e+91) {
tmp = (z / t) * y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -1.28e-12: tmp = x elif t <= 2.3e+91: tmp = (z / t) * y else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -1.28e-12) tmp = x; elseif (t <= 2.3e+91) tmp = Float64(Float64(z / t) * y); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -1.28e-12) tmp = x; elseif (t <= 2.3e+91) tmp = (z / t) * y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -1.28e-12], x, If[LessEqual[t, 2.3e+91], N[(N[(z / t), $MachinePrecision] * y), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.28 \cdot 10^{-12}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq 2.3 \cdot 10^{+91}:\\
\;\;\;\;\frac{z}{t} \cdot y\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if t < -1.28e-12 or 2.29999999999999991e91 < t Initial program 85.7%
Taylor expanded in z around 0
Simplified71.9%
if -1.28e-12 < t < 2.29999999999999991e91Initial program 98.4%
associate-/l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
--lowering--.f6497.9%
Applied egg-rr97.9%
Taylor expanded in x around 0
associate-/l*N/A
*-lowering-*.f64N/A
/-lowering-/.f6455.2%
Simplified55.2%
Final simplification62.7%
(FPCore (x y z t) :precision binary64 x)
double code(double x, double y, double z, double t) {
return x;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x
end function
public static double code(double x, double y, double z, double t) {
return x;
}
def code(x, y, z, t): return x
function code(x, y, z, t) return x end
function tmp = code(x, y, z, t) tmp = x; end
code[x_, y_, z_, t_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 92.8%
Taylor expanded in z around 0
Simplified44.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 2024138
(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)))