
(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 93.6%
Taylor expanded in z around 0 88.1%
mul-1-neg88.1%
associate-/l*88.5%
distribute-lft-neg-in88.5%
*-commutative88.5%
associate-*r/91.5%
distribute-rgt-in98.6%
+-commutative98.6%
sub-neg98.6%
Simplified98.6%
(FPCore (x y z t) :precision binary64 (if (<= z -1.7e-63) (* y (/ z t)) (if (<= z 8e-196) (/ (- (* x y)) t) (if (<= z 4.1e-115) x (* (/ y t) z)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.7e-63) {
tmp = y * (z / t);
} else if (z <= 8e-196) {
tmp = -(x * y) / t;
} else if (z <= 4.1e-115) {
tmp = x;
} else {
tmp = (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 (z <= (-1.7d-63)) then
tmp = y * (z / t)
else if (z <= 8d-196) then
tmp = -(x * y) / t
else if (z <= 4.1d-115) then
tmp = x
else
tmp = (y / t) * z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.7e-63) {
tmp = y * (z / t);
} else if (z <= 8e-196) {
tmp = -(x * y) / t;
} else if (z <= 4.1e-115) {
tmp = x;
} else {
tmp = (y / t) * z;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.7e-63: tmp = y * (z / t) elif z <= 8e-196: tmp = -(x * y) / t elif z <= 4.1e-115: tmp = x else: tmp = (y / t) * z return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.7e-63) tmp = Float64(y * Float64(z / t)); elseif (z <= 8e-196) tmp = Float64(Float64(-Float64(x * y)) / t); elseif (z <= 4.1e-115) tmp = x; else tmp = Float64(Float64(y / t) * z); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -1.7e-63) tmp = y * (z / t); elseif (z <= 8e-196) tmp = -(x * y) / t; elseif (z <= 4.1e-115) tmp = x; else tmp = (y / t) * z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.7e-63], N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 8e-196], N[((-N[(x * y), $MachinePrecision]) / t), $MachinePrecision], If[LessEqual[z, 4.1e-115], x, N[(N[(y / t), $MachinePrecision] * z), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.7 \cdot 10^{-63}:\\
\;\;\;\;y \cdot \frac{z}{t}\\
\mathbf{elif}\;z \leq 8 \cdot 10^{-196}:\\
\;\;\;\;\frac{-x \cdot y}{t}\\
\mathbf{elif}\;z \leq 4.1 \cdot 10^{-115}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{t} \cdot z\\
\end{array}
\end{array}
if z < -1.69999999999999999e-63Initial program 90.0%
Taylor expanded in y around -inf 68.5%
Taylor expanded in z around inf 60.1%
associate-/l*89.4%
Simplified65.9%
if -1.69999999999999999e-63 < z < 8.0000000000000004e-196Initial program 95.6%
Taylor expanded in y around -inf 57.4%
Taylor expanded in z around 0 55.2%
neg-mul-155.2%
Simplified55.2%
if 8.0000000000000004e-196 < z < 4.0999999999999997e-115Initial program 100.0%
Taylor expanded in y around 0 64.3%
if 4.0999999999999997e-115 < z Initial program 94.8%
Taylor expanded in y around -inf 67.2%
Taylor expanded in z around inf 52.1%
associate-/l*75.3%
Simplified49.5%
clear-num49.5%
un-div-inv49.7%
Applied egg-rr49.7%
associate-/r/56.1%
Applied egg-rr56.1%
Final simplification60.1%
(FPCore (x y z t)
:precision binary64
(if (<= z -1.85e-63)
(* y (/ z t))
(if (<= z 3.7e-188)
(* x (/ y (- t)))
(if (<= z 2.25e-115) x (* (/ y t) z)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.85e-63) {
tmp = y * (z / t);
} else if (z <= 3.7e-188) {
tmp = x * (y / -t);
} else if (z <= 2.25e-115) {
tmp = x;
} else {
tmp = (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 (z <= (-1.85d-63)) then
tmp = y * (z / t)
else if (z <= 3.7d-188) then
tmp = x * (y / -t)
else if (z <= 2.25d-115) then
tmp = x
else
tmp = (y / t) * z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.85e-63) {
tmp = y * (z / t);
} else if (z <= 3.7e-188) {
tmp = x * (y / -t);
} else if (z <= 2.25e-115) {
tmp = x;
} else {
tmp = (y / t) * z;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.85e-63: tmp = y * (z / t) elif z <= 3.7e-188: tmp = x * (y / -t) elif z <= 2.25e-115: tmp = x else: tmp = (y / t) * z return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.85e-63) tmp = Float64(y * Float64(z / t)); elseif (z <= 3.7e-188) tmp = Float64(x * Float64(y / Float64(-t))); elseif (z <= 2.25e-115) tmp = x; else tmp = Float64(Float64(y / t) * z); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -1.85e-63) tmp = y * (z / t); elseif (z <= 3.7e-188) tmp = x * (y / -t); elseif (z <= 2.25e-115) tmp = x; else tmp = (y / t) * z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.85e-63], N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.7e-188], N[(x * N[(y / (-t)), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.25e-115], x, N[(N[(y / t), $MachinePrecision] * z), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.85 \cdot 10^{-63}:\\
\;\;\;\;y \cdot \frac{z}{t}\\
\mathbf{elif}\;z \leq 3.7 \cdot 10^{-188}:\\
\;\;\;\;x \cdot \frac{y}{-t}\\
\mathbf{elif}\;z \leq 2.25 \cdot 10^{-115}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{t} \cdot z\\
\end{array}
\end{array}
if z < -1.85000000000000006e-63Initial program 90.0%
Taylor expanded in y around -inf 68.5%
Taylor expanded in z around inf 60.1%
associate-/l*89.4%
Simplified65.9%
if -1.85000000000000006e-63 < z < 3.69999999999999972e-188Initial program 95.6%
Taylor expanded in y around -inf 57.4%
Taylor expanded in z around 0 55.2%
mul-1-neg55.2%
associate-/l*55.2%
distribute-rgt-neg-in55.2%
mul-1-neg55.2%
associate-*r/55.2%
mul-1-neg55.2%
Simplified55.2%
if 3.69999999999999972e-188 < z < 2.25000000000000011e-115Initial program 100.0%
Taylor expanded in y around 0 64.3%
if 2.25000000000000011e-115 < z Initial program 94.8%
Taylor expanded in y around -inf 67.2%
Taylor expanded in z around inf 52.1%
associate-/l*75.3%
Simplified49.5%
clear-num49.5%
un-div-inv49.7%
Applied egg-rr49.7%
associate-/r/56.1%
Applied egg-rr56.1%
Final simplification60.1%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.85e-63) (not (<= z 1.2e-130))) (+ x (* (/ y t) z)) (* x (- 1.0 (/ y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.85e-63) || !(z <= 1.2e-130)) {
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 <= (-1.85d-63)) .or. (.not. (z <= 1.2d-130))) 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 <= -1.85e-63) || !(z <= 1.2e-130)) {
tmp = x + ((y / t) * z);
} else {
tmp = x * (1.0 - (y / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.85e-63) or not (z <= 1.2e-130): 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 <= -1.85e-63) || !(z <= 1.2e-130)) 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 <= -1.85e-63) || ~((z <= 1.2e-130))) 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, -1.85e-63], N[Not[LessEqual[z, 1.2e-130]], $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 -1.85 \cdot 10^{-63} \lor \neg \left(z \leq 1.2 \cdot 10^{-130}\right):\\
\;\;\;\;x + \frac{y}{t} \cdot z\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\end{array}
\end{array}
if z < -1.85000000000000006e-63 or 1.19999999999999998e-130 < z Initial program 92.2%
Taylor expanded in z around 0 85.2%
mul-1-neg85.2%
associate-/l*85.8%
distribute-lft-neg-in85.8%
*-commutative85.8%
associate-*r/89.8%
distribute-rgt-in98.5%
+-commutative98.5%
sub-neg98.5%
Simplified98.5%
Taylor expanded in z around inf 87.1%
if -1.85000000000000006e-63 < z < 1.19999999999999998e-130Initial program 96.5%
Taylor expanded in x around inf 94.7%
mul-1-neg94.7%
unsub-neg94.7%
Simplified94.7%
Final simplification89.5%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.15e-63) (not (<= z 1.25e-130))) (+ x (* y (/ z t))) (* x (- 1.0 (/ y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.15e-63) || !(z <= 1.25e-130)) {
tmp = x + (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 ((z <= (-1.15d-63)) .or. (.not. (z <= 1.25d-130))) then
tmp = x + (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 ((z <= -1.15e-63) || !(z <= 1.25e-130)) {
tmp = x + (y * (z / t));
} else {
tmp = x * (1.0 - (y / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.15e-63) or not (z <= 1.25e-130): tmp = x + (y * (z / t)) else: tmp = x * (1.0 - (y / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.15e-63) || !(z <= 1.25e-130)) tmp = Float64(x + Float64(y * Float64(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 ((z <= -1.15e-63) || ~((z <= 1.25e-130))) tmp = x + (y * (z / t)); else tmp = x * (1.0 - (y / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.15e-63], N[Not[LessEqual[z, 1.25e-130]], $MachinePrecision]], N[(x + N[(y * N[(z / 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.15 \cdot 10^{-63} \lor \neg \left(z \leq 1.25 \cdot 10^{-130}\right):\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\end{array}
\end{array}
if z < -1.15e-63 or 1.2499999999999999e-130 < z Initial program 92.2%
Taylor expanded in z around inf 83.1%
associate-/l*83.5%
Simplified83.5%
if -1.15e-63 < z < 1.2499999999999999e-130Initial program 96.5%
Taylor expanded in x around inf 94.7%
mul-1-neg94.7%
unsub-neg94.7%
Simplified94.7%
Final simplification87.1%
(FPCore (x y z t) :precision binary64 (if (<= z -1.7e-63) (* y (/ (- z x) t)) (if (<= z 7e+135) (* x (- 1.0 (/ y t))) (* (/ y t) z))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.7e-63) {
tmp = y * ((z - x) / t);
} else if (z <= 7e+135) {
tmp = x * (1.0 - (y / t));
} else {
tmp = (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 (z <= (-1.7d-63)) then
tmp = y * ((z - x) / t)
else if (z <= 7d+135) then
tmp = x * (1.0d0 - (y / t))
else
tmp = (y / t) * z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.7e-63) {
tmp = y * ((z - x) / t);
} else if (z <= 7e+135) {
tmp = x * (1.0 - (y / t));
} else {
tmp = (y / t) * z;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.7e-63: tmp = y * ((z - x) / t) elif z <= 7e+135: tmp = x * (1.0 - (y / t)) else: tmp = (y / t) * z return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.7e-63) tmp = Float64(y * Float64(Float64(z - x) / t)); elseif (z <= 7e+135) tmp = Float64(x * Float64(1.0 - Float64(y / t))); else tmp = Float64(Float64(y / t) * z); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -1.7e-63) tmp = y * ((z - x) / t); elseif (z <= 7e+135) tmp = x * (1.0 - (y / t)); else tmp = (y / t) * z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.7e-63], N[(y * N[(N[(z - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 7e+135], N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y / t), $MachinePrecision] * z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.7 \cdot 10^{-63}:\\
\;\;\;\;y \cdot \frac{z - x}{t}\\
\mathbf{elif}\;z \leq 7 \cdot 10^{+135}:\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{t} \cdot z\\
\end{array}
\end{array}
if z < -1.69999999999999999e-63Initial program 90.0%
Taylor expanded in y around -inf 68.5%
associate-/l*74.3%
*-commutative74.3%
Applied egg-rr74.3%
if -1.69999999999999999e-63 < z < 7.0000000000000005e135Initial program 97.1%
Taylor expanded in x around inf 85.4%
mul-1-neg85.4%
unsub-neg85.4%
Simplified85.4%
if 7.0000000000000005e135 < z Initial program 88.9%
Taylor expanded in y around -inf 77.0%
Taylor expanded in z around inf 69.3%
associate-/l*70.3%
Simplified62.0%
clear-num62.0%
un-div-inv62.9%
Applied egg-rr62.9%
associate-/r/77.5%
Applied egg-rr77.5%
Final simplification80.5%
(FPCore (x y z t) :precision binary64 (if (<= z -3.7e+19) (/ y (/ t z)) (if (<= z 2e+136) (* x (- 1.0 (/ y t))) (* (/ y t) z))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -3.7e+19) {
tmp = y / (t / z);
} else if (z <= 2e+136) {
tmp = x * (1.0 - (y / t));
} else {
tmp = (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 (z <= (-3.7d+19)) then
tmp = y / (t / z)
else if (z <= 2d+136) then
tmp = x * (1.0d0 - (y / t))
else
tmp = (y / t) * z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -3.7e+19) {
tmp = y / (t / z);
} else if (z <= 2e+136) {
tmp = x * (1.0 - (y / t));
} else {
tmp = (y / t) * z;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -3.7e+19: tmp = y / (t / z) elif z <= 2e+136: tmp = x * (1.0 - (y / t)) else: tmp = (y / t) * z return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -3.7e+19) tmp = Float64(y / Float64(t / z)); elseif (z <= 2e+136) tmp = Float64(x * Float64(1.0 - Float64(y / t))); else tmp = Float64(Float64(y / t) * z); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -3.7e+19) tmp = y / (t / z); elseif (z <= 2e+136) tmp = x * (1.0 - (y / t)); else tmp = (y / t) * z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -3.7e+19], N[(y / N[(t / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2e+136], N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y / t), $MachinePrecision] * z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.7 \cdot 10^{+19}:\\
\;\;\;\;\frac{y}{\frac{t}{z}}\\
\mathbf{elif}\;z \leq 2 \cdot 10^{+136}:\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{t} \cdot z\\
\end{array}
\end{array}
if z < -3.7e19Initial program 91.3%
Taylor expanded in y around -inf 68.0%
Taylor expanded in z around inf 62.9%
associate-/l*93.3%
Simplified70.2%
clear-num70.2%
un-div-inv70.2%
Applied egg-rr70.2%
if -3.7e19 < z < 2.00000000000000012e136Initial program 95.5%
Taylor expanded in x around inf 81.5%
mul-1-neg81.5%
unsub-neg81.5%
Simplified81.5%
if 2.00000000000000012e136 < z Initial program 88.9%
Taylor expanded in y around -inf 77.0%
Taylor expanded in z around inf 69.3%
associate-/l*70.3%
Simplified62.0%
clear-num62.0%
un-div-inv62.9%
Applied egg-rr62.9%
associate-/r/77.5%
Applied egg-rr77.5%
(FPCore (x y z t) :precision binary64 (if (or (<= y -9.5e-40) (not (<= y 0.00335))) (* y (/ z t)) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -9.5e-40) || !(y <= 0.00335)) {
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 <= (-9.5d-40)) .or. (.not. (y <= 0.00335d0))) 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 <= -9.5e-40) || !(y <= 0.00335)) {
tmp = y * (z / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -9.5e-40) or not (y <= 0.00335): tmp = y * (z / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -9.5e-40) || !(y <= 0.00335)) 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 <= -9.5e-40) || ~((y <= 0.00335))) tmp = y * (z / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -9.5e-40], N[Not[LessEqual[y, 0.00335]], $MachinePrecision]], N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -9.5 \cdot 10^{-40} \lor \neg \left(y \leq 0.00335\right):\\
\;\;\;\;y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -9.5000000000000006e-40 or 0.00335000000000000011 < y Initial program 90.2%
Taylor expanded in y around -inf 77.5%
Taylor expanded in z around inf 49.3%
associate-/l*70.4%
Simplified55.0%
if -9.5000000000000006e-40 < y < 0.00335000000000000011Initial program 98.2%
Taylor expanded in y around 0 56.9%
Final simplification55.8%
(FPCore (x y z t) :precision binary64 (if (<= z -6.5e-64) (* y (/ z t)) (if (<= z 1.3e-114) x (* (/ y t) z))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -6.5e-64) {
tmp = y * (z / t);
} else if (z <= 1.3e-114) {
tmp = x;
} else {
tmp = (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 (z <= (-6.5d-64)) then
tmp = y * (z / t)
else if (z <= 1.3d-114) then
tmp = x
else
tmp = (y / t) * z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -6.5e-64) {
tmp = y * (z / t);
} else if (z <= 1.3e-114) {
tmp = x;
} else {
tmp = (y / t) * z;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -6.5e-64: tmp = y * (z / t) elif z <= 1.3e-114: tmp = x else: tmp = (y / t) * z return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -6.5e-64) tmp = Float64(y * Float64(z / t)); elseif (z <= 1.3e-114) tmp = x; else tmp = Float64(Float64(y / t) * z); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -6.5e-64) tmp = y * (z / t); elseif (z <= 1.3e-114) tmp = x; else tmp = (y / t) * z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -6.5e-64], N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.3e-114], x, N[(N[(y / t), $MachinePrecision] * z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.5 \cdot 10^{-64}:\\
\;\;\;\;y \cdot \frac{z}{t}\\
\mathbf{elif}\;z \leq 1.3 \cdot 10^{-114}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{t} \cdot z\\
\end{array}
\end{array}
if z < -6.5000000000000004e-64Initial program 90.1%
Taylor expanded in y around -inf 68.8%
Taylor expanded in z around inf 60.5%
associate-/l*89.6%
Simplified66.3%
if -6.5000000000000004e-64 < z < 1.30000000000000007e-114Initial program 96.5%
Taylor expanded in y around 0 46.7%
if 1.30000000000000007e-114 < z Initial program 94.8%
Taylor expanded in y around -inf 67.2%
Taylor expanded in z around inf 52.1%
associate-/l*75.3%
Simplified49.5%
clear-num49.5%
un-div-inv49.7%
Applied egg-rr49.7%
associate-/r/56.1%
Applied egg-rr56.1%
(FPCore (x y z t) :precision binary64 x)
double code(double x, double y, double z, double t) {
return x;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x
end function
public static double code(double x, double y, double z, double t) {
return x;
}
def code(x, y, z, t): return x
function code(x, y, z, t) return x end
function tmp = code(x, y, z, t) tmp = x; end
code[x_, y_, z_, t_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 93.6%
Taylor expanded in y around 0 34.0%
(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 2024137
(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)))