
(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 96.4%
Taylor expanded in z around 0 91.7%
+-commutative91.7%
*-commutative91.7%
associate-*r/92.3%
mul-1-neg92.3%
associate-/l*91.8%
distribute-lft-neg-in91.8%
distribute-rgt-in98.1%
sub-neg98.1%
Simplified98.1%
Final simplification98.1%
(FPCore (x y z t) :precision binary64 (if (<= z -2.5e+156) (* (/ y t) z) (* x (- 1.0 (/ y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -2.5e+156) {
tmp = (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 <= (-2.5d+156)) then
tmp = (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 <= -2.5e+156) {
tmp = (y / t) * z;
} else {
tmp = x * (1.0 - (y / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -2.5e+156: tmp = (y / t) * z else: tmp = x * (1.0 - (y / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -2.5e+156) tmp = 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 <= -2.5e+156) tmp = (y / t) * z; else tmp = x * (1.0 - (y / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -2.5e+156], N[(N[(y / t), $MachinePrecision] * z), $MachinePrecision], N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.5 \cdot 10^{+156}:\\
\;\;\;\;\frac{y}{t} \cdot z\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\end{array}
\end{array}
if z < -2.49999999999999996e156Initial program 90.9%
Taylor expanded in y around -inf 71.9%
Taylor expanded in z around inf 71.5%
add-log-exp44.3%
*-un-lft-identity44.3%
log-prod44.3%
metadata-eval44.3%
add-log-exp71.5%
associate-/l*65.3%
Applied egg-rr65.3%
+-lft-identity65.3%
*-commutative65.3%
associate-*l/71.5%
associate-*r/77.5%
Simplified77.5%
if -2.49999999999999996e156 < z Initial program 97.1%
Taylor expanded in x around inf 66.1%
mul-1-neg66.1%
unsub-neg66.1%
Simplified66.1%
Final simplification67.5%
(FPCore (x y z t) :precision binary64 (if (<= z 1.45e+73) (* x (- 1.0 (/ y t))) (* (/ y t) (- z x))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= 1.45e+73) {
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 (z <= 1.45d+73) 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 (z <= 1.45e+73) {
tmp = x * (1.0 - (y / t));
} else {
tmp = (y / t) * (z - x);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= 1.45e+73: tmp = x * (1.0 - (y / t)) else: tmp = (y / t) * (z - x) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= 1.45e+73) 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 (z <= 1.45e+73) tmp = x * (1.0 - (y / t)); else tmp = (y / t) * (z - x); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, 1.45e+73], 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}\;z \leq 1.45 \cdot 10^{+73}:\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{t} \cdot \left(z - x\right)\\
\end{array}
\end{array}
if z < 1.4500000000000001e73Initial program 96.4%
Taylor expanded in x around inf 71.5%
mul-1-neg71.5%
unsub-neg71.5%
Simplified71.5%
if 1.4500000000000001e73 < z Initial program 96.2%
Taylor expanded in y around -inf 78.3%
Taylor expanded in z around 0 68.7%
+-commutative86.6%
*-commutative86.6%
associate-*r/88.9%
mul-1-neg88.9%
associate-/l*87.0%
distribute-lft-neg-in87.0%
distribute-rgt-in98.5%
sub-neg98.5%
Simplified80.5%
Final simplification73.3%
(FPCore (x y z t) :precision binary64 (if (<= y -5.8e+119) (* (/ y t) (- z x)) (+ x (* y (/ z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -5.8e+119) {
tmp = (y / t) * (z - x);
} 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 (y <= (-5.8d+119)) then
tmp = (y / t) * (z - x)
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 (y <= -5.8e+119) {
tmp = (y / t) * (z - x);
} else {
tmp = x + (y * (z / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -5.8e+119: tmp = (y / t) * (z - x) else: tmp = x + (y * (z / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -5.8e+119) tmp = Float64(Float64(y / t) * Float64(z - x)); 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 (y <= -5.8e+119) tmp = (y / t) * (z - x); else tmp = x + (y * (z / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -5.8e+119], N[(N[(y / t), $MachinePrecision] * N[(z - x), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.8 \cdot 10^{+119}:\\
\;\;\;\;\frac{y}{t} \cdot \left(z - x\right)\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\end{array}
\end{array}
if y < -5.80000000000000014e119Initial program 94.6%
Taylor expanded in y around -inf 92.6%
Taylor expanded in z around 0 84.3%
+-commutative86.3%
*-commutative86.3%
associate-*r/77.9%
mul-1-neg77.9%
associate-/l*80.4%
distribute-lft-neg-in80.4%
distribute-rgt-in89.4%
sub-neg89.4%
Simplified87.4%
if -5.80000000000000014e119 < y Initial program 96.7%
Taylor expanded in z around inf 78.1%
associate-/l*37.4%
Simplified76.0%
Final simplification77.6%
(FPCore (x y z t) :precision binary64 (if (<= y -6.5e+119) (* (/ y t) (- z x)) (+ x (/ y (/ t z)))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -6.5e+119) {
tmp = (y / t) * (z - x);
} 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 (y <= (-6.5d+119)) then
tmp = (y / t) * (z - x)
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 (y <= -6.5e+119) {
tmp = (y / t) * (z - x);
} else {
tmp = x + (y / (t / z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -6.5e+119: tmp = (y / t) * (z - x) else: tmp = x + (y / (t / z)) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -6.5e+119) tmp = Float64(Float64(y / t) * Float64(z - x)); else tmp = Float64(x + Float64(y / Float64(t / z))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -6.5e+119) tmp = (y / t) * (z - x); else tmp = x + (y / (t / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -6.5e+119], N[(N[(y / t), $MachinePrecision] * N[(z - x), $MachinePrecision]), $MachinePrecision], N[(x + N[(y / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -6.5 \cdot 10^{+119}:\\
\;\;\;\;\frac{y}{t} \cdot \left(z - x\right)\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{\frac{t}{z}}\\
\end{array}
\end{array}
if y < -6.4999999999999997e119Initial program 94.6%
Taylor expanded in y around -inf 92.6%
Taylor expanded in z around 0 84.3%
+-commutative86.3%
*-commutative86.3%
associate-*r/77.9%
mul-1-neg77.9%
associate-/l*80.4%
distribute-lft-neg-in80.4%
distribute-rgt-in89.4%
sub-neg89.4%
Simplified87.4%
if -6.4999999999999997e119 < y Initial program 96.7%
Taylor expanded in z around inf 78.1%
associate-/l*37.4%
Simplified76.0%
clear-num37.5%
un-div-inv37.5%
Applied egg-rr76.1%
Final simplification77.7%
(FPCore (x y z t) :precision binary64 (if (<= y 11500000.0) (+ x (* y (/ z t))) (/ (* y (- z x)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 11500000.0) {
tmp = x + (y * (z / 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 (y <= 11500000.0d0) then
tmp = x + (y * (z / 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 (y <= 11500000.0) {
tmp = x + (y * (z / t));
} else {
tmp = (y * (z - x)) / t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= 11500000.0: tmp = x + (y * (z / t)) else: tmp = (y * (z - x)) / t return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= 11500000.0) tmp = Float64(x + Float64(y * Float64(z / t))); else tmp = Float64(Float64(y * Float64(z - x)) / t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= 11500000.0) tmp = x + (y * (z / t)); else tmp = (y * (z - x)) / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, 11500000.0], N[(x + N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y * N[(z - x), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 11500000:\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{y \cdot \left(z - x\right)}{t}\\
\end{array}
\end{array}
if y < 1.15e7Initial program 98.2%
Taylor expanded in z around inf 82.2%
associate-/l*37.6%
Simplified77.9%
if 1.15e7 < y Initial program 90.7%
Taylor expanded in y around -inf 81.1%
Final simplification78.7%
(FPCore (x y z t) :precision binary64 (if (<= x 1.5e+95) (* (/ y t) z) (* x (/ (- y) t))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= 1.5e+95) {
tmp = (y / t) * z;
} else {
tmp = x * (-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.5d+95) then
tmp = (y / t) * z
else
tmp = x * (-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.5e+95) {
tmp = (y / t) * z;
} else {
tmp = x * (-y / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= 1.5e+95: tmp = (y / t) * z else: tmp = x * (-y / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= 1.5e+95) tmp = Float64(Float64(y / t) * z); else tmp = Float64(x * Float64(Float64(-y) / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= 1.5e+95) tmp = (y / t) * z; else tmp = x * (-y / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, 1.5e+95], N[(N[(y / t), $MachinePrecision] * z), $MachinePrecision], N[(x * N[((-y) / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.5 \cdot 10^{+95}:\\
\;\;\;\;\frac{y}{t} \cdot z\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{-y}{t}\\
\end{array}
\end{array}
if x < 1.49999999999999996e95Initial program 97.0%
Taylor expanded in y around -inf 64.2%
Taylor expanded in z around inf 46.9%
add-log-exp25.9%
*-un-lft-identity25.9%
log-prod25.9%
metadata-eval25.9%
add-log-exp46.9%
associate-/l*44.8%
Applied egg-rr44.8%
+-lft-identity44.8%
*-commutative44.8%
associate-*l/46.9%
associate-*r/48.5%
Simplified48.5%
if 1.49999999999999996e95 < x Initial program 92.8%
Taylor expanded in y around -inf 54.2%
Taylor expanded in z around 0 51.9%
mul-1-neg51.9%
associate-/l*54.1%
distribute-rgt-neg-in54.1%
mul-1-neg54.1%
associate-*r/54.1%
mul-1-neg54.1%
Simplified54.1%
Final simplification49.3%
(FPCore (x y z t) :precision binary64 (if (<= x 5.8e+94) (* (/ y t) z) (/ (* y (- x)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= 5.8e+94) {
tmp = (y / t) * z;
} else {
tmp = (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 (x <= 5.8d+94) then
tmp = (y / t) * z
else
tmp = (y * -x) / t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= 5.8e+94) {
tmp = (y / t) * z;
} else {
tmp = (y * -x) / t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= 5.8e+94: tmp = (y / t) * z else: tmp = (y * -x) / t return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= 5.8e+94) tmp = Float64(Float64(y / t) * z); else tmp = Float64(Float64(y * Float64(-x)) / t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= 5.8e+94) tmp = (y / t) * z; else tmp = (y * -x) / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, 5.8e+94], N[(N[(y / t), $MachinePrecision] * z), $MachinePrecision], N[(N[(y * (-x)), $MachinePrecision] / t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 5.8 \cdot 10^{+94}:\\
\;\;\;\;\frac{y}{t} \cdot z\\
\mathbf{else}:\\
\;\;\;\;\frac{y \cdot \left(-x\right)}{t}\\
\end{array}
\end{array}
if x < 5.7999999999999997e94Initial program 97.0%
Taylor expanded in y around -inf 64.2%
Taylor expanded in z around inf 46.9%
add-log-exp25.9%
*-un-lft-identity25.9%
log-prod25.9%
metadata-eval25.9%
add-log-exp46.9%
associate-/l*44.8%
Applied egg-rr44.8%
+-lft-identity44.8%
*-commutative44.8%
associate-*l/46.9%
associate-*r/48.5%
Simplified48.5%
if 5.7999999999999997e94 < x Initial program 92.8%
Taylor expanded in y around -inf 54.2%
Taylor expanded in z around 0 51.9%
mul-1-neg51.9%
distribute-lft-neg-out51.9%
*-commutative51.9%
Simplified51.9%
Final simplification49.0%
(FPCore (x y z t) :precision binary64 (if (<= x -2.7e-68) x (* y (/ z t))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -2.7e-68) {
tmp = x;
} 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 <= (-2.7d-68)) then
tmp = x
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 <= -2.7e-68) {
tmp = x;
} else {
tmp = y * (z / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -2.7e-68: tmp = x else: tmp = y * (z / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -2.7e-68) tmp = x; else tmp = Float64(y * Float64(z / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -2.7e-68) tmp = x; else tmp = y * (z / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -2.7e-68], x, N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.7 \cdot 10^{-68}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{z}{t}\\
\end{array}
\end{array}
if x < -2.7000000000000002e-68Initial program 97.3%
Taylor expanded in y around 0 45.7%
if -2.7000000000000002e-68 < x Initial program 96.0%
Taylor expanded in y around -inf 66.1%
Taylor expanded in z around inf 49.3%
associate-/l*47.8%
Simplified47.8%
Final simplification47.2%
(FPCore (x y z t) :precision binary64 (if (<= x -7e-70) x (* (/ y t) z)))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -7e-70) {
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 (x <= (-7d-70)) 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 (x <= -7e-70) {
tmp = x;
} else {
tmp = (y / t) * z;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -7e-70: tmp = x else: tmp = (y / t) * z return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -7e-70) 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 (x <= -7e-70) tmp = x; else tmp = (y / t) * z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -7e-70], x, N[(N[(y / t), $MachinePrecision] * z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7 \cdot 10^{-70}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{t} \cdot z\\
\end{array}
\end{array}
if x < -6.99999999999999949e-70Initial program 97.3%
Taylor expanded in y around 0 45.7%
if -6.99999999999999949e-70 < x Initial program 96.0%
Taylor expanded in y around -inf 66.1%
Taylor expanded in z around inf 49.3%
add-log-exp25.8%
*-un-lft-identity25.8%
log-prod25.8%
metadata-eval25.8%
add-log-exp49.3%
associate-/l*47.8%
Applied egg-rr47.8%
+-lft-identity47.8%
*-commutative47.8%
associate-*l/49.3%
associate-*r/51.7%
Simplified51.7%
Final simplification50.0%
(FPCore (x y z t) :precision binary64 (if (<= x -3.3e-71) x (/ y (/ t z))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -3.3e-71) {
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 (x <= (-3.3d-71)) 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 (x <= -3.3e-71) {
tmp = x;
} else {
tmp = y / (t / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -3.3e-71: tmp = x else: tmp = y / (t / z) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -3.3e-71) tmp = x; else tmp = Float64(y / Float64(t / z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -3.3e-71) tmp = x; else tmp = y / (t / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -3.3e-71], x, N[(y / N[(t / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.3 \cdot 10^{-71}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{\frac{t}{z}}\\
\end{array}
\end{array}
if x < -3.3000000000000002e-71Initial program 97.3%
Taylor expanded in y around 0 45.7%
if -3.3000000000000002e-71 < x Initial program 96.0%
Taylor expanded in y around -inf 66.1%
Taylor expanded in z around inf 49.3%
associate-/l*47.8%
Simplified47.8%
clear-num47.4%
un-div-inv47.4%
Applied egg-rr47.4%
Final simplification46.9%
(FPCore (x y z t) :precision binary64 (if (<= x -9.5e-69) x (/ (* y z) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -9.5e-69) {
tmp = x;
} 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 <= (-9.5d-69)) then
tmp = x
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 <= -9.5e-69) {
tmp = x;
} else {
tmp = (y * z) / t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -9.5e-69: tmp = x else: tmp = (y * z) / t return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -9.5e-69) tmp = x; else tmp = Float64(Float64(y * z) / t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -9.5e-69) tmp = x; else tmp = (y * z) / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -9.5e-69], x, N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -9.5 \cdot 10^{-69}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;\frac{y \cdot z}{t}\\
\end{array}
\end{array}
if x < -9.50000000000000094e-69Initial program 97.3%
Taylor expanded in y around 0 45.7%
if -9.50000000000000094e-69 < x Initial program 96.0%
Taylor expanded in y around -inf 66.1%
Taylor expanded in z around inf 49.3%
Final simplification48.3%
(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 96.4%
Taylor expanded in y around 0 36.7%
Final simplification36.7%
(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 2024066
(FPCore (x y z t)
:name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, D"
:precision binary64
:alt
(- x (+ (* x (/ y t)) (* (- z) (/ y t))))
(+ x (/ (* y (- z x)) t)))