
(FPCore (x y z t) :precision binary64 (+ x (/ (* y (- z x)) t)))
double code(double x, double y, double z, double t) {
return x + ((y * (z - x)) / 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 * (z - x)) / t)
end function
public static double code(double x, double y, double z, double t) {
return x + ((y * (z - x)) / t);
}
def code(x, y, z, t): return x + ((y * (z - x)) / t)
function code(x, y, z, t) return Float64(x + Float64(Float64(y * Float64(z - x)) / t)) end
function tmp = code(x, y, z, t) tmp = x + ((y * (z - x)) / t); end
code[x_, y_, z_, t_] := N[(x + N[(N[(y * N[(z - x), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y \cdot \left(z - x\right)}{t}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (+ x (/ (* y (- z x)) t)))
double code(double x, double y, double z, double t) {
return x + ((y * (z - x)) / 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 * (z - x)) / t)
end function
public static double code(double x, double y, double z, double t) {
return x + ((y * (z - x)) / t);
}
def code(x, y, z, t): return x + ((y * (z - x)) / t)
function code(x, y, z, t) return Float64(x + Float64(Float64(y * Float64(z - x)) / t)) end
function tmp = code(x, y, z, t) tmp = x + ((y * (z - x)) / t); end
code[x_, y_, z_, t_] := N[(x + N[(N[(y * N[(z - x), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y \cdot \left(z - x\right)}{t}
\end{array}
(FPCore (x y z t) :precision binary64 (+ x (/ (- z x) (/ t y))))
double code(double x, double y, double z, double t) {
return x + ((z - x) / (t / y));
}
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 - x) / (t / y))
end function
public static double code(double x, double y, double z, double t) {
return x + ((z - x) / (t / y));
}
def code(x, y, z, t): return x + ((z - x) / (t / y))
function code(x, y, z, t) return Float64(x + Float64(Float64(z - x) / Float64(t / y))) end
function tmp = code(x, y, z, t) tmp = x + ((z - x) / (t / y)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(z - x), $MachinePrecision] / N[(t / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{z - x}{\frac{t}{y}}
\end{array}
Initial program 93.2%
associate-*l/96.2%
Simplified96.2%
*-commutative96.2%
clear-num96.2%
un-div-inv96.3%
Applied egg-rr96.3%
Final simplification96.3%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.25e-54) (not (<= z 1.45e-82))) (+ x (* z (/ y t))) (* x (- 1.0 (/ y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.25e-54) || !(z <= 1.45e-82)) {
tmp = x + (z * (y / t));
} else {
tmp = x * (1.0 - (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.25d-54)) .or. (.not. (z <= 1.45d-82))) then
tmp = x + (z * (y / t))
else
tmp = x * (1.0d0 - (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.25e-54) || !(z <= 1.45e-82)) {
tmp = x + (z * (y / t));
} else {
tmp = x * (1.0 - (y / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.25e-54) or not (z <= 1.45e-82): tmp = x + (z * (y / t)) else: tmp = x * (1.0 - (y / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.25e-54) || !(z <= 1.45e-82)) tmp = Float64(x + Float64(z * Float64(y / t))); else tmp = Float64(x * Float64(1.0 - Float64(y / t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -1.25e-54) || ~((z <= 1.45e-82))) tmp = x + (z * (y / t)); else tmp = x * (1.0 - (y / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.25e-54], N[Not[LessEqual[z, 1.45e-82]], $MachinePrecision]], N[(x + N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.25 \cdot 10^{-54} \lor \neg \left(z \leq 1.45 \cdot 10^{-82}\right):\\
\;\;\;\;x + z \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\end{array}
\end{array}
if z < -1.25000000000000004e-54 or 1.44999999999999989e-82 < z Initial program 91.6%
associate-*l/95.4%
Simplified95.4%
Taylor expanded in z around inf 85.6%
associate-*l/86.8%
*-commutative86.8%
Simplified86.8%
if -1.25000000000000004e-54 < z < 1.44999999999999989e-82Initial program 95.3%
associate-*l/97.3%
Simplified97.3%
Taylor expanded in z around 0 90.1%
associate-*r/91.9%
neg-mul-191.9%
distribute-rgt-neg-in91.9%
Simplified91.9%
Taylor expanded in x around 0 91.9%
mul-1-neg91.9%
sub-neg91.9%
Simplified91.9%
Final simplification89.0%
(FPCore (x y z t) :precision binary64 (if (or (<= z -9.2e-63) (not (<= z 1.3e-83))) (+ x (/ y (/ t z))) (* x (- 1.0 (/ y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -9.2e-63) || !(z <= 1.3e-83)) {
tmp = x + (y / (t / z));
} else {
tmp = x * (1.0 - (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 <= (-9.2d-63)) .or. (.not. (z <= 1.3d-83))) then
tmp = x + (y / (t / z))
else
tmp = x * (1.0d0 - (y / t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -9.2e-63) || !(z <= 1.3e-83)) {
tmp = x + (y / (t / z));
} else {
tmp = x * (1.0 - (y / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -9.2e-63) or not (z <= 1.3e-83): tmp = x + (y / (t / z)) else: tmp = x * (1.0 - (y / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -9.2e-63) || !(z <= 1.3e-83)) tmp = Float64(x + Float64(y / Float64(t / z))); else tmp = Float64(x * Float64(1.0 - Float64(y / t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -9.2e-63) || ~((z <= 1.3e-83))) tmp = x + (y / (t / z)); else tmp = x * (1.0 - (y / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -9.2e-63], N[Not[LessEqual[z, 1.3e-83]], $MachinePrecision]], N[(x + N[(y / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -9.2 \cdot 10^{-63} \lor \neg \left(z \leq 1.3 \cdot 10^{-83}\right):\\
\;\;\;\;x + \frac{y}{\frac{t}{z}}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\end{array}
\end{array}
if z < -9.2e-63 or 1.30000000000000004e-83 < z Initial program 91.6%
associate-/l*94.8%
Simplified94.8%
Taylor expanded in z around inf 88.2%
if -9.2e-63 < z < 1.30000000000000004e-83Initial program 95.3%
associate-*l/97.3%
Simplified97.3%
Taylor expanded in z around 0 90.1%
associate-*r/91.9%
neg-mul-191.9%
distribute-rgt-neg-in91.9%
Simplified91.9%
Taylor expanded in x around 0 91.9%
mul-1-neg91.9%
sub-neg91.9%
Simplified91.9%
Final simplification89.7%
(FPCore (x y z t) :precision binary64 (if (<= z -7.5e-52) (+ x (/ y (/ t z))) (if (<= z 1.12e-82) (* x (- 1.0 (/ y t))) (+ x (/ (* z y) t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -7.5e-52) {
tmp = x + (y / (t / z));
} else if (z <= 1.12e-82) {
tmp = x * (1.0 - (y / t));
} else {
tmp = x + ((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 <= (-7.5d-52)) then
tmp = x + (y / (t / z))
else if (z <= 1.12d-82) then
tmp = x * (1.0d0 - (y / t))
else
tmp = x + ((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 <= -7.5e-52) {
tmp = x + (y / (t / z));
} else if (z <= 1.12e-82) {
tmp = x * (1.0 - (y / t));
} else {
tmp = x + ((z * y) / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -7.5e-52: tmp = x + (y / (t / z)) elif z <= 1.12e-82: tmp = x * (1.0 - (y / t)) else: tmp = x + ((z * y) / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -7.5e-52) tmp = Float64(x + Float64(y / Float64(t / z))); elseif (z <= 1.12e-82) tmp = Float64(x * Float64(1.0 - Float64(y / t))); else tmp = Float64(x + Float64(Float64(z * y) / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -7.5e-52) tmp = x + (y / (t / z)); elseif (z <= 1.12e-82) tmp = x * (1.0 - (y / t)); else tmp = x + ((z * y) / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -7.5e-52], N[(x + N[(y / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.12e-82], N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(z * y), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.5 \cdot 10^{-52}:\\
\;\;\;\;x + \frac{y}{\frac{t}{z}}\\
\mathbf{elif}\;z \leq 1.12 \cdot 10^{-82}:\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;x + \frac{z \cdot y}{t}\\
\end{array}
\end{array}
if z < -7.50000000000000006e-52Initial program 87.8%
associate-/l*95.8%
Simplified95.8%
Taylor expanded in z around inf 90.1%
if -7.50000000000000006e-52 < z < 1.12e-82Initial program 95.3%
associate-*l/97.3%
Simplified97.3%
Taylor expanded in z around 0 90.1%
associate-*r/91.9%
neg-mul-191.9%
distribute-rgt-neg-in91.9%
Simplified91.9%
Taylor expanded in x around 0 91.9%
mul-1-neg91.9%
sub-neg91.9%
Simplified91.9%
if 1.12e-82 < z Initial program 95.0%
associate-*l/93.8%
Simplified93.8%
Taylor expanded in z around inf 87.5%
Final simplification90.1%
(FPCore (x y z t) :precision binary64 (if (<= z -3.1e-57) (+ x (/ y (/ t z))) (if (<= z 9.5e-84) (- x (* y (/ x t))) (+ x (/ (* z y) t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -3.1e-57) {
tmp = x + (y / (t / z));
} else if (z <= 9.5e-84) {
tmp = x - (y * (x / t));
} else {
tmp = x + ((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 <= (-3.1d-57)) then
tmp = x + (y / (t / z))
else if (z <= 9.5d-84) then
tmp = x - (y * (x / t))
else
tmp = x + ((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 <= -3.1e-57) {
tmp = x + (y / (t / z));
} else if (z <= 9.5e-84) {
tmp = x - (y * (x / t));
} else {
tmp = x + ((z * y) / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -3.1e-57: tmp = x + (y / (t / z)) elif z <= 9.5e-84: tmp = x - (y * (x / t)) else: tmp = x + ((z * y) / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -3.1e-57) tmp = Float64(x + Float64(y / Float64(t / z))); elseif (z <= 9.5e-84) tmp = Float64(x - Float64(y * Float64(x / t))); else tmp = Float64(x + Float64(Float64(z * y) / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -3.1e-57) tmp = x + (y / (t / z)); elseif (z <= 9.5e-84) tmp = x - (y * (x / t)); else tmp = x + ((z * y) / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -3.1e-57], N[(x + N[(y / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 9.5e-84], N[(x - N[(y * N[(x / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(z * y), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.1 \cdot 10^{-57}:\\
\;\;\;\;x + \frac{y}{\frac{t}{z}}\\
\mathbf{elif}\;z \leq 9.5 \cdot 10^{-84}:\\
\;\;\;\;x - y \cdot \frac{x}{t}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{z \cdot y}{t}\\
\end{array}
\end{array}
if z < -3.09999999999999976e-57Initial program 87.8%
associate-/l*95.8%
Simplified95.8%
Taylor expanded in z around inf 90.1%
if -3.09999999999999976e-57 < z < 9.49999999999999941e-84Initial program 95.3%
associate-*l/97.3%
Simplified97.3%
Taylor expanded in z around 0 90.1%
associate-*r/91.9%
neg-mul-191.9%
distribute-rgt-neg-in91.9%
Simplified91.9%
*-commutative91.9%
*-commutative91.9%
distribute-rgt-neg-out91.9%
clear-num91.8%
div-inv91.9%
unsub-neg91.9%
associate-/r/91.9%
Applied egg-rr91.9%
if 9.49999999999999941e-84 < z Initial program 95.0%
associate-*l/93.8%
Simplified93.8%
Taylor expanded in z around inf 87.5%
Final simplification90.1%
(FPCore (x y z t) :precision binary64 (if (<= z -2.8e-52) (+ x (/ y (/ t z))) (if (<= z 1.35e-83) (- x (/ x (/ t y))) (+ x (/ (* z y) t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -2.8e-52) {
tmp = x + (y / (t / z));
} else if (z <= 1.35e-83) {
tmp = x - (x / (t / y));
} else {
tmp = x + ((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 <= (-2.8d-52)) then
tmp = x + (y / (t / z))
else if (z <= 1.35d-83) then
tmp = x - (x / (t / y))
else
tmp = x + ((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 <= -2.8e-52) {
tmp = x + (y / (t / z));
} else if (z <= 1.35e-83) {
tmp = x - (x / (t / y));
} else {
tmp = x + ((z * y) / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -2.8e-52: tmp = x + (y / (t / z)) elif z <= 1.35e-83: tmp = x - (x / (t / y)) else: tmp = x + ((z * y) / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -2.8e-52) tmp = Float64(x + Float64(y / Float64(t / z))); elseif (z <= 1.35e-83) tmp = Float64(x - Float64(x / Float64(t / y))); else tmp = Float64(x + Float64(Float64(z * y) / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -2.8e-52) tmp = x + (y / (t / z)); elseif (z <= 1.35e-83) tmp = x - (x / (t / y)); else tmp = x + ((z * y) / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -2.8e-52], N[(x + N[(y / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.35e-83], N[(x - N[(x / N[(t / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(z * y), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.8 \cdot 10^{-52}:\\
\;\;\;\;x + \frac{y}{\frac{t}{z}}\\
\mathbf{elif}\;z \leq 1.35 \cdot 10^{-83}:\\
\;\;\;\;x - \frac{x}{\frac{t}{y}}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{z \cdot y}{t}\\
\end{array}
\end{array}
if z < -2.79999999999999995e-52Initial program 87.8%
associate-/l*95.8%
Simplified95.8%
Taylor expanded in z around inf 90.1%
if -2.79999999999999995e-52 < z < 1.34999999999999996e-83Initial program 95.3%
associate-*l/97.3%
Simplified97.3%
Taylor expanded in z around 0 90.1%
mul-1-neg90.1%
associate-/l*91.9%
Simplified91.9%
if 1.34999999999999996e-83 < z Initial program 95.0%
associate-*l/93.8%
Simplified93.8%
Taylor expanded in z around inf 87.5%
Final simplification90.1%
(FPCore (x y z t) :precision binary64 (if (or (<= y -7.5e+32) (not (<= y 1650000000000.0))) (* x (/ (- y) t)) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -7.5e+32) || !(y <= 1650000000000.0)) {
tmp = x * (-y / 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 ((y <= (-7.5d+32)) .or. (.not. (y <= 1650000000000.0d0))) then
tmp = x * (-y / 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 ((y <= -7.5e+32) || !(y <= 1650000000000.0)) {
tmp = x * (-y / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -7.5e+32) or not (y <= 1650000000000.0): tmp = x * (-y / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -7.5e+32) || !(y <= 1650000000000.0)) tmp = Float64(x * Float64(Float64(-y) / t)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -7.5e+32) || ~((y <= 1650000000000.0))) tmp = x * (-y / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -7.5e+32], N[Not[LessEqual[y, 1650000000000.0]], $MachinePrecision]], N[(x * N[((-y) / t), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7.5 \cdot 10^{+32} \lor \neg \left(y \leq 1650000000000\right):\\
\;\;\;\;x \cdot \frac{-y}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -7.49999999999999959e32 or 1.65e12 < y Initial program 87.1%
associate-*l/97.3%
Simplified97.3%
Taylor expanded in z around 0 53.1%
associate-*r/60.1%
neg-mul-160.1%
distribute-rgt-neg-in60.1%
Simplified60.1%
*-commutative60.1%
*-commutative60.1%
distribute-rgt-neg-out60.1%
clear-num60.0%
div-inv60.1%
unsub-neg60.1%
associate-/r/59.3%
Applied egg-rr59.3%
Taylor expanded in x around 0 53.1%
*-commutative53.1%
associate-/l*59.2%
Simplified59.2%
Taylor expanded in y around inf 48.8%
mul-1-neg48.8%
associate-*r/51.3%
distribute-rgt-neg-in51.3%
distribute-neg-frac51.3%
Simplified51.3%
if -7.49999999999999959e32 < y < 1.65e12Initial program 97.8%
associate-*l/95.4%
Simplified95.4%
Taylor expanded in z around 0 69.6%
associate-*r/71.0%
neg-mul-171.0%
distribute-rgt-neg-in71.0%
Simplified71.0%
Taylor expanded in y around 0 56.8%
Final simplification54.4%
(FPCore (x y z t) :precision binary64 (+ x (* (- z x) (/ y t))))
double code(double x, double y, double z, double t) {
return x + ((z - x) * (y / 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 + ((z - x) * (y / t))
end function
public static double code(double x, double y, double z, double t) {
return x + ((z - x) * (y / t));
}
def code(x, y, z, t): return x + ((z - x) * (y / t))
function code(x, y, z, t) return Float64(x + Float64(Float64(z - x) * Float64(y / t))) end
function tmp = code(x, y, z, t) tmp = x + ((z - x) * (y / t)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(z - x), $MachinePrecision] * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(z - x\right) \cdot \frac{y}{t}
\end{array}
Initial program 93.2%
associate-*l/96.2%
Simplified96.2%
Final simplification96.2%
(FPCore (x y z t) :precision binary64 (* x (- 1.0 (/ y t))))
double code(double x, double y, double z, double t) {
return x * (1.0 - (y / 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 - (y / t))
end function
public static double code(double x, double y, double z, double t) {
return x * (1.0 - (y / t));
}
def code(x, y, z, t): return x * (1.0 - (y / t))
function code(x, y, z, t) return Float64(x * Float64(1.0 - Float64(y / t))) end
function tmp = code(x, y, z, t) tmp = x * (1.0 - (y / t)); end
code[x_, y_, z_, t_] := N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(1 - \frac{y}{t}\right)
\end{array}
Initial program 93.2%
associate-*l/96.2%
Simplified96.2%
Taylor expanded in z around 0 62.5%
associate-*r/66.2%
neg-mul-166.2%
distribute-rgt-neg-in66.2%
Simplified66.2%
Taylor expanded in x around 0 66.2%
mul-1-neg66.2%
sub-neg66.2%
Simplified66.2%
Final simplification66.2%
(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 93.2%
associate-*l/96.2%
Simplified96.2%
Taylor expanded in z around 0 62.5%
associate-*r/66.2%
neg-mul-166.2%
distribute-rgt-neg-in66.2%
Simplified66.2%
Taylor expanded in y around 0 37.2%
Final simplification37.2%
(FPCore (x y z t) :precision binary64 (- x (+ (* x (/ y t)) (* (- z) (/ y t)))))
double code(double x, double y, double z, double t) {
return x - ((x * (y / t)) + (-z * (y / 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 - ((x * (y / t)) + (-z * (y / t)))
end function
public static double code(double x, double y, double z, double t) {
return x - ((x * (y / t)) + (-z * (y / t)));
}
def code(x, y, z, t): return x - ((x * (y / t)) + (-z * (y / t)))
function code(x, y, z, t) return Float64(x - Float64(Float64(x * Float64(y / t)) + Float64(Float64(-z) * Float64(y / t)))) end
function tmp = code(x, y, z, t) tmp = x - ((x * (y / t)) + (-z * (y / t))); end
code[x_, y_, z_, t_] := N[(x - N[(N[(x * N[(y / t), $MachinePrecision]), $MachinePrecision] + N[((-z) * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - \left(x \cdot \frac{y}{t} + \left(-z\right) \cdot \frac{y}{t}\right)
\end{array}
herbie shell --seed 2023318
(FPCore (x y z t)
:name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, D"
:precision binary64
:herbie-target
(- x (+ (* x (/ y t)) (* (- z) (/ y t))))
(+ x (/ (* y (- z x)) t)))