
(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}
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(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}
(FPCore (x y z t) :precision binary64 (if (<= z -1e+168) (+ x (* z (/ (- y x) t))) (+ x (* (- y x) (/ z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1e+168) {
tmp = x + (z * ((y - x) / t));
} else {
tmp = x + ((y - x) * (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 (z <= (-1d+168)) then
tmp = x + (z * ((y - x) / t))
else
tmp = x + ((y - x) * (z / t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1e+168) {
tmp = x + (z * ((y - x) / t));
} else {
tmp = x + ((y - x) * (z / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1e+168: tmp = x + (z * ((y - x) / t)) else: tmp = x + ((y - x) * (z / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1e+168) tmp = Float64(x + Float64(z * Float64(Float64(y - x) / t))); else tmp = Float64(x + Float64(Float64(y - x) * Float64(z / t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -1e+168) tmp = x + (z * ((y - x) / t)); else tmp = x + ((y - x) * (z / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1e+168], N[(x + N[(z * N[(N[(y - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y - x), $MachinePrecision] * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1 \cdot 10^{+168}:\\
\;\;\;\;x + z \cdot \frac{y - x}{t}\\
\mathbf{else}:\\
\;\;\;\;x + \left(y - x\right) \cdot \frac{z}{t}\\
\end{array}
\end{array}
if z < -9.9999999999999993e167Initial program 84.8%
Taylor expanded in y around 0 87.1%
+-commutative87.1%
mul-1-neg87.1%
unsub-neg87.1%
associate-/l*65.4%
associate-*r/68.2%
distribute-rgt-out--84.8%
associate-*l/96.8%
associate-/l*98.1%
Simplified98.1%
if -9.9999999999999993e167 < z Initial program 99.5%
Final simplification99.3%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.75e-167) (not (<= z 3.3e-94))) (+ x (* z (/ (- y x) t))) (+ x (/ (* y z) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.75e-167) || !(z <= 3.3e-94)) {
tmp = x + (z * ((y - x) / 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 ((z <= (-1.75d-167)) .or. (.not. (z <= 3.3d-94))) then
tmp = x + (z * ((y - x) / 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 ((z <= -1.75e-167) || !(z <= 3.3e-94)) {
tmp = x + (z * ((y - x) / t));
} else {
tmp = x + ((y * z) / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.75e-167) or not (z <= 3.3e-94): tmp = x + (z * ((y - x) / t)) else: tmp = x + ((y * z) / t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.75e-167) || !(z <= 3.3e-94)) tmp = Float64(x + Float64(z * Float64(Float64(y - x) / t))); else tmp = Float64(x + Float64(Float64(y * z) / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -1.75e-167) || ~((z <= 3.3e-94))) tmp = x + (z * ((y - x) / t)); else tmp = x + ((y * z) / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.75e-167], N[Not[LessEqual[z, 3.3e-94]], $MachinePrecision]], N[(x + N[(z * N[(N[(y - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.75 \cdot 10^{-167} \lor \neg \left(z \leq 3.3 \cdot 10^{-94}\right):\\
\;\;\;\;x + z \cdot \frac{y - x}{t}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y \cdot z}{t}\\
\end{array}
\end{array}
if z < -1.75e-167 or 3.3000000000000001e-94 < z Initial program 97.2%
Taylor expanded in y around 0 86.2%
+-commutative86.2%
mul-1-neg86.2%
unsub-neg86.2%
associate-/l*82.2%
associate-*r/85.4%
distribute-rgt-out--97.2%
associate-*l/94.9%
associate-/l*98.5%
Simplified98.5%
if -1.75e-167 < z < 3.3000000000000001e-94Initial program 98.8%
Taylor expanded in y around inf 95.3%
*-commutative95.3%
Simplified95.3%
Final simplification97.4%
(FPCore (x y z t) :precision binary64 (if (or (<= y -9.5e+23) (not (<= y 3e+51))) (+ x (* y (/ z t))) (* x (- 1.0 (/ z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -9.5e+23) || !(y <= 3e+51)) {
tmp = x + (y * (z / t));
} else {
tmp = x * (1.0 - (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 <= (-9.5d+23)) .or. (.not. (y <= 3d+51))) then
tmp = x + (y * (z / t))
else
tmp = x * (1.0d0 - (z / t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -9.5e+23) || !(y <= 3e+51)) {
tmp = x + (y * (z / t));
} else {
tmp = x * (1.0 - (z / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -9.5e+23) or not (y <= 3e+51): tmp = x + (y * (z / t)) else: tmp = x * (1.0 - (z / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -9.5e+23) || !(y <= 3e+51)) tmp = Float64(x + Float64(y * Float64(z / t))); else tmp = Float64(x * Float64(1.0 - Float64(z / t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -9.5e+23) || ~((y <= 3e+51))) tmp = x + (y * (z / t)); else tmp = x * (1.0 - (z / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -9.5e+23], N[Not[LessEqual[y, 3e+51]], $MachinePrecision]], N[(x + N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 - N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -9.5 \cdot 10^{+23} \lor \neg \left(y \leq 3 \cdot 10^{+51}\right):\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - \frac{z}{t}\right)\\
\end{array}
\end{array}
if y < -9.50000000000000038e23 or 3e51 < y Initial program 99.0%
clear-num99.0%
un-div-inv99.1%
Applied egg-rr99.1%
Taylor expanded in y around inf 86.1%
associate-*r/90.5%
Simplified90.5%
if -9.50000000000000038e23 < y < 3e51Initial program 96.7%
+-commutative96.7%
fma-define96.7%
Simplified96.7%
Taylor expanded in y around 0 85.1%
mul-1-neg85.1%
unsub-neg85.1%
*-rgt-identity85.1%
associate-/l*86.3%
distribute-lft-out--86.3%
Simplified86.3%
Final simplification88.1%
(FPCore (x y z t) :precision binary64 (if (or (<= y -9e+23) (not (<= y 7.2e+49))) (+ x (/ y (/ t z))) (* x (- 1.0 (/ z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -9e+23) || !(y <= 7.2e+49)) {
tmp = x + (y / (t / z));
} else {
tmp = x * (1.0 - (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 <= (-9d+23)) .or. (.not. (y <= 7.2d+49))) then
tmp = x + (y / (t / z))
else
tmp = x * (1.0d0 - (z / t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -9e+23) || !(y <= 7.2e+49)) {
tmp = x + (y / (t / z));
} else {
tmp = x * (1.0 - (z / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -9e+23) or not (y <= 7.2e+49): tmp = x + (y / (t / z)) else: tmp = x * (1.0 - (z / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -9e+23) || !(y <= 7.2e+49)) tmp = Float64(x + Float64(y / Float64(t / z))); else tmp = Float64(x * Float64(1.0 - Float64(z / t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -9e+23) || ~((y <= 7.2e+49))) tmp = x + (y / (t / z)); else tmp = x * (1.0 - (z / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -9e+23], N[Not[LessEqual[y, 7.2e+49]], $MachinePrecision]], N[(x + N[(y / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 - N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -9 \cdot 10^{+23} \lor \neg \left(y \leq 7.2 \cdot 10^{+49}\right):\\
\;\;\;\;x + \frac{y}{\frac{t}{z}}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - \frac{z}{t}\right)\\
\end{array}
\end{array}
if y < -8.99999999999999958e23 or 7.19999999999999993e49 < y Initial program 99.0%
Taylor expanded in y around inf 86.1%
*-commutative86.1%
associate-/l*79.5%
Simplified79.5%
*-commutative79.5%
associate-/r/90.5%
Applied egg-rr90.5%
if -8.99999999999999958e23 < y < 7.19999999999999993e49Initial program 96.7%
+-commutative96.7%
fma-define96.7%
Simplified96.7%
Taylor expanded in y around 0 85.1%
mul-1-neg85.1%
unsub-neg85.1%
*-rgt-identity85.1%
associate-/l*86.3%
distribute-lft-out--86.3%
Simplified86.3%
Final simplification88.1%
(FPCore (x y z t) :precision binary64 (if (or (<= y -9e+23) (not (<= y 1.7e+50))) (+ x (/ y (/ t z))) (- x (/ x (/ t z)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -9e+23) || !(y <= 1.7e+50)) {
tmp = x + (y / (t / z));
} else {
tmp = x - (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 ((y <= (-9d+23)) .or. (.not. (y <= 1.7d+50))) then
tmp = x + (y / (t / z))
else
tmp = x - (x / (t / z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -9e+23) || !(y <= 1.7e+50)) {
tmp = x + (y / (t / z));
} else {
tmp = x - (x / (t / z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -9e+23) or not (y <= 1.7e+50): tmp = x + (y / (t / z)) else: tmp = x - (x / (t / z)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -9e+23) || !(y <= 1.7e+50)) tmp = Float64(x + Float64(y / Float64(t / z))); else tmp = Float64(x - Float64(x / Float64(t / z))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -9e+23) || ~((y <= 1.7e+50))) tmp = x + (y / (t / z)); else tmp = x - (x / (t / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -9e+23], N[Not[LessEqual[y, 1.7e+50]], $MachinePrecision]], N[(x + N[(y / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(x / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -9 \cdot 10^{+23} \lor \neg \left(y \leq 1.7 \cdot 10^{+50}\right):\\
\;\;\;\;x + \frac{y}{\frac{t}{z}}\\
\mathbf{else}:\\
\;\;\;\;x - \frac{x}{\frac{t}{z}}\\
\end{array}
\end{array}
if y < -8.99999999999999958e23 or 1.6999999999999999e50 < y Initial program 99.0%
Taylor expanded in y around inf 86.1%
*-commutative86.1%
associate-/l*79.5%
Simplified79.5%
*-commutative79.5%
associate-/r/90.5%
Applied egg-rr90.5%
if -8.99999999999999958e23 < y < 1.6999999999999999e50Initial program 96.7%
Taylor expanded in y around 0 85.1%
mul-1-neg85.1%
associate-/l*86.3%
distribute-lft-neg-out86.3%
*-commutative86.3%
Simplified86.3%
distribute-rgt-neg-out86.3%
unsub-neg86.3%
*-commutative86.3%
Applied egg-rr86.3%
clear-num86.3%
un-div-inv86.3%
Applied egg-rr86.3%
Final simplification88.1%
(FPCore (x y z t) :precision binary64 (if (or (<= z -7.6e+37) (not (<= z 8.5e-72))) (/ z (/ t (- x))) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -7.6e+37) || !(z <= 8.5e-72)) {
tmp = z / (t / -x);
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((z <= (-7.6d+37)) .or. (.not. (z <= 8.5d-72))) then
tmp = z / (t / -x)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -7.6e+37) || !(z <= 8.5e-72)) {
tmp = z / (t / -x);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -7.6e+37) or not (z <= 8.5e-72): tmp = z / (t / -x) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -7.6e+37) || !(z <= 8.5e-72)) tmp = Float64(z / Float64(t / Float64(-x))); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -7.6e+37) || ~((z <= 8.5e-72))) tmp = z / (t / -x); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -7.6e+37], N[Not[LessEqual[z, 8.5e-72]], $MachinePrecision]], N[(z / N[(t / (-x)), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.6 \cdot 10^{+37} \lor \neg \left(z \leq 8.5 \cdot 10^{-72}\right):\\
\;\;\;\;\frac{z}{\frac{t}{-x}}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -7.59999999999999979e37 or 8.50000000000000008e-72 < z Initial program 96.7%
+-commutative96.7%
fma-define96.7%
Simplified96.7%
Taylor expanded in y around 0 56.2%
mul-1-neg56.2%
unsub-neg56.2%
*-rgt-identity56.2%
associate-/l*58.7%
distribute-lft-out--58.7%
Simplified58.7%
Taylor expanded in z around 0 56.2%
associate-*l/58.1%
*-commutative58.1%
neg-mul-158.1%
sub-neg58.1%
Simplified58.1%
Taylor expanded in z around inf 43.9%
associate-*l/44.5%
*-commutative44.5%
neg-mul-144.5%
associate-*r/43.9%
associate-*l/45.2%
associate-/r/44.7%
Simplified44.7%
if -7.59999999999999979e37 < z < 8.50000000000000008e-72Initial program 99.0%
+-commutative99.0%
fma-define99.0%
Simplified99.0%
Taylor expanded in z around 0 64.9%
Final simplification53.3%
(FPCore (x y z t) :precision binary64 (if (<= z -9e+29) (/ z (/ t (- x))) (if (<= z 2.05e-76) x (* x (/ z (- t))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -9e+29) {
tmp = z / (t / -x);
} else if (z <= 2.05e-76) {
tmp = x;
} else {
tmp = x * (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 (z <= (-9d+29)) then
tmp = z / (t / -x)
else if (z <= 2.05d-76) then
tmp = x
else
tmp = x * (z / -t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -9e+29) {
tmp = z / (t / -x);
} else if (z <= 2.05e-76) {
tmp = x;
} else {
tmp = x * (z / -t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -9e+29: tmp = z / (t / -x) elif z <= 2.05e-76: tmp = x else: tmp = x * (z / -t) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -9e+29) tmp = Float64(z / Float64(t / Float64(-x))); elseif (z <= 2.05e-76) tmp = x; else tmp = Float64(x * Float64(z / Float64(-t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -9e+29) tmp = z / (t / -x); elseif (z <= 2.05e-76) tmp = x; else tmp = x * (z / -t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -9e+29], N[(z / N[(t / (-x)), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.05e-76], x, N[(x * N[(z / (-t)), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -9 \cdot 10^{+29}:\\
\;\;\;\;\frac{z}{\frac{t}{-x}}\\
\mathbf{elif}\;z \leq 2.05 \cdot 10^{-76}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{z}{-t}\\
\end{array}
\end{array}
if z < -9.0000000000000005e29Initial program 92.7%
+-commutative92.7%
fma-define92.7%
Simplified92.7%
Taylor expanded in y around 0 59.9%
mul-1-neg59.9%
unsub-neg59.9%
*-rgt-identity59.9%
associate-/l*59.8%
distribute-lft-out--59.8%
Simplified59.8%
Taylor expanded in z around 0 59.9%
associate-*l/61.3%
*-commutative61.3%
neg-mul-161.3%
sub-neg61.3%
Simplified61.3%
Taylor expanded in z around inf 45.0%
associate-*l/45.0%
*-commutative45.0%
neg-mul-145.0%
associate-*r/45.0%
associate-*l/43.5%
associate-/r/45.0%
Simplified45.0%
if -9.0000000000000005e29 < z < 2.0499999999999999e-76Initial program 99.0%
+-commutative99.0%
fma-define99.0%
Simplified99.0%
Taylor expanded in z around 0 64.9%
if 2.0499999999999999e-76 < z Initial program 99.9%
+-commutative99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in y around 0 53.2%
mul-1-neg53.2%
unsub-neg53.2%
*-rgt-identity53.2%
associate-/l*57.8%
distribute-lft-out--57.8%
Simplified57.8%
Taylor expanded in z around 0 53.2%
associate-*l/55.5%
*-commutative55.5%
neg-mul-155.5%
sub-neg55.5%
Simplified55.5%
Taylor expanded in z around inf 43.1%
associate-/l*46.5%
associate-*r*46.5%
neg-mul-146.5%
distribute-lft-neg-in46.5%
distribute-rgt-neg-in46.5%
distribute-neg-frac46.5%
Simplified46.5%
Final simplification53.9%
(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 97.7%
clear-num97.7%
un-div-inv98.0%
Applied egg-rr98.0%
Final simplification98.0%
(FPCore (x y z t) :precision binary64 (* x (- 1.0 (/ z t))))
double code(double x, double y, double z, double t) {
return x * (1.0 - (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 * (1.0d0 - (z / t))
end function
public static double code(double x, double y, double z, double t) {
return x * (1.0 - (z / t));
}
def code(x, y, z, t): return x * (1.0 - (z / t))
function code(x, y, z, t) return Float64(x * Float64(1.0 - Float64(z / t))) end
function tmp = code(x, y, z, t) tmp = x * (1.0 - (z / t)); end
code[x_, y_, z_, t_] := N[(x * N[(1.0 - N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(1 - \frac{z}{t}\right)
\end{array}
Initial program 97.7%
+-commutative97.7%
fma-define97.7%
Simplified97.7%
Taylor expanded in y around 0 63.4%
mul-1-neg63.4%
unsub-neg63.4%
*-rgt-identity63.4%
associate-/l*65.1%
distribute-lft-out--65.1%
Simplified65.1%
Final simplification65.1%
(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 97.7%
+-commutative97.7%
fma-define97.7%
Simplified97.7%
Taylor expanded in z around 0 37.0%
Final simplification37.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (- y x) (/ z t))) (t_2 (+ x (/ (- y x) (/ t z)))))
(if (< t_1 -1013646692435.8867)
t_2
(if (< t_1 0.0) (+ x (/ (* (- y x) z) t)) t_2))))
double code(double x, double y, double z, double t) {
double t_1 = (y - x) * (z / t);
double t_2 = x + ((y - x) / (t / z));
double tmp;
if (t_1 < -1013646692435.8867) {
tmp = t_2;
} else if (t_1 < 0.0) {
tmp = x + (((y - x) * z) / t);
} else {
tmp = t_2;
}
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) :: t_2
real(8) :: tmp
t_1 = (y - x) * (z / t)
t_2 = x + ((y - x) / (t / z))
if (t_1 < (-1013646692435.8867d0)) then
tmp = t_2
else if (t_1 < 0.0d0) then
tmp = x + (((y - x) * z) / t)
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (y - x) * (z / t);
double t_2 = x + ((y - x) / (t / z));
double tmp;
if (t_1 < -1013646692435.8867) {
tmp = t_2;
} else if (t_1 < 0.0) {
tmp = x + (((y - x) * z) / t);
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t): t_1 = (y - x) * (z / t) t_2 = x + ((y - x) / (t / z)) tmp = 0 if t_1 < -1013646692435.8867: tmp = t_2 elif t_1 < 0.0: tmp = x + (((y - x) * z) / t) else: tmp = t_2 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(y - x) * Float64(z / t)) t_2 = Float64(x + Float64(Float64(y - x) / Float64(t / z))) tmp = 0.0 if (t_1 < -1013646692435.8867) tmp = t_2; elseif (t_1 < 0.0) tmp = Float64(x + Float64(Float64(Float64(y - x) * z) / t)); else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (y - x) * (z / t); t_2 = x + ((y - x) / (t / z)); tmp = 0.0; if (t_1 < -1013646692435.8867) tmp = t_2; elseif (t_1 < 0.0) tmp = x + (((y - x) * z) / t); else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(y - x), $MachinePrecision] * N[(z / t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x + N[(N[(y - x), $MachinePrecision] / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Less[t$95$1, -1013646692435.8867], t$95$2, If[Less[t$95$1, 0.0], N[(x + N[(N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], t$95$2]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(y - x\right) \cdot \frac{z}{t}\\
t_2 := x + \frac{y - x}{\frac{t}{z}}\\
\mathbf{if}\;t\_1 < -1013646692435.8867:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 < 0:\\
\;\;\;\;x + \frac{\left(y - x\right) \cdot z}{t}\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
herbie shell --seed 2024046
(FPCore (x y z t)
:name "Graphics.Rendering.Plot.Render.Plot.Axis:tickPosition from plot-0.2.3.4"
:precision binary64
:alt
(if (< (* (- y x) (/ z t)) -1013646692435.8867) (+ x (/ (- y x) (/ t z))) (if (< (* (- y x) (/ z t)) 0.0) (+ x (/ (* (- y x) z) t)) (+ x (/ (- y x) (/ t z)))))
(+ x (* (- y x) (/ z t))))