
(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 (if (<= z -1.3e-135) (+ x (* z (/ (- y x) t))) (if (<= z 2e+21) (+ x (/ (* (- y x) z) t)) (+ x (/ z (/ t (- y x)))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.3e-135) {
tmp = x + (z * ((y - x) / t));
} else if (z <= 2e+21) {
tmp = x + (((y - x) * z) / t);
} else {
tmp = x + (z / (t / (y - 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 <= (-1.3d-135)) then
tmp = x + (z * ((y - x) / t))
else if (z <= 2d+21) then
tmp = x + (((y - x) * z) / t)
else
tmp = x + (z / (t / (y - x)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.3e-135) {
tmp = x + (z * ((y - x) / t));
} else if (z <= 2e+21) {
tmp = x + (((y - x) * z) / t);
} else {
tmp = x + (z / (t / (y - x)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.3e-135: tmp = x + (z * ((y - x) / t)) elif z <= 2e+21: tmp = x + (((y - x) * z) / t) else: tmp = x + (z / (t / (y - x))) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.3e-135) tmp = Float64(x + Float64(z * Float64(Float64(y - x) / t))); elseif (z <= 2e+21) tmp = Float64(x + Float64(Float64(Float64(y - x) * z) / t)); else tmp = Float64(x + Float64(z / Float64(t / Float64(y - x)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -1.3e-135) tmp = x + (z * ((y - x) / t)); elseif (z <= 2e+21) tmp = x + (((y - x) * z) / t); else tmp = x + (z / (t / (y - x))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.3e-135], N[(x + N[(z * N[(N[(y - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2e+21], N[(x + N[(N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], N[(x + N[(z / N[(t / N[(y - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.3 \cdot 10^{-135}:\\
\;\;\;\;x + z \cdot \frac{y - x}{t}\\
\mathbf{elif}\;z \leq 2 \cdot 10^{+21}:\\
\;\;\;\;x + \frac{\left(y - x\right) \cdot z}{t}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{z}{\frac{t}{y - x}}\\
\end{array}
\end{array}
if z < -1.30000000000000002e-135Initial program 87.4%
associate-*l/99.8%
Simplified99.8%
if -1.30000000000000002e-135 < z < 2e21Initial program 98.9%
if 2e21 < z Initial program 83.2%
associate-*l/99.7%
Simplified99.7%
*-commutative99.7%
clear-num99.7%
un-div-inv99.9%
Applied egg-rr99.9%
Final simplification99.5%
(FPCore (x y z t) :precision binary64 (if (or (<= z -5e-136) (not (<= z 2.9e-140))) (+ x (* z (/ (- y x) t))) (+ x (/ (* y z) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -5e-136) || !(z <= 2.9e-140)) {
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 <= (-5d-136)) .or. (.not. (z <= 2.9d-140))) 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 <= -5e-136) || !(z <= 2.9e-140)) {
tmp = x + (z * ((y - x) / t));
} else {
tmp = x + ((y * z) / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -5e-136) or not (z <= 2.9e-140): 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 <= -5e-136) || !(z <= 2.9e-140)) 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 <= -5e-136) || ~((z <= 2.9e-140))) 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, -5e-136], N[Not[LessEqual[z, 2.9e-140]], $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 -5 \cdot 10^{-136} \lor \neg \left(z \leq 2.9 \cdot 10^{-140}\right):\\
\;\;\;\;x + z \cdot \frac{y - x}{t}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y \cdot z}{t}\\
\end{array}
\end{array}
if z < -5.0000000000000002e-136 or 2.89999999999999997e-140 < z Initial program 87.8%
associate-*l/99.3%
Simplified99.3%
if -5.0000000000000002e-136 < z < 2.89999999999999997e-140Initial program 98.5%
associate-*l/76.7%
Simplified76.7%
Taylor expanded in y around inf 98.5%
*-commutative98.5%
Simplified98.5%
Final simplification99.1%
(FPCore (x y z t) :precision binary64 (if (<= z -5.4e-135) (+ x (* z (/ (- y x) t))) (if (<= z 7.5e-139) (+ x (/ (* y z) t)) (+ x (/ z (/ t (- y x)))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -5.4e-135) {
tmp = x + (z * ((y - x) / t));
} else if (z <= 7.5e-139) {
tmp = x + ((y * z) / t);
} else {
tmp = x + (z / (t / (y - 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 <= (-5.4d-135)) then
tmp = x + (z * ((y - x) / t))
else if (z <= 7.5d-139) then
tmp = x + ((y * z) / t)
else
tmp = x + (z / (t / (y - x)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -5.4e-135) {
tmp = x + (z * ((y - x) / t));
} else if (z <= 7.5e-139) {
tmp = x + ((y * z) / t);
} else {
tmp = x + (z / (t / (y - x)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -5.4e-135: tmp = x + (z * ((y - x) / t)) elif z <= 7.5e-139: tmp = x + ((y * z) / t) else: tmp = x + (z / (t / (y - x))) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -5.4e-135) tmp = Float64(x + Float64(z * Float64(Float64(y - x) / t))); elseif (z <= 7.5e-139) tmp = Float64(x + Float64(Float64(y * z) / t)); else tmp = Float64(x + Float64(z / Float64(t / Float64(y - x)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -5.4e-135) tmp = x + (z * ((y - x) / t)); elseif (z <= 7.5e-139) tmp = x + ((y * z) / t); else tmp = x + (z / (t / (y - x))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -5.4e-135], N[(x + N[(z * N[(N[(y - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 7.5e-139], N[(x + N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], N[(x + N[(z / N[(t / N[(y - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.4 \cdot 10^{-135}:\\
\;\;\;\;x + z \cdot \frac{y - x}{t}\\
\mathbf{elif}\;z \leq 7.5 \cdot 10^{-139}:\\
\;\;\;\;x + \frac{y \cdot z}{t}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{z}{\frac{t}{y - x}}\\
\end{array}
\end{array}
if z < -5.39999999999999997e-135Initial program 87.4%
associate-*l/99.8%
Simplified99.8%
if -5.39999999999999997e-135 < z < 7.5000000000000001e-139Initial program 98.5%
associate-*l/76.7%
Simplified76.7%
Taylor expanded in y around inf 98.5%
*-commutative98.5%
Simplified98.5%
if 7.5000000000000001e-139 < z Initial program 88.3%
associate-*l/98.7%
Simplified98.7%
*-commutative98.7%
clear-num98.7%
un-div-inv99.3%
Applied egg-rr99.3%
Final simplification99.3%
(FPCore (x y z t) :precision binary64 (if (or (<= x -8.2e+58) (not (<= x 8.5e+54))) (* x (- 1.0 (/ z t))) (+ x (* y (/ z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -8.2e+58) || !(x <= 8.5e+54)) {
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 ((x <= (-8.2d+58)) .or. (.not. (x <= 8.5d+54))) 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 ((x <= -8.2e+58) || !(x <= 8.5e+54)) {
tmp = x * (1.0 - (z / t));
} else {
tmp = x + (y * (z / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -8.2e+58) or not (x <= 8.5e+54): tmp = x * (1.0 - (z / t)) else: tmp = x + (y * (z / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -8.2e+58) || !(x <= 8.5e+54)) 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 ((x <= -8.2e+58) || ~((x <= 8.5e+54))) tmp = x * (1.0 - (z / t)); else tmp = x + (y * (z / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -8.2e+58], N[Not[LessEqual[x, 8.5e+54]], $MachinePrecision]], 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}\;x \leq -8.2 \cdot 10^{+58} \lor \neg \left(x \leq 8.5 \cdot 10^{+54}\right):\\
\;\;\;\;x \cdot \left(1 - \frac{z}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\end{array}
\end{array}
if x < -8.2e58 or 8.4999999999999995e54 < x Initial program 86.6%
associate-*l/91.4%
Simplified91.4%
Taylor expanded in x around inf 92.6%
mul-1-neg92.6%
unsub-neg92.6%
Simplified92.6%
if -8.2e58 < x < 8.4999999999999995e54Initial program 93.4%
associate-*l/93.9%
Simplified93.9%
Taylor expanded in y around inf 84.1%
associate-*r/89.3%
Simplified89.3%
Final simplification90.6%
(FPCore (x y z t) :precision binary64 (if (or (<= x -2e+56) (not (<= x 6.2e+52))) (* x (- 1.0 (/ z t))) (+ x (/ y (/ t z)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -2e+56) || !(x <= 6.2e+52)) {
tmp = x * (1.0 - (z / t));
} else {
tmp = x + (y / (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 <= (-2d+56)) .or. (.not. (x <= 6.2d+52))) then
tmp = x * (1.0d0 - (z / t))
else
tmp = x + (y / (t / z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -2e+56) || !(x <= 6.2e+52)) {
tmp = x * (1.0 - (z / t));
} else {
tmp = x + (y / (t / z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -2e+56) or not (x <= 6.2e+52): tmp = x * (1.0 - (z / t)) else: tmp = x + (y / (t / z)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -2e+56) || !(x <= 6.2e+52)) tmp = Float64(x * Float64(1.0 - Float64(z / t))); else tmp = Float64(x + Float64(y / Float64(t / z))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -2e+56) || ~((x <= 6.2e+52))) tmp = x * (1.0 - (z / t)); else tmp = x + (y / (t / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -2e+56], N[Not[LessEqual[x, 6.2e+52]], $MachinePrecision]], N[(x * N[(1.0 - N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2 \cdot 10^{+56} \lor \neg \left(x \leq 6.2 \cdot 10^{+52}\right):\\
\;\;\;\;x \cdot \left(1 - \frac{z}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{\frac{t}{z}}\\
\end{array}
\end{array}
if x < -2.00000000000000018e56 or 6.2e52 < x Initial program 86.6%
associate-*l/91.4%
Simplified91.4%
Taylor expanded in x around inf 92.6%
mul-1-neg92.6%
unsub-neg92.6%
Simplified92.6%
if -2.00000000000000018e56 < x < 6.2e52Initial program 93.4%
associate-*l/93.9%
Simplified93.9%
Taylor expanded in y around inf 84.1%
associate-*r/89.3%
Simplified89.3%
clear-num89.3%
un-div-inv89.4%
Applied egg-rr89.4%
Final simplification90.6%
(FPCore (x y z t) :precision binary64 (if (or (<= z -3.9e+63) (not (<= z 6e-32))) (* x (- (/ z t))) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -3.9e+63) || !(z <= 6e-32)) {
tmp = x * -(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 ((z <= (-3.9d+63)) .or. (.not. (z <= 6d-32))) then
tmp = x * -(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 ((z <= -3.9e+63) || !(z <= 6e-32)) {
tmp = x * -(z / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -3.9e+63) or not (z <= 6e-32): tmp = x * -(z / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -3.9e+63) || !(z <= 6e-32)) tmp = Float64(x * Float64(-Float64(z / t))); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -3.9e+63) || ~((z <= 6e-32))) tmp = x * -(z / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -3.9e+63], N[Not[LessEqual[z, 6e-32]], $MachinePrecision]], N[(x * (-N[(z / t), $MachinePrecision])), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.9 \cdot 10^{+63} \lor \neg \left(z \leq 6 \cdot 10^{-32}\right):\\
\;\;\;\;x \cdot \left(-\frac{z}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -3.9e63 or 6.0000000000000001e-32 < z Initial program 83.2%
associate-*l/99.1%
Simplified99.1%
*-commutative99.1%
clear-num99.0%
un-div-inv99.5%
Applied egg-rr99.5%
Taylor expanded in y around 0 49.0%
mul-1-neg49.0%
associate-/l*58.3%
Simplified58.3%
Taylor expanded in t around 0 40.1%
associate-*r/40.1%
mul-1-neg40.1%
distribute-rgt-neg-out40.1%
associate-*r/46.9%
Simplified46.9%
if -3.9e63 < z < 6.0000000000000001e-32Initial program 98.0%
associate-*l/87.2%
Simplified87.2%
Taylor expanded in t around inf 52.8%
Final simplification49.9%
(FPCore (x y z t) :precision binary64 (if (<= z -7.5e+62) (/ z (/ t (- x))) (if (<= z 4.6e-32) x (* x (- (/ z t))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -7.5e+62) {
tmp = z / (t / -x);
} else if (z <= 4.6e-32) {
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 <= (-7.5d+62)) then
tmp = z / (t / -x)
else if (z <= 4.6d-32) 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 <= -7.5e+62) {
tmp = z / (t / -x);
} else if (z <= 4.6e-32) {
tmp = x;
} else {
tmp = x * -(z / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -7.5e+62: tmp = z / (t / -x) elif z <= 4.6e-32: tmp = x else: tmp = x * -(z / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -7.5e+62) tmp = Float64(z / Float64(t / Float64(-x))); elseif (z <= 4.6e-32) tmp = x; else tmp = Float64(x * Float64(-Float64(z / t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -7.5e+62) tmp = z / (t / -x); elseif (z <= 4.6e-32) tmp = x; else tmp = x * -(z / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -7.5e+62], N[(z / N[(t / (-x)), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 4.6e-32], x, N[(x * (-N[(z / t), $MachinePrecision])), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.5 \cdot 10^{+62}:\\
\;\;\;\;\frac{z}{\frac{t}{-x}}\\
\mathbf{elif}\;z \leq 4.6 \cdot 10^{-32}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(-\frac{z}{t}\right)\\
\end{array}
\end{array}
if z < -7.49999999999999998e62Initial program 78.4%
associate-*l/99.8%
Simplified99.8%
*-commutative99.8%
clear-num99.8%
un-div-inv99.8%
Applied egg-rr99.8%
Taylor expanded in y around 0 39.7%
mul-1-neg39.7%
associate-/l*46.1%
Simplified46.1%
Taylor expanded in t around 0 33.6%
associate-*r/33.6%
mul-1-neg33.6%
distribute-rgt-neg-out33.6%
associate-*r/39.4%
Simplified39.4%
Taylor expanded in x around 0 33.6%
mul-1-neg33.6%
distribute-neg-frac33.6%
*-commutative33.6%
distribute-rgt-neg-in33.6%
associate-/l*43.2%
Simplified43.2%
if -7.49999999999999998e62 < z < 4.6000000000000001e-32Initial program 98.0%
associate-*l/87.2%
Simplified87.2%
Taylor expanded in t around inf 52.8%
if 4.6000000000000001e-32 < z Initial program 86.3%
associate-*l/98.6%
Simplified98.6%
*-commutative98.6%
clear-num98.6%
un-div-inv99.3%
Applied egg-rr99.3%
Taylor expanded in y around 0 54.9%
mul-1-neg54.9%
associate-/l*66.1%
Simplified66.1%
Taylor expanded in t around 0 44.3%
associate-*r/44.3%
mul-1-neg44.3%
distribute-rgt-neg-out44.3%
associate-*r/51.6%
Simplified51.6%
Final simplification50.6%
(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.8%
associate-/l*97.7%
Simplified97.7%
Final simplification97.7%
(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 90.8%
associate-*l/92.9%
Simplified92.9%
Taylor expanded in x around inf 59.1%
mul-1-neg59.1%
unsub-neg59.1%
Simplified59.1%
Final simplification59.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 90.8%
associate-*l/92.9%
Simplified92.9%
Taylor expanded in t around inf 33.9%
Final simplification33.9%
(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 2023308
(FPCore (x y z t)
:name "Numeric.Histogram:binBounds from Chart-1.5.3"
:precision binary64
:herbie-target
(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)))))
(+ x (/ (* (- y x) z) t)))