
(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 (* (/ 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 95.1%
Taylor expanded in z around 0 90.8%
+-commutative90.8%
*-commutative90.8%
associate-*r/90.8%
mul-1-neg90.8%
associate-/l*92.4%
distribute-lft-neg-in92.4%
distribute-rgt-in97.6%
sub-neg97.6%
Simplified97.6%
(FPCore (x y z t) :precision binary64 (if (or (<= x -1.9e+51) (not (<= x 12000000000000.0))) (* x (- 1.0 (/ y t))) (+ x (* (/ y t) z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.9e+51) || !(x <= 12000000000000.0)) {
tmp = x * (1.0 - (y / 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 <= (-1.9d+51)) .or. (.not. (x <= 12000000000000.0d0))) then
tmp = x * (1.0d0 - (y / 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 <= -1.9e+51) || !(x <= 12000000000000.0)) {
tmp = x * (1.0 - (y / t));
} else {
tmp = x + ((y / t) * z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -1.9e+51) or not (x <= 12000000000000.0): tmp = x * (1.0 - (y / t)) else: tmp = x + ((y / t) * z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -1.9e+51) || !(x <= 12000000000000.0)) tmp = Float64(x * Float64(1.0 - Float64(y / t))); else tmp = Float64(x + Float64(Float64(y / t) * z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -1.9e+51) || ~((x <= 12000000000000.0))) tmp = x * (1.0 - (y / t)); else tmp = x + ((y / t) * z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -1.9e+51], N[Not[LessEqual[x, 12000000000000.0]], $MachinePrecision]], N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y / t), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.9 \cdot 10^{+51} \lor \neg \left(x \leq 12000000000000\right):\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{t} \cdot z\\
\end{array}
\end{array}
if x < -1.8999999999999999e51 or 1.2e13 < x Initial program 93.2%
Taylor expanded in x around inf 90.4%
mul-1-neg90.4%
unsub-neg90.4%
Simplified90.4%
if -1.8999999999999999e51 < x < 1.2e13Initial program 96.6%
Taylor expanded in z around 0 93.8%
+-commutative93.8%
*-commutative93.8%
associate-*r/93.0%
mul-1-neg93.0%
associate-/l*90.9%
distribute-lft-neg-in90.9%
distribute-rgt-in95.8%
sub-neg95.8%
Simplified95.8%
Taylor expanded in z around inf 87.0%
Final simplification88.5%
(FPCore (x y z t) :precision binary64 (if (or (<= x -2.05e+51) (not (<= x 15500000000000.0))) (* x (- 1.0 (/ y t))) (+ x (* y (/ z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -2.05e+51) || !(x <= 15500000000000.0)) {
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.05d+51)) .or. (.not. (x <= 15500000000000.0d0))) 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.05e+51) || !(x <= 15500000000000.0)) {
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.05e+51) or not (x <= 15500000000000.0): 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.05e+51) || !(x <= 15500000000000.0)) 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.05e+51) || ~((x <= 15500000000000.0))) 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.05e+51], N[Not[LessEqual[x, 15500000000000.0]], $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.05 \cdot 10^{+51} \lor \neg \left(x \leq 15500000000000\right):\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\end{array}
\end{array}
if x < -2.05000000000000005e51 or 1.55e13 < x Initial program 93.2%
Taylor expanded in x around inf 90.4%
mul-1-neg90.4%
unsub-neg90.4%
Simplified90.4%
if -2.05000000000000005e51 < x < 1.55e13Initial program 96.6%
Taylor expanded in z around inf 86.5%
associate-/l*86.3%
Simplified86.3%
Final simplification88.1%
(FPCore (x y z t) :precision binary64 (if (or (<= x -1250.0) (not (<= x 1.25e-135))) (* x (- 1.0 (/ y t))) (* y (/ (- z x) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1250.0) || !(x <= 1.25e-135)) {
tmp = x * (1.0 - (y / t));
} else {
tmp = y * ((z - 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 ((x <= (-1250.0d0)) .or. (.not. (x <= 1.25d-135))) then
tmp = x * (1.0d0 - (y / t))
else
tmp = y * ((z - x) / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1250.0) || !(x <= 1.25e-135)) {
tmp = x * (1.0 - (y / t));
} else {
tmp = y * ((z - x) / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -1250.0) or not (x <= 1.25e-135): tmp = x * (1.0 - (y / t)) else: tmp = y * ((z - x) / t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -1250.0) || !(x <= 1.25e-135)) tmp = Float64(x * Float64(1.0 - Float64(y / t))); else tmp = Float64(y * Float64(Float64(z - x) / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -1250.0) || ~((x <= 1.25e-135))) tmp = x * (1.0 - (y / t)); else tmp = y * ((z - x) / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -1250.0], N[Not[LessEqual[x, 1.25e-135]], $MachinePrecision]], N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * N[(N[(z - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1250 \lor \neg \left(x \leq 1.25 \cdot 10^{-135}\right):\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{z - x}{t}\\
\end{array}
\end{array}
if x < -1250 or 1.25000000000000005e-135 < x Initial program 94.3%
Taylor expanded in x around inf 82.6%
mul-1-neg82.6%
unsub-neg82.6%
Simplified82.6%
if -1250 < x < 1.25000000000000005e-135Initial program 96.3%
Taylor expanded in y around -inf 72.4%
associate-/l*74.1%
*-commutative74.1%
Applied egg-rr74.1%
Final simplification79.1%
(FPCore (x y z t) :precision binary64 (if (or (<= t -5000000000.0) (not (<= t 2.95e+181))) (* x (- 1.0 (/ y t))) (* (/ y t) (- z x))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -5000000000.0) || !(t <= 2.95e+181)) {
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 <= (-5000000000.0d0)) .or. (.not. (t <= 2.95d+181))) 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 <= -5000000000.0) || !(t <= 2.95e+181)) {
tmp = x * (1.0 - (y / t));
} else {
tmp = (y / t) * (z - x);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -5000000000.0) or not (t <= 2.95e+181): 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 <= -5000000000.0) || !(t <= 2.95e+181)) 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 <= -5000000000.0) || ~((t <= 2.95e+181))) 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, -5000000000.0], N[Not[LessEqual[t, 2.95e+181]], $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 -5000000000 \lor \neg \left(t \leq 2.95 \cdot 10^{+181}\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 < -5e9 or 2.9499999999999999e181 < t Initial program 90.8%
Taylor expanded in x around inf 81.4%
mul-1-neg81.4%
unsub-neg81.4%
Simplified81.4%
if -5e9 < t < 2.9499999999999999e181Initial program 97.6%
Taylor expanded in y around -inf 77.3%
Taylor expanded in z around 0 71.2%
+-commutative91.5%
*-commutative91.5%
associate-*r/90.2%
mul-1-neg90.2%
associate-/l*88.8%
distribute-lft-neg-in88.8%
distribute-rgt-in96.9%
sub-neg96.9%
Simplified76.6%
Final simplification78.3%
(FPCore (x y z t) :precision binary64 (if (or (<= x -1.3e-87) (not (<= x 2.5e-136))) (* x (- 1.0 (/ y t))) (* y (/ z t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.3e-87) || !(x <= 2.5e-136)) {
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 <= (-1.3d-87)) .or. (.not. (x <= 2.5d-136))) 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 <= -1.3e-87) || !(x <= 2.5e-136)) {
tmp = x * (1.0 - (y / t));
} else {
tmp = y * (z / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -1.3e-87) or not (x <= 2.5e-136): tmp = x * (1.0 - (y / t)) else: tmp = y * (z / t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -1.3e-87) || !(x <= 2.5e-136)) tmp = Float64(x * Float64(1.0 - Float64(y / t))); else tmp = Float64(y * Float64(z / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -1.3e-87) || ~((x <= 2.5e-136))) 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, -1.3e-87], N[Not[LessEqual[x, 2.5e-136]], $MachinePrecision]], N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.3 \cdot 10^{-87} \lor \neg \left(x \leq 2.5 \cdot 10^{-136}\right):\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{z}{t}\\
\end{array}
\end{array}
if x < -1.30000000000000001e-87 or 2.5000000000000001e-136 < x Initial program 94.0%
Taylor expanded in x around inf 78.6%
mul-1-neg78.6%
unsub-neg78.6%
Simplified78.6%
if -1.30000000000000001e-87 < x < 2.5000000000000001e-136Initial program 97.5%
Taylor expanded in y around -inf 78.5%
Taylor expanded in z around inf 70.8%
associate-/l*90.6%
Simplified71.6%
Final simplification76.3%
(FPCore (x y z t) :precision binary64 (if (<= t -6.5e-17) (+ x (* y (/ z t))) (if (<= t 1.75e-106) (/ (* y (- z x)) t) (+ x (* (/ y t) z)))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -6.5e-17) {
tmp = x + (y * (z / t));
} else if (t <= 1.75e-106) {
tmp = (y * (z - x)) / 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 (t <= (-6.5d-17)) then
tmp = x + (y * (z / t))
else if (t <= 1.75d-106) then
tmp = (y * (z - x)) / 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 (t <= -6.5e-17) {
tmp = x + (y * (z / t));
} else if (t <= 1.75e-106) {
tmp = (y * (z - x)) / t;
} else {
tmp = x + ((y / t) * z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -6.5e-17: tmp = x + (y * (z / t)) elif t <= 1.75e-106: tmp = (y * (z - x)) / t else: tmp = x + ((y / t) * z) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -6.5e-17) tmp = Float64(x + Float64(y * Float64(z / t))); elseif (t <= 1.75e-106) tmp = Float64(Float64(y * Float64(z - x)) / t); else tmp = Float64(x + Float64(Float64(y / t) * z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -6.5e-17) tmp = x + (y * (z / t)); elseif (t <= 1.75e-106) tmp = (y * (z - x)) / t; else tmp = x + ((y / t) * z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -6.5e-17], N[(x + N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.75e-106], N[(N[(y * N[(z - x), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision], N[(x + N[(N[(y / t), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -6.5 \cdot 10^{-17}:\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\mathbf{elif}\;t \leq 1.75 \cdot 10^{-106}:\\
\;\;\;\;\frac{y \cdot \left(z - x\right)}{t}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{t} \cdot z\\
\end{array}
\end{array}
if t < -6.4999999999999996e-17Initial program 91.3%
Taylor expanded in z around inf 86.3%
associate-/l*88.4%
Simplified88.4%
if -6.4999999999999996e-17 < t < 1.75e-106Initial program 99.8%
Taylor expanded in y around -inf 88.0%
if 1.75e-106 < t Initial program 92.8%
Taylor expanded in z around 0 91.5%
+-commutative91.5%
*-commutative91.5%
associate-*r/93.8%
mul-1-neg93.8%
associate-/l*97.3%
distribute-lft-neg-in97.3%
distribute-rgt-in98.6%
sub-neg98.6%
Simplified98.6%
Taylor expanded in z around inf 90.5%
(FPCore (x y z t) :precision binary64 (if (or (<= y -1.32e-73) (not (<= y 2.1e+28))) (* y (/ z t)) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1.32e-73) || !(y <= 2.1e+28)) {
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 ((y <= (-1.32d-73)) .or. (.not. (y <= 2.1d+28))) 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 ((y <= -1.32e-73) || !(y <= 2.1e+28)) {
tmp = y * (z / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -1.32e-73) or not (y <= 2.1e+28): tmp = y * (z / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -1.32e-73) || !(y <= 2.1e+28)) 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 ((y <= -1.32e-73) || ~((y <= 2.1e+28))) tmp = y * (z / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -1.32e-73], N[Not[LessEqual[y, 2.1e+28]], $MachinePrecision]], N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.32 \cdot 10^{-73} \lor \neg \left(y \leq 2.1 \cdot 10^{+28}\right):\\
\;\;\;\;y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -1.31999999999999998e-73 or 2.09999999999999989e28 < y Initial program 91.1%
Taylor expanded in y around -inf 75.1%
Taylor expanded in z around inf 49.8%
associate-/l*71.0%
Simplified52.9%
if -1.31999999999999998e-73 < y < 2.09999999999999989e28Initial program 99.9%
Taylor expanded in y around 0 65.1%
Final simplification58.5%
(FPCore (x y z t) :precision binary64 (if (<= t -920000000.0) x (if (<= t 2.95e+181) (* (/ y t) z) x)))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -920000000.0) {
tmp = x;
} else if (t <= 2.95e+181) {
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 <= (-920000000.0d0)) then
tmp = x
else if (t <= 2.95d+181) 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 <= -920000000.0) {
tmp = x;
} else if (t <= 2.95e+181) {
tmp = (y / t) * z;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -920000000.0: tmp = x elif t <= 2.95e+181: tmp = (y / t) * z else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -920000000.0) tmp = x; elseif (t <= 2.95e+181) tmp = Float64(Float64(y / t) * z); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -920000000.0) tmp = x; elseif (t <= 2.95e+181) tmp = (y / t) * z; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -920000000.0], x, If[LessEqual[t, 2.95e+181], N[(N[(y / t), $MachinePrecision] * z), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -920000000:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq 2.95 \cdot 10^{+181}:\\
\;\;\;\;\frac{y}{t} \cdot z\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if t < -9.2e8 or 2.9499999999999999e181 < t Initial program 90.8%
Taylor expanded in y around 0 73.4%
if -9.2e8 < t < 2.9499999999999999e181Initial program 97.6%
Taylor expanded in y around -inf 77.3%
Taylor expanded in z around 0 71.2%
+-commutative91.5%
*-commutative91.5%
associate-*r/90.2%
mul-1-neg90.2%
associate-/l*88.8%
distribute-lft-neg-in88.8%
distribute-rgt-in96.9%
sub-neg96.9%
Simplified76.6%
Taylor expanded in z around inf 52.0%
(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 95.1%
Taylor expanded in y around 0 40.6%
(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 2024191
(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)))