
(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 92.3%
associate-*l/98.4%
Simplified98.4%
*-commutative98.4%
clear-num98.1%
un-div-inv98.5%
Applied egg-rr98.5%
Final simplification98.5%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (- 1.0 (/ y t)))))
(if (<= x -1e+70)
t_1
(if (<= x -1.25e-130)
(+ x (* z (/ y t)))
(if (<= x -2.25e-185)
(/ y (/ t (- z x)))
(if (<= x 620.0) (+ x (/ y (/ t z))) t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = x * (1.0 - (y / t));
double tmp;
if (x <= -1e+70) {
tmp = t_1;
} else if (x <= -1.25e-130) {
tmp = x + (z * (y / t));
} else if (x <= -2.25e-185) {
tmp = y / (t / (z - x));
} else if (x <= 620.0) {
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 - (y / t))
if (x <= (-1d+70)) then
tmp = t_1
else if (x <= (-1.25d-130)) then
tmp = x + (z * (y / t))
else if (x <= (-2.25d-185)) then
tmp = y / (t / (z - x))
else if (x <= 620.0d0) 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 - (y / t));
double tmp;
if (x <= -1e+70) {
tmp = t_1;
} else if (x <= -1.25e-130) {
tmp = x + (z * (y / t));
} else if (x <= -2.25e-185) {
tmp = y / (t / (z - x));
} else if (x <= 620.0) {
tmp = x + (y / (t / z));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (1.0 - (y / t)) tmp = 0 if x <= -1e+70: tmp = t_1 elif x <= -1.25e-130: tmp = x + (z * (y / t)) elif x <= -2.25e-185: tmp = y / (t / (z - x)) elif x <= 620.0: 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(y / t))) tmp = 0.0 if (x <= -1e+70) tmp = t_1; elseif (x <= -1.25e-130) tmp = Float64(x + Float64(z * Float64(y / t))); elseif (x <= -2.25e-185) tmp = Float64(y / Float64(t / Float64(z - x))); elseif (x <= 620.0) 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 - (y / t)); tmp = 0.0; if (x <= -1e+70) tmp = t_1; elseif (x <= -1.25e-130) tmp = x + (z * (y / t)); elseif (x <= -2.25e-185) tmp = y / (t / (z - x)); elseif (x <= 620.0) 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[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1e+70], t$95$1, If[LessEqual[x, -1.25e-130], N[(x + N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -2.25e-185], N[(y / N[(t / N[(z - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 620.0], 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{y}{t}\right)\\
\mathbf{if}\;x \leq -1 \cdot 10^{+70}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -1.25 \cdot 10^{-130}:\\
\;\;\;\;x + z \cdot \frac{y}{t}\\
\mathbf{elif}\;x \leq -2.25 \cdot 10^{-185}:\\
\;\;\;\;\frac{y}{\frac{t}{z - x}}\\
\mathbf{elif}\;x \leq 620:\\
\;\;\;\;x + \frac{y}{\frac{t}{z}}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if x < -1.00000000000000007e70 or 620 < x Initial program 90.6%
associate-*l/99.9%
Simplified99.9%
Taylor expanded in x around inf 89.2%
mul-1-neg89.2%
unsub-neg89.2%
Simplified89.2%
if -1.00000000000000007e70 < x < -1.2499999999999999e-130Initial program 95.0%
associate-*l/99.7%
Simplified99.7%
Taylor expanded in z around inf 82.9%
associate-*l/90.1%
*-commutative90.1%
Simplified90.1%
if -1.2499999999999999e-130 < x < -2.2500000000000001e-185Initial program 89.9%
associate-*l/99.7%
Simplified99.7%
Taylor expanded in y around inf 87.8%
*-commutative87.8%
sub-div87.8%
associate-/r/87.5%
Applied egg-rr87.5%
Taylor expanded in z around 0 81.6%
+-commutative81.6%
*-commutative81.6%
associate-*r/80.8%
metadata-eval80.8%
associate-*r/81.5%
cancel-sign-sub-inv81.5%
*-lft-identity81.5%
distribute-rgt-out--87.7%
associate-*l/81.6%
associate-/l*87.6%
Simplified87.6%
if -2.2500000000000001e-185 < x < 620Initial program 94.1%
associate-/l*96.4%
Simplified96.4%
Taylor expanded in z around inf 90.4%
Final simplification89.6%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (- 1.0 (/ y t)))))
(if (<= x -1.62e+69)
t_1
(if (<= x -1.15e-130)
(+ x (* z (/ y t)))
(if (<= x -4.7e-185)
(* y (- (/ z t) (/ x t)))
(if (<= x 1950.0) (+ x (/ y (/ t z))) t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = x * (1.0 - (y / t));
double tmp;
if (x <= -1.62e+69) {
tmp = t_1;
} else if (x <= -1.15e-130) {
tmp = x + (z * (y / t));
} else if (x <= -4.7e-185) {
tmp = y * ((z / t) - (x / t));
} else if (x <= 1950.0) {
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 - (y / t))
if (x <= (-1.62d+69)) then
tmp = t_1
else if (x <= (-1.15d-130)) then
tmp = x + (z * (y / t))
else if (x <= (-4.7d-185)) then
tmp = y * ((z / t) - (x / t))
else if (x <= 1950.0d0) 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 - (y / t));
double tmp;
if (x <= -1.62e+69) {
tmp = t_1;
} else if (x <= -1.15e-130) {
tmp = x + (z * (y / t));
} else if (x <= -4.7e-185) {
tmp = y * ((z / t) - (x / t));
} else if (x <= 1950.0) {
tmp = x + (y / (t / z));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (1.0 - (y / t)) tmp = 0 if x <= -1.62e+69: tmp = t_1 elif x <= -1.15e-130: tmp = x + (z * (y / t)) elif x <= -4.7e-185: tmp = y * ((z / t) - (x / t)) elif x <= 1950.0: 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(y / t))) tmp = 0.0 if (x <= -1.62e+69) tmp = t_1; elseif (x <= -1.15e-130) tmp = Float64(x + Float64(z * Float64(y / t))); elseif (x <= -4.7e-185) tmp = Float64(y * Float64(Float64(z / t) - Float64(x / t))); elseif (x <= 1950.0) 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 - (y / t)); tmp = 0.0; if (x <= -1.62e+69) tmp = t_1; elseif (x <= -1.15e-130) tmp = x + (z * (y / t)); elseif (x <= -4.7e-185) tmp = y * ((z / t) - (x / t)); elseif (x <= 1950.0) 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[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.62e+69], t$95$1, If[LessEqual[x, -1.15e-130], N[(x + N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -4.7e-185], N[(y * N[(N[(z / t), $MachinePrecision] - N[(x / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1950.0], 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{y}{t}\right)\\
\mathbf{if}\;x \leq -1.62 \cdot 10^{+69}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -1.15 \cdot 10^{-130}:\\
\;\;\;\;x + z \cdot \frac{y}{t}\\
\mathbf{elif}\;x \leq -4.7 \cdot 10^{-185}:\\
\;\;\;\;y \cdot \left(\frac{z}{t} - \frac{x}{t}\right)\\
\mathbf{elif}\;x \leq 1950:\\
\;\;\;\;x + \frac{y}{\frac{t}{z}}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if x < -1.62e69 or 1950 < x Initial program 90.6%
associate-*l/99.9%
Simplified99.9%
Taylor expanded in x around inf 89.2%
mul-1-neg89.2%
unsub-neg89.2%
Simplified89.2%
if -1.62e69 < x < -1.1500000000000001e-130Initial program 95.0%
associate-*l/99.7%
Simplified99.7%
Taylor expanded in z around inf 82.9%
associate-*l/90.1%
*-commutative90.1%
Simplified90.1%
if -1.1500000000000001e-130 < x < -4.7000000000000002e-185Initial program 89.9%
associate-*l/99.7%
Simplified99.7%
Taylor expanded in y around inf 87.8%
if -4.7000000000000002e-185 < x < 1950Initial program 94.1%
associate-/l*96.4%
Simplified96.4%
Taylor expanded in z around inf 90.4%
Final simplification89.6%
(FPCore (x y z t) :precision binary64 (if (or (<= x -2.4e+69) (not (<= x 4.4))) (* x (- 1.0 (/ y t))) (+ x (* z (/ y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -2.4e+69) || !(x <= 4.4)) {
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 ((x <= (-2.4d+69)) .or. (.not. (x <= 4.4d0))) 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 ((x <= -2.4e+69) || !(x <= 4.4)) {
tmp = x * (1.0 - (y / t));
} else {
tmp = x + (z * (y / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -2.4e+69) or not (x <= 4.4): tmp = x * (1.0 - (y / t)) else: tmp = x + (z * (y / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -2.4e+69) || !(x <= 4.4)) tmp = Float64(x * Float64(1.0 - Float64(y / t))); else tmp = Float64(x + Float64(z * Float64(y / t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -2.4e+69) || ~((x <= 4.4))) tmp = x * (1.0 - (y / t)); else tmp = x + (z * (y / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -2.4e+69], N[Not[LessEqual[x, 4.4]], $MachinePrecision]], N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.4 \cdot 10^{+69} \lor \neg \left(x \leq 4.4\right):\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \frac{y}{t}\\
\end{array}
\end{array}
if x < -2.4000000000000002e69 or 4.4000000000000004 < x Initial program 90.6%
associate-*l/99.9%
Simplified99.9%
Taylor expanded in x around inf 89.2%
mul-1-neg89.2%
unsub-neg89.2%
Simplified89.2%
if -2.4000000000000002e69 < x < 4.4000000000000004Initial program 93.9%
associate-*l/97.1%
Simplified97.1%
Taylor expanded in z around inf 82.8%
associate-*l/85.8%
*-commutative85.8%
Simplified85.8%
Final simplification87.4%
(FPCore (x y z t) :precision binary64 (if (<= z -1.2e+171) (* y (/ z t)) (if (<= z 7.2e+158) (* x (- 1.0 (/ y t))) (/ z (/ t y)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.2e+171) {
tmp = y * (z / t);
} else if (z <= 7.2e+158) {
tmp = x * (1.0 - (y / 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 (z <= (-1.2d+171)) then
tmp = y * (z / t)
else if (z <= 7.2d+158) then
tmp = x * (1.0d0 - (y / 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 (z <= -1.2e+171) {
tmp = y * (z / t);
} else if (z <= 7.2e+158) {
tmp = x * (1.0 - (y / t));
} else {
tmp = z / (t / y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.2e+171: tmp = y * (z / t) elif z <= 7.2e+158: tmp = x * (1.0 - (y / t)) else: tmp = z / (t / y) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.2e+171) tmp = Float64(y * Float64(z / t)); elseif (z <= 7.2e+158) tmp = Float64(x * Float64(1.0 - Float64(y / t))); else tmp = Float64(z / Float64(t / y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -1.2e+171) tmp = y * (z / t); elseif (z <= 7.2e+158) tmp = x * (1.0 - (y / t)); else tmp = z / (t / y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.2e+171], N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 7.2e+158], N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(z / N[(t / y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.2 \cdot 10^{+171}:\\
\;\;\;\;y \cdot \frac{z}{t}\\
\mathbf{elif}\;z \leq 7.2 \cdot 10^{+158}:\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{z}{\frac{t}{y}}\\
\end{array}
\end{array}
if z < -1.19999999999999999e171Initial program 88.6%
associate-*l/96.8%
Simplified96.8%
Taylor expanded in y around inf 76.0%
Taylor expanded in z around inf 73.4%
if -1.19999999999999999e171 < z < 7.19999999999999976e158Initial program 92.6%
associate-*l/98.4%
Simplified98.4%
Taylor expanded in x around inf 80.3%
mul-1-neg80.3%
unsub-neg80.3%
Simplified80.3%
if 7.19999999999999976e158 < z Initial program 94.3%
associate-*l/99.8%
Simplified99.8%
Taylor expanded in y around inf 53.5%
Taylor expanded in z around inf 53.8%
associate-*r/67.9%
associate-/l*53.8%
Applied egg-rr53.8%
associate-/r/70.2%
clear-num70.2%
associate-*l/70.4%
*-un-lft-identity70.4%
add-cube-cbrt69.8%
*-un-lft-identity69.8%
times-frac69.8%
pow269.8%
Applied egg-rr69.8%
/-rgt-identity69.8%
associate-*r/69.8%
unpow269.8%
rem-3cbrt-lft70.4%
Simplified70.4%
Final simplification78.1%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.65e+33) (not (<= z 3e-18))) (* y (/ z t)) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.65e+33) || !(z <= 3e-18)) {
tmp = y * (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 <= (-1.65d+33)) .or. (.not. (z <= 3d-18))) then
tmp = y * (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 <= -1.65e+33) || !(z <= 3e-18)) {
tmp = y * (z / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.65e+33) or not (z <= 3e-18): tmp = y * (z / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.65e+33) || !(z <= 3e-18)) tmp = Float64(y * Float64(z / t)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -1.65e+33) || ~((z <= 3e-18))) tmp = y * (z / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.65e+33], N[Not[LessEqual[z, 3e-18]], $MachinePrecision]], N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.65 \cdot 10^{+33} \lor \neg \left(z \leq 3 \cdot 10^{-18}\right):\\
\;\;\;\;y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -1.64999999999999988e33 or 2.99999999999999983e-18 < z Initial program 88.9%
associate-*l/98.5%
Simplified98.5%
Taylor expanded in y around inf 65.1%
Taylor expanded in z around inf 56.2%
if -1.64999999999999988e33 < z < 2.99999999999999983e-18Initial program 95.8%
associate-*l/98.4%
Simplified98.4%
Taylor expanded in y around 0 55.1%
Final simplification55.7%
(FPCore (x y z t) :precision binary64 (if (<= z -4.7e+36) (* y (/ z t)) (if (<= z 3.4e-18) x (* z (/ y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -4.7e+36) {
tmp = y * (z / t);
} else if (z <= 3.4e-18) {
tmp = x;
} else {
tmp = z * (y / t);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= (-4.7d+36)) then
tmp = y * (z / t)
else if (z <= 3.4d-18) then
tmp = x
else
tmp = z * (y / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -4.7e+36) {
tmp = y * (z / t);
} else if (z <= 3.4e-18) {
tmp = x;
} else {
tmp = z * (y / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -4.7e+36: tmp = y * (z / t) elif z <= 3.4e-18: tmp = x else: tmp = z * (y / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -4.7e+36) tmp = Float64(y * Float64(z / t)); elseif (z <= 3.4e-18) tmp = x; else tmp = Float64(z * Float64(y / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -4.7e+36) tmp = y * (z / t); elseif (z <= 3.4e-18) tmp = x; else tmp = z * (y / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -4.7e+36], N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.4e-18], x, N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.7 \cdot 10^{+36}:\\
\;\;\;\;y \cdot \frac{z}{t}\\
\mathbf{elif}\;z \leq 3.4 \cdot 10^{-18}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;z \cdot \frac{y}{t}\\
\end{array}
\end{array}
if z < -4.69999999999999989e36Initial program 89.6%
associate-*l/97.1%
Simplified97.1%
Taylor expanded in y around inf 69.4%
Taylor expanded in z around inf 61.8%
if -4.69999999999999989e36 < z < 3.40000000000000001e-18Initial program 95.8%
associate-*l/98.4%
Simplified98.4%
Taylor expanded in y around 0 55.1%
if 3.40000000000000001e-18 < z Initial program 88.1%
associate-*l/99.8%
Simplified99.8%
Taylor expanded in y around inf 60.8%
Taylor expanded in z around inf 50.7%
associate-*r/55.1%
associate-/l*50.8%
Applied egg-rr50.8%
associate-/r/59.2%
Applied egg-rr59.2%
Final simplification57.8%
(FPCore (x y z t) :precision binary64 (if (<= z -4.7e+33) (* y (/ z t)) (if (<= z 1.15e-18) x (/ z (/ t y)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -4.7e+33) {
tmp = y * (z / t);
} else if (z <= 1.15e-18) {
tmp = x;
} 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 (z <= (-4.7d+33)) then
tmp = y * (z / t)
else if (z <= 1.15d-18) then
tmp = x
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 (z <= -4.7e+33) {
tmp = y * (z / t);
} else if (z <= 1.15e-18) {
tmp = x;
} else {
tmp = z / (t / y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -4.7e+33: tmp = y * (z / t) elif z <= 1.15e-18: tmp = x else: tmp = z / (t / y) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -4.7e+33) tmp = Float64(y * Float64(z / t)); elseif (z <= 1.15e-18) tmp = x; else tmp = Float64(z / Float64(t / y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -4.7e+33) tmp = y * (z / t); elseif (z <= 1.15e-18) tmp = x; else tmp = z / (t / y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -4.7e+33], N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.15e-18], x, N[(z / N[(t / y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.7 \cdot 10^{+33}:\\
\;\;\;\;y \cdot \frac{z}{t}\\
\mathbf{elif}\;z \leq 1.15 \cdot 10^{-18}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;\frac{z}{\frac{t}{y}}\\
\end{array}
\end{array}
if z < -4.6999999999999998e33Initial program 89.6%
associate-*l/97.1%
Simplified97.1%
Taylor expanded in y around inf 69.4%
Taylor expanded in z around inf 61.8%
if -4.6999999999999998e33 < z < 1.15e-18Initial program 95.8%
associate-*l/98.4%
Simplified98.4%
Taylor expanded in y around 0 55.1%
if 1.15e-18 < z Initial program 88.1%
associate-*l/99.8%
Simplified99.8%
Taylor expanded in y around inf 60.8%
Taylor expanded in z around inf 50.7%
associate-*r/55.1%
associate-/l*50.8%
Applied egg-rr50.8%
associate-/r/59.2%
clear-num59.2%
associate-*l/59.2%
*-un-lft-identity59.2%
add-cube-cbrt58.7%
*-un-lft-identity58.7%
times-frac58.7%
pow258.7%
Applied egg-rr58.7%
/-rgt-identity58.7%
associate-*r/58.7%
unpow258.7%
rem-3cbrt-lft59.2%
Simplified59.2%
Final simplification57.8%
(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 92.3%
associate-*l/98.4%
Simplified98.4%
Final simplification98.4%
(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.3%
associate-*l/98.4%
Simplified98.4%
Taylor expanded in y around 0 41.2%
Final simplification41.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 2024020
(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)))