
(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 13 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 (* (/ y t) (- z x))))
double code(double x, double y, double z, double t) {
return x + ((y / t) * (z - 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 + ((y / t) * (z - x))
end function
public static double code(double x, double y, double z, double t) {
return x + ((y / t) * (z - x));
}
def code(x, y, z, t): return x + ((y / t) * (z - x))
function code(x, y, z, t) return Float64(x + Float64(Float64(y / t) * Float64(z - x))) end
function tmp = code(x, y, z, t) tmp = x + ((y / t) * (z - x)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(y / t), $MachinePrecision] * N[(z - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y}{t} \cdot \left(z - x\right)
\end{array}
Initial program 91.9%
Taylor expanded in z around 0 87.2%
mul-1-neg87.2%
associate-/l*88.0%
distribute-lft-neg-in88.0%
*-commutative88.0%
associate-*r/88.9%
distribute-rgt-in97.0%
+-commutative97.0%
sub-neg97.0%
Simplified97.0%
(FPCore (x y z t)
:precision binary64
(if (<= t -5e+51)
x
(if (<= t -2.2e-287)
(/ (* y z) t)
(if (<= t 1.25e+37) (/ x (/ (- t) y)) x))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -5e+51) {
tmp = x;
} else if (t <= -2.2e-287) {
tmp = (y * z) / t;
} else if (t <= 1.25e+37) {
tmp = x / (-t / y);
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (t <= (-5d+51)) then
tmp = x
else if (t <= (-2.2d-287)) then
tmp = (y * z) / t
else if (t <= 1.25d+37) then
tmp = x / (-t / y)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= -5e+51) {
tmp = x;
} else if (t <= -2.2e-287) {
tmp = (y * z) / t;
} else if (t <= 1.25e+37) {
tmp = x / (-t / y);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -5e+51: tmp = x elif t <= -2.2e-287: tmp = (y * z) / t elif t <= 1.25e+37: tmp = x / (-t / y) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -5e+51) tmp = x; elseif (t <= -2.2e-287) tmp = Float64(Float64(y * z) / t); elseif (t <= 1.25e+37) tmp = Float64(x / Float64(Float64(-t) / y)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -5e+51) tmp = x; elseif (t <= -2.2e-287) tmp = (y * z) / t; elseif (t <= 1.25e+37) tmp = x / (-t / y); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -5e+51], x, If[LessEqual[t, -2.2e-287], N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[t, 1.25e+37], N[(x / N[((-t) / y), $MachinePrecision]), $MachinePrecision], x]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -5 \cdot 10^{+51}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq -2.2 \cdot 10^{-287}:\\
\;\;\;\;\frac{y \cdot z}{t}\\
\mathbf{elif}\;t \leq 1.25 \cdot 10^{+37}:\\
\;\;\;\;\frac{x}{\frac{-t}{y}}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if t < -5e51 or 1.24999999999999997e37 < t Initial program 80.3%
Taylor expanded in y around 0 65.9%
if -5e51 < t < -2.2e-287Initial program 99.7%
Taylor expanded in y around -inf 86.1%
Taylor expanded in z around inf 55.5%
if -2.2e-287 < t < 1.24999999999999997e37Initial program 98.0%
Taylor expanded in x around inf 67.4%
mul-1-neg67.4%
unsub-neg67.4%
Simplified67.4%
Taylor expanded in y around inf 52.3%
mul-1-neg52.3%
distribute-frac-neg52.3%
Simplified52.3%
distribute-frac-neg52.3%
distribute-rgt-neg-in52.3%
distribute-lft-neg-in52.3%
clear-num52.3%
un-div-inv53.1%
Applied egg-rr53.1%
Final simplification58.7%
(FPCore (x y z t)
:precision binary64
(if (<= t -7.5e+52)
x
(if (<= t -3.2e-289)
(/ (* y z) t)
(if (<= t 2.55e+29) (* x (/ y (- t))) x))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -7.5e+52) {
tmp = x;
} else if (t <= -3.2e-289) {
tmp = (y * z) / t;
} else if (t <= 2.55e+29) {
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 (t <= (-7.5d+52)) then
tmp = x
else if (t <= (-3.2d-289)) then
tmp = (y * z) / t
else if (t <= 2.55d+29) 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 (t <= -7.5e+52) {
tmp = x;
} else if (t <= -3.2e-289) {
tmp = (y * z) / t;
} else if (t <= 2.55e+29) {
tmp = x * (y / -t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -7.5e+52: tmp = x elif t <= -3.2e-289: tmp = (y * z) / t elif t <= 2.55e+29: tmp = x * (y / -t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -7.5e+52) tmp = x; elseif (t <= -3.2e-289) tmp = Float64(Float64(y * z) / t); elseif (t <= 2.55e+29) tmp = Float64(x * Float64(y / Float64(-t))); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -7.5e+52) tmp = x; elseif (t <= -3.2e-289) tmp = (y * z) / t; elseif (t <= 2.55e+29) tmp = x * (y / -t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -7.5e+52], x, If[LessEqual[t, -3.2e-289], N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[t, 2.55e+29], N[(x * N[(y / (-t)), $MachinePrecision]), $MachinePrecision], x]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -7.5 \cdot 10^{+52}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq -3.2 \cdot 10^{-289}:\\
\;\;\;\;\frac{y \cdot z}{t}\\
\mathbf{elif}\;t \leq 2.55 \cdot 10^{+29}:\\
\;\;\;\;x \cdot \frac{y}{-t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if t < -7.49999999999999995e52 or 2.55e29 < t Initial program 80.3%
Taylor expanded in y around 0 65.9%
if -7.49999999999999995e52 < t < -3.2000000000000002e-289Initial program 99.7%
Taylor expanded in y around -inf 86.1%
Taylor expanded in z around inf 55.5%
if -3.2000000000000002e-289 < t < 2.55e29Initial program 98.0%
Taylor expanded in x around inf 67.4%
mul-1-neg67.4%
unsub-neg67.4%
Simplified67.4%
Taylor expanded in y around inf 52.3%
mul-1-neg52.3%
distribute-frac-neg52.3%
Simplified52.3%
Final simplification58.5%
(FPCore (x y z t) :precision binary64 (if (or (<= z -4e-21) (not (<= z 7e-106))) (+ x (* (/ y t) z)) (- x (* y (/ x t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -4e-21) || !(z <= 7e-106)) {
tmp = x + ((y / t) * z);
} else {
tmp = x - (y * (x / 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 <= (-4d-21)) .or. (.not. (z <= 7d-106))) then
tmp = x + ((y / t) * z)
else
tmp = x - (y * (x / t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -4e-21) || !(z <= 7e-106)) {
tmp = x + ((y / t) * z);
} else {
tmp = x - (y * (x / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -4e-21) or not (z <= 7e-106): tmp = x + ((y / t) * z) else: tmp = x - (y * (x / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -4e-21) || !(z <= 7e-106)) tmp = Float64(x + Float64(Float64(y / t) * z)); else tmp = Float64(x - Float64(y * Float64(x / t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -4e-21) || ~((z <= 7e-106))) tmp = x + ((y / t) * z); else tmp = x - (y * (x / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -4e-21], N[Not[LessEqual[z, 7e-106]], $MachinePrecision]], N[(x + N[(N[(y / t), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], N[(x - N[(y * N[(x / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4 \cdot 10^{-21} \lor \neg \left(z \leq 7 \cdot 10^{-106}\right):\\
\;\;\;\;x + \frac{y}{t} \cdot z\\
\mathbf{else}:\\
\;\;\;\;x - y \cdot \frac{x}{t}\\
\end{array}
\end{array}
if z < -3.99999999999999963e-21 or 7e-106 < z Initial program 92.3%
Taylor expanded in z around 0 84.9%
mul-1-neg84.9%
associate-/l*85.4%
distribute-lft-neg-in85.4%
*-commutative85.4%
associate-*r/89.9%
distribute-rgt-in99.9%
+-commutative99.9%
sub-neg99.9%
Simplified99.9%
Taylor expanded in z around inf 89.0%
if -3.99999999999999963e-21 < z < 7e-106Initial program 91.5%
Taylor expanded in z around 0 80.7%
associate-*r/80.7%
mul-1-neg80.7%
distribute-lft-neg-out80.7%
*-commutative80.7%
Simplified80.7%
div-inv80.7%
*-commutative80.7%
add-sqr-sqrt39.6%
sqrt-unprod46.9%
sqr-neg46.9%
sqrt-unprod15.4%
add-sqr-sqrt32.7%
*-commutative32.7%
remove-double-neg32.7%
distribute-rgt-neg-out32.7%
cancel-sign-sub-inv32.7%
div-inv32.7%
associate-/l*32.9%
add-sqr-sqrt17.3%
sqrt-unprod50.9%
sqr-neg50.9%
sqrt-unprod42.6%
add-sqr-sqrt87.1%
Applied egg-rr87.1%
Final simplification88.2%
(FPCore (x y z t) :precision binary64 (if (or (<= z -4.1e-20) (not (<= z 155000.0))) (+ x (* (/ y t) z)) (* x (- 1.0 (/ y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -4.1e-20) || !(z <= 155000.0)) {
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 <= (-4.1d-20)) .or. (.not. (z <= 155000.0d0))) 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 <= -4.1e-20) || !(z <= 155000.0)) {
tmp = x + ((y / t) * z);
} else {
tmp = x * (1.0 - (y / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -4.1e-20) or not (z <= 155000.0): 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 <= -4.1e-20) || !(z <= 155000.0)) tmp = Float64(x + Float64(Float64(y / 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 <= -4.1e-20) || ~((z <= 155000.0))) 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, -4.1e-20], N[Not[LessEqual[z, 155000.0]], $MachinePrecision]], N[(x + N[(N[(y / t), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.1 \cdot 10^{-20} \lor \neg \left(z \leq 155000\right):\\
\;\;\;\;x + \frac{y}{t} \cdot z\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\end{array}
\end{array}
if z < -4.1000000000000001e-20 or 155000 < z Initial program 93.0%
Taylor expanded in z around 0 84.8%
mul-1-neg84.8%
associate-/l*84.0%
distribute-lft-neg-in84.0%
*-commutative84.0%
associate-*r/89.4%
distribute-rgt-in99.9%
+-commutative99.9%
sub-neg99.9%
Simplified99.9%
Taylor expanded in z around inf 91.8%
if -4.1000000000000001e-20 < z < 155000Initial program 91.0%
Taylor expanded in x around inf 83.2%
mul-1-neg83.2%
unsub-neg83.2%
Simplified83.2%
Final simplification87.4%
(FPCore (x y z t) :precision binary64 (if (or (<= x -2.6e+25) (not (<= x 4.1e-15))) (* x (- 1.0 (/ y t))) (+ x (* y (/ z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -2.6e+25) || !(x <= 4.1e-15)) {
tmp = x * (1.0 - (y / 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 <= (-2.6d+25)) .or. (.not. (x <= 4.1d-15))) then
tmp = x * (1.0d0 - (y / 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 <= -2.6e+25) || !(x <= 4.1e-15)) {
tmp = x * (1.0 - (y / t));
} else {
tmp = x + (y * (z / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -2.6e+25) or not (x <= 4.1e-15): tmp = x * (1.0 - (y / t)) else: tmp = x + (y * (z / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -2.6e+25) || !(x <= 4.1e-15)) tmp = Float64(x * Float64(1.0 - Float64(y / 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 <= -2.6e+25) || ~((x <= 4.1e-15))) tmp = x * (1.0 - (y / t)); else tmp = x + (y * (z / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -2.6e+25], N[Not[LessEqual[x, 4.1e-15]], $MachinePrecision]], N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.6 \cdot 10^{+25} \lor \neg \left(x \leq 4.1 \cdot 10^{-15}\right):\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\end{array}
\end{array}
if x < -2.5999999999999998e25 or 4.10000000000000036e-15 < x Initial program 87.5%
Taylor expanded in x around inf 89.8%
mul-1-neg89.8%
unsub-neg89.8%
Simplified89.8%
if -2.5999999999999998e25 < x < 4.10000000000000036e-15Initial program 96.0%
Taylor expanded in z around inf 81.8%
associate-/l*78.2%
Simplified78.2%
Final simplification83.7%
(FPCore (x y z t) :precision binary64 (if (or (<= t -1.35e+89) (not (<= t 3.2e-63))) (* x (- 1.0 (/ y t))) (* (/ y t) (- z x))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.35e+89) || !(t <= 3.2e-63)) {
tmp = x * (1.0 - (y / t));
} else {
tmp = (y / t) * (z - x);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((t <= (-1.35d+89)) .or. (.not. (t <= 3.2d-63))) then
tmp = x * (1.0d0 - (y / t))
else
tmp = (y / t) * (z - x)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.35e+89) || !(t <= 3.2e-63)) {
tmp = x * (1.0 - (y / t));
} else {
tmp = (y / t) * (z - x);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -1.35e+89) or not (t <= 3.2e-63): tmp = x * (1.0 - (y / t)) else: tmp = (y / t) * (z - x) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -1.35e+89) || !(t <= 3.2e-63)) tmp = Float64(x * Float64(1.0 - Float64(y / t))); else tmp = Float64(Float64(y / t) * Float64(z - x)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -1.35e+89) || ~((t <= 3.2e-63))) tmp = x * (1.0 - (y / t)); else tmp = (y / t) * (z - x); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -1.35e+89], N[Not[LessEqual[t, 3.2e-63]], $MachinePrecision]], N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y / t), $MachinePrecision] * N[(z - x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.35 \cdot 10^{+89} \lor \neg \left(t \leq 3.2 \cdot 10^{-63}\right):\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{t} \cdot \left(z - x\right)\\
\end{array}
\end{array}
if t < -1.35e89 or 3.19999999999999989e-63 < t Initial program 82.8%
Taylor expanded in x around inf 80.9%
mul-1-neg80.9%
unsub-neg80.9%
Simplified80.9%
if -1.35e89 < t < 3.19999999999999989e-63Initial program 98.3%
Taylor expanded in y around -inf 85.7%
Taylor expanded in z around 0 77.7%
mul-1-neg90.3%
associate-/l*84.2%
distribute-lft-neg-in84.2%
*-commutative84.2%
associate-*r/81.4%
distribute-rgt-in94.9%
+-commutative94.9%
sub-neg94.9%
Simplified81.4%
Final simplification81.2%
(FPCore (x y z t) :precision binary64 (if (or (<= x -3.2e-110) (not (<= x 5.4e-76))) (* x (- 1.0 (/ y t))) (/ (* y z) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -3.2e-110) || !(x <= 5.4e-76)) {
tmp = x * (1.0 - (y / t));
} else {
tmp = (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 <= (-3.2d-110)) .or. (.not. (x <= 5.4d-76))) then
tmp = x * (1.0d0 - (y / t))
else
tmp = (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 <= -3.2e-110) || !(x <= 5.4e-76)) {
tmp = x * (1.0 - (y / t));
} else {
tmp = (y * z) / t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -3.2e-110) or not (x <= 5.4e-76): tmp = x * (1.0 - (y / t)) else: tmp = (y * z) / t return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -3.2e-110) || !(x <= 5.4e-76)) tmp = Float64(x * Float64(1.0 - Float64(y / t))); else tmp = Float64(Float64(y * z) / t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -3.2e-110) || ~((x <= 5.4e-76))) tmp = x * (1.0 - (y / t)); else tmp = (y * z) / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -3.2e-110], N[Not[LessEqual[x, 5.4e-76]], $MachinePrecision]], N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.2 \cdot 10^{-110} \lor \neg \left(x \leq 5.4 \cdot 10^{-76}\right):\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{y \cdot z}{t}\\
\end{array}
\end{array}
if x < -3.20000000000000028e-110 or 5.4000000000000001e-76 < x Initial program 89.0%
Taylor expanded in x around inf 81.9%
mul-1-neg81.9%
unsub-neg81.9%
Simplified81.9%
if -3.20000000000000028e-110 < x < 5.4000000000000001e-76Initial program 97.3%
Taylor expanded in y around -inf 78.8%
Taylor expanded in z around inf 68.5%
Final simplification77.2%
(FPCore (x y z t) :precision binary64 (if (<= x -1.18e-107) (* x (/ (- t y) t)) (if (<= x 3.05e-74) (/ (* y z) t) (* x (- 1.0 (/ y t))))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -1.18e-107) {
tmp = x * ((t - y) / t);
} else if (x <= 3.05e-74) {
tmp = (y * z) / 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 (x <= (-1.18d-107)) then
tmp = x * ((t - y) / t)
else if (x <= 3.05d-74) then
tmp = (y * z) / 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 (x <= -1.18e-107) {
tmp = x * ((t - y) / t);
} else if (x <= 3.05e-74) {
tmp = (y * z) / t;
} else {
tmp = x * (1.0 - (y / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -1.18e-107: tmp = x * ((t - y) / t) elif x <= 3.05e-74: tmp = (y * z) / t else: tmp = x * (1.0 - (y / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -1.18e-107) tmp = Float64(x * Float64(Float64(t - y) / t)); elseif (x <= 3.05e-74) tmp = Float64(Float64(y * z) / 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 (x <= -1.18e-107) tmp = x * ((t - y) / t); elseif (x <= 3.05e-74) tmp = (y * z) / t; else tmp = x * (1.0 - (y / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -1.18e-107], N[(x * N[(N[(t - y), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 3.05e-74], N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision], N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.18 \cdot 10^{-107}:\\
\;\;\;\;x \cdot \frac{t - y}{t}\\
\mathbf{elif}\;x \leq 3.05 \cdot 10^{-74}:\\
\;\;\;\;\frac{y \cdot z}{t}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\end{array}
\end{array}
if x < -1.17999999999999993e-107Initial program 87.6%
Taylor expanded in x around inf 81.6%
mul-1-neg81.6%
unsub-neg81.6%
Simplified81.6%
Taylor expanded in t around 0 81.6%
if -1.17999999999999993e-107 < x < 3.0499999999999999e-74Initial program 97.3%
Taylor expanded in y around -inf 78.8%
Taylor expanded in z around inf 68.5%
if 3.0499999999999999e-74 < x Initial program 90.4%
Taylor expanded in x around inf 82.2%
mul-1-neg82.2%
unsub-neg82.2%
Simplified82.2%
(FPCore (x y z t) :precision binary64 (if (<= t -3.2e+53) x (if (<= t 1.95e-63) (/ (* y z) t) x)))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -3.2e+53) {
tmp = x;
} else if (t <= 1.95e-63) {
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 (t <= (-3.2d+53)) then
tmp = x
else if (t <= 1.95d-63) 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 (t <= -3.2e+53) {
tmp = x;
} else if (t <= 1.95e-63) {
tmp = (y * z) / t;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -3.2e+53: tmp = x elif t <= 1.95e-63: tmp = (y * z) / t else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -3.2e+53) tmp = x; elseif (t <= 1.95e-63) tmp = Float64(Float64(y * z) / t); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -3.2e+53) tmp = x; elseif (t <= 1.95e-63) tmp = (y * z) / t; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -3.2e+53], x, If[LessEqual[t, 1.95e-63], N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.2 \cdot 10^{+53}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq 1.95 \cdot 10^{-63}:\\
\;\;\;\;\frac{y \cdot z}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if t < -3.2e53 or 1.95000000000000011e-63 < t Initial program 83.0%
Taylor expanded in y around 0 61.7%
if -3.2e53 < t < 1.95000000000000011e-63Initial program 98.9%
Taylor expanded in y around -inf 87.0%
Taylor expanded in z around inf 52.9%
(FPCore (x y z t) :precision binary64 (if (<= t -1.65e+55) x (if (<= t 1.35e-64) (/ y (/ t z)) x)))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1.65e+55) {
tmp = x;
} else if (t <= 1.35e-64) {
tmp = y / (t / z);
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (t <= (-1.65d+55)) then
tmp = x
else if (t <= 1.35d-64) then
tmp = y / (t / z)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1.65e+55) {
tmp = x;
} else if (t <= 1.35e-64) {
tmp = y / (t / z);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -1.65e+55: tmp = x elif t <= 1.35e-64: tmp = y / (t / z) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -1.65e+55) tmp = x; elseif (t <= 1.35e-64) tmp = Float64(y / Float64(t / z)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -1.65e+55) tmp = x; elseif (t <= 1.35e-64) tmp = y / (t / z); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -1.65e+55], x, If[LessEqual[t, 1.35e-64], N[(y / N[(t / z), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.65 \cdot 10^{+55}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq 1.35 \cdot 10^{-64}:\\
\;\;\;\;\frac{y}{\frac{t}{z}}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if t < -1.65e55 or 1.34999999999999993e-64 < t Initial program 83.3%
Taylor expanded in y around 0 60.7%
if -1.65e55 < t < 1.34999999999999993e-64Initial program 98.9%
Taylor expanded in y around -inf 86.8%
Taylor expanded in z around inf 52.9%
associate-/l*55.6%
Simplified46.4%
clear-num46.4%
un-div-inv47.6%
Applied egg-rr47.6%
(FPCore (x y z t) :precision binary64 (if (<= t -1.6e+55) x (if (<= t 1.35e-64) (* y (/ z t)) x)))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1.6e+55) {
tmp = x;
} else if (t <= 1.35e-64) {
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 (t <= (-1.6d+55)) then
tmp = x
else if (t <= 1.35d-64) 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 (t <= -1.6e+55) {
tmp = x;
} else if (t <= 1.35e-64) {
tmp = y * (z / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -1.6e+55: tmp = x elif t <= 1.35e-64: tmp = y * (z / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -1.6e+55) tmp = x; elseif (t <= 1.35e-64) 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 (t <= -1.6e+55) tmp = x; elseif (t <= 1.35e-64) tmp = y * (z / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -1.6e+55], x, If[LessEqual[t, 1.35e-64], N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.6 \cdot 10^{+55}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq 1.35 \cdot 10^{-64}:\\
\;\;\;\;y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if t < -1.6000000000000001e55 or 1.34999999999999993e-64 < t Initial program 83.3%
Taylor expanded in y around 0 60.7%
if -1.6000000000000001e55 < t < 1.34999999999999993e-64Initial program 98.9%
Taylor expanded in y around -inf 86.8%
Taylor expanded in z around inf 52.9%
associate-/l*55.6%
Simplified46.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 91.9%
Taylor expanded in y around 0 33.8%
(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 2024132
(FPCore (x y z t)
:name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, D"
:precision binary64
:alt
(! :herbie-platform default (- x (+ (* x (/ y t)) (* (- z) (/ y t)))))
(+ x (/ (* y (- z x)) t)))