
(FPCore (x y z t) :precision binary64 (+ (* (/ x y) (- z t)) t))
double code(double x, double y, double z, double t) {
return ((x / y) * (z - t)) + 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 - t)) + t
end function
public static double code(double x, double y, double z, double t) {
return ((x / y) * (z - t)) + t;
}
def code(x, y, z, t): return ((x / y) * (z - t)) + t
function code(x, y, z, t) return Float64(Float64(Float64(x / y) * Float64(z - t)) + t) end
function tmp = code(x, y, z, t) tmp = ((x / y) * (z - t)) + t; end
code[x_, y_, z_, t_] := N[(N[(N[(x / y), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision] + t), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{y} \cdot \left(z - t\right) + t
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (+ (* (/ x y) (- z t)) t))
double code(double x, double y, double z, double t) {
return ((x / y) * (z - t)) + 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 - t)) + t
end function
public static double code(double x, double y, double z, double t) {
return ((x / y) * (z - t)) + t;
}
def code(x, y, z, t): return ((x / y) * (z - t)) + t
function code(x, y, z, t) return Float64(Float64(Float64(x / y) * Float64(z - t)) + t) end
function tmp = code(x, y, z, t) tmp = ((x / y) * (z - t)) + t; end
code[x_, y_, z_, t_] := N[(N[(N[(x / y), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision] + t), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{y} \cdot \left(z - t\right) + t
\end{array}
(FPCore (x y z t) :precision binary64 (+ t (/ (- z t) (/ y x))))
double code(double x, double y, double z, double t) {
return t + ((z - t) / (y / 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 = t + ((z - t) / (y / x))
end function
public static double code(double x, double y, double z, double t) {
return t + ((z - t) / (y / x));
}
def code(x, y, z, t): return t + ((z - t) / (y / x))
function code(x, y, z, t) return Float64(t + Float64(Float64(z - t) / Float64(y / x))) end
function tmp = code(x, y, z, t) tmp = t + ((z - t) / (y / x)); end
code[x_, y_, z_, t_] := N[(t + N[(N[(z - t), $MachinePrecision] / N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
t + \frac{z - t}{\frac{y}{x}}
\end{array}
Initial program 96.9%
*-commutative96.9%
clear-num96.9%
un-div-inv97.2%
Applied egg-rr97.2%
Final simplification97.2%
(FPCore (x y z t) :precision binary64 (if (or (<= t -7e-94) (not (<= t 2.05e-10))) (/ t (/ y (- y x))) (+ t (/ x (/ y z)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -7e-94) || !(t <= 2.05e-10)) {
tmp = t / (y / (y - x));
} else {
tmp = t + (x / (y / 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 <= (-7d-94)) .or. (.not. (t <= 2.05d-10))) then
tmp = t / (y / (y - x))
else
tmp = t + (x / (y / z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -7e-94) || !(t <= 2.05e-10)) {
tmp = t / (y / (y - x));
} else {
tmp = t + (x / (y / z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -7e-94) or not (t <= 2.05e-10): tmp = t / (y / (y - x)) else: tmp = t + (x / (y / z)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -7e-94) || !(t <= 2.05e-10)) tmp = Float64(t / Float64(y / Float64(y - x))); else tmp = Float64(t + Float64(x / Float64(y / z))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -7e-94) || ~((t <= 2.05e-10))) tmp = t / (y / (y - x)); else tmp = t + (x / (y / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -7e-94], N[Not[LessEqual[t, 2.05e-10]], $MachinePrecision]], N[(t / N[(y / N[(y - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t + N[(x / N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -7 \cdot 10^{-94} \lor \neg \left(t \leq 2.05 \cdot 10^{-10}\right):\\
\;\;\;\;\frac{t}{\frac{y}{y - x}}\\
\mathbf{else}:\\
\;\;\;\;t + \frac{x}{\frac{y}{z}}\\
\end{array}
\end{array}
if t < -6.99999999999999996e-94 or 2.0499999999999999e-10 < t Initial program 99.3%
Taylor expanded in z around 0 82.0%
mul-1-neg82.0%
unsub-neg82.0%
*-rgt-identity82.0%
associate-/l*89.4%
distribute-lft-out--89.4%
Simplified89.4%
Taylor expanded in y around 0 89.4%
clear-num89.4%
un-div-inv89.6%
Applied egg-rr89.6%
if -6.99999999999999996e-94 < t < 2.0499999999999999e-10Initial program 93.9%
associate-*l/91.5%
associate-*r/96.4%
clear-num96.4%
un-div-inv96.4%
Applied egg-rr96.4%
Taylor expanded in z around inf 90.4%
Final simplification89.9%
(FPCore (x y z t) :precision binary64 (if (or (<= t -4.8e-94) (not (<= t 0.00014))) (* t (/ (- y x) y)) (+ t (/ x (/ y z)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -4.8e-94) || !(t <= 0.00014)) {
tmp = t * ((y - x) / y);
} else {
tmp = t + (x / (y / 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 <= (-4.8d-94)) .or. (.not. (t <= 0.00014d0))) then
tmp = t * ((y - x) / y)
else
tmp = t + (x / (y / z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -4.8e-94) || !(t <= 0.00014)) {
tmp = t * ((y - x) / y);
} else {
tmp = t + (x / (y / z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -4.8e-94) or not (t <= 0.00014): tmp = t * ((y - x) / y) else: tmp = t + (x / (y / z)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -4.8e-94) || !(t <= 0.00014)) tmp = Float64(t * Float64(Float64(y - x) / y)); else tmp = Float64(t + Float64(x / Float64(y / z))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -4.8e-94) || ~((t <= 0.00014))) tmp = t * ((y - x) / y); else tmp = t + (x / (y / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -4.8e-94], N[Not[LessEqual[t, 0.00014]], $MachinePrecision]], N[(t * N[(N[(y - x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(t + N[(x / N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4.8 \cdot 10^{-94} \lor \neg \left(t \leq 0.00014\right):\\
\;\;\;\;t \cdot \frac{y - x}{y}\\
\mathbf{else}:\\
\;\;\;\;t + \frac{x}{\frac{y}{z}}\\
\end{array}
\end{array}
if t < -4.8e-94 or 1.3999999999999999e-4 < t Initial program 99.3%
Taylor expanded in z around 0 82.0%
mul-1-neg82.0%
unsub-neg82.0%
*-rgt-identity82.0%
associate-/l*89.4%
distribute-lft-out--89.4%
Simplified89.4%
Taylor expanded in y around 0 89.4%
if -4.8e-94 < t < 1.3999999999999999e-4Initial program 93.9%
associate-*l/91.5%
associate-*r/96.4%
clear-num96.4%
un-div-inv96.4%
Applied egg-rr96.4%
Taylor expanded in z around inf 90.4%
Final simplification89.8%
(FPCore (x y z t) :precision binary64 (if (or (<= t -7e-94) (not (<= t 0.0003))) (* t (/ (- y x) y)) (+ t (* x (/ z y)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -7e-94) || !(t <= 0.0003)) {
tmp = t * ((y - x) / y);
} else {
tmp = t + (x * (z / y));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((t <= (-7d-94)) .or. (.not. (t <= 0.0003d0))) then
tmp = t * ((y - x) / y)
else
tmp = t + (x * (z / y))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -7e-94) || !(t <= 0.0003)) {
tmp = t * ((y - x) / y);
} else {
tmp = t + (x * (z / y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -7e-94) or not (t <= 0.0003): tmp = t * ((y - x) / y) else: tmp = t + (x * (z / y)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -7e-94) || !(t <= 0.0003)) tmp = Float64(t * Float64(Float64(y - x) / y)); else tmp = Float64(t + Float64(x * Float64(z / y))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -7e-94) || ~((t <= 0.0003))) tmp = t * ((y - x) / y); else tmp = t + (x * (z / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -7e-94], N[Not[LessEqual[t, 0.0003]], $MachinePrecision]], N[(t * N[(N[(y - x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(t + N[(x * N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -7 \cdot 10^{-94} \lor \neg \left(t \leq 0.0003\right):\\
\;\;\;\;t \cdot \frac{y - x}{y}\\
\mathbf{else}:\\
\;\;\;\;t + x \cdot \frac{z}{y}\\
\end{array}
\end{array}
if t < -6.99999999999999996e-94 or 2.99999999999999974e-4 < t Initial program 99.3%
Taylor expanded in z around 0 82.0%
mul-1-neg82.0%
unsub-neg82.0%
*-rgt-identity82.0%
associate-/l*89.4%
distribute-lft-out--89.4%
Simplified89.4%
Taylor expanded in y around 0 89.4%
if -6.99999999999999996e-94 < t < 2.99999999999999974e-4Initial program 93.9%
Taylor expanded in z around inf 85.4%
associate-/l*90.3%
Simplified90.3%
Final simplification89.8%
(FPCore (x y z t) :precision binary64 (if (<= t -7e-94) (/ t (/ y (- y x))) (if (<= t 0.00058) (+ t (/ x (/ y z))) (- t (/ t (/ y x))))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -7e-94) {
tmp = t / (y / (y - x));
} else if (t <= 0.00058) {
tmp = t + (x / (y / z));
} else {
tmp = t - (t / (y / 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 <= (-7d-94)) then
tmp = t / (y / (y - x))
else if (t <= 0.00058d0) then
tmp = t + (x / (y / z))
else
tmp = t - (t / (y / x))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= -7e-94) {
tmp = t / (y / (y - x));
} else if (t <= 0.00058) {
tmp = t + (x / (y / z));
} else {
tmp = t - (t / (y / x));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -7e-94: tmp = t / (y / (y - x)) elif t <= 0.00058: tmp = t + (x / (y / z)) else: tmp = t - (t / (y / x)) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -7e-94) tmp = Float64(t / Float64(y / Float64(y - x))); elseif (t <= 0.00058) tmp = Float64(t + Float64(x / Float64(y / z))); else tmp = Float64(t - Float64(t / Float64(y / x))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -7e-94) tmp = t / (y / (y - x)); elseif (t <= 0.00058) tmp = t + (x / (y / z)); else tmp = t - (t / (y / x)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -7e-94], N[(t / N[(y / N[(y - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 0.00058], N[(t + N[(x / N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t - N[(t / N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -7 \cdot 10^{-94}:\\
\;\;\;\;\frac{t}{\frac{y}{y - x}}\\
\mathbf{elif}\;t \leq 0.00058:\\
\;\;\;\;t + \frac{x}{\frac{y}{z}}\\
\mathbf{else}:\\
\;\;\;\;t - \frac{t}{\frac{y}{x}}\\
\end{array}
\end{array}
if t < -6.99999999999999996e-94Initial program 98.7%
Taylor expanded in z around 0 79.5%
mul-1-neg79.5%
unsub-neg79.5%
*-rgt-identity79.5%
associate-/l*85.3%
distribute-lft-out--85.2%
Simplified85.2%
Taylor expanded in y around 0 85.3%
clear-num85.2%
un-div-inv85.6%
Applied egg-rr85.6%
if -6.99999999999999996e-94 < t < 5.8e-4Initial program 93.9%
associate-*l/91.5%
associate-*r/96.4%
clear-num96.4%
un-div-inv96.4%
Applied egg-rr96.4%
Taylor expanded in z around inf 90.4%
if 5.8e-4 < t Initial program 100.0%
Taylor expanded in z around 0 85.1%
mul-1-neg85.1%
*-commutative85.1%
associate-/l*87.2%
distribute-rgt-neg-in87.2%
distribute-neg-frac287.2%
Simplified87.2%
*-commutative87.2%
add-sqr-sqrt43.9%
sqrt-unprod61.9%
sqr-neg61.9%
sqrt-unprod23.6%
add-sqr-sqrt55.9%
associate-/r/59.8%
frac-2neg59.8%
distribute-neg-frac59.8%
add-sqr-sqrt32.4%
sqrt-unprod73.7%
sqr-neg73.7%
sqrt-unprod49.3%
add-sqr-sqrt94.6%
Applied egg-rr94.6%
Final simplification89.9%
(FPCore (x y z t) :precision binary64 (if (or (<= x -4.3e+101) (not (<= x 1e+96))) (/ t (/ (- y) x)) t))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -4.3e+101) || !(x <= 1e+96)) {
tmp = t / (-y / x);
} else {
tmp = 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 <= (-4.3d+101)) .or. (.not. (x <= 1d+96))) then
tmp = t / (-y / x)
else
tmp = t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -4.3e+101) || !(x <= 1e+96)) {
tmp = t / (-y / x);
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -4.3e+101) or not (x <= 1e+96): tmp = t / (-y / x) else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -4.3e+101) || !(x <= 1e+96)) tmp = Float64(t / Float64(Float64(-y) / x)); else tmp = t; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -4.3e+101) || ~((x <= 1e+96))) tmp = t / (-y / x); else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -4.3e+101], N[Not[LessEqual[x, 1e+96]], $MachinePrecision]], N[(t / N[((-y) / x), $MachinePrecision]), $MachinePrecision], t]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.3 \cdot 10^{+101} \lor \neg \left(x \leq 10^{+96}\right):\\
\;\;\;\;\frac{t}{\frac{-y}{x}}\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if x < -4.3000000000000001e101 or 1.00000000000000005e96 < x Initial program 95.1%
Taylor expanded in z around 0 50.0%
mul-1-neg50.0%
unsub-neg50.0%
*-rgt-identity50.0%
associate-/l*59.8%
distribute-lft-out--59.8%
Simplified59.8%
Taylor expanded in x around inf 44.3%
mul-1-neg44.3%
distribute-frac-neg244.3%
*-commutative44.3%
associate-/l*49.4%
Simplified49.4%
*-commutative58.8%
add-sqr-sqrt24.5%
sqrt-unprod30.7%
sqr-neg30.7%
sqrt-unprod7.4%
add-sqr-sqrt17.4%
associate-/r/20.0%
frac-2neg20.0%
distribute-neg-frac20.0%
add-sqr-sqrt10.8%
sqrt-unprod41.1%
sqr-neg41.1%
sqrt-unprod33.5%
add-sqr-sqrt60.1%
Applied egg-rr50.7%
if -4.3000000000000001e101 < x < 1.00000000000000005e96Initial program 98.1%
Taylor expanded in x around 0 59.9%
Final simplification56.3%
(FPCore (x y z t) :precision binary64 (if (or (<= x -3.6e+101) (not (<= x 1.1e+95))) (* t (/ x (- y))) t))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -3.6e+101) || !(x <= 1.1e+95)) {
tmp = t * (x / -y);
} else {
tmp = 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.6d+101)) .or. (.not. (x <= 1.1d+95))) then
tmp = t * (x / -y)
else
tmp = t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -3.6e+101) || !(x <= 1.1e+95)) {
tmp = t * (x / -y);
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -3.6e+101) or not (x <= 1.1e+95): tmp = t * (x / -y) else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -3.6e+101) || !(x <= 1.1e+95)) tmp = Float64(t * Float64(x / Float64(-y))); else tmp = t; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -3.6e+101) || ~((x <= 1.1e+95))) tmp = t * (x / -y); else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -3.6e+101], N[Not[LessEqual[x, 1.1e+95]], $MachinePrecision]], N[(t * N[(x / (-y)), $MachinePrecision]), $MachinePrecision], t]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.6 \cdot 10^{+101} \lor \neg \left(x \leq 1.1 \cdot 10^{+95}\right):\\
\;\;\;\;t \cdot \frac{x}{-y}\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if x < -3.60000000000000029e101 or 1.0999999999999999e95 < x Initial program 95.1%
Taylor expanded in z around 0 50.0%
mul-1-neg50.0%
unsub-neg50.0%
*-rgt-identity50.0%
associate-/l*59.8%
distribute-lft-out--59.8%
Simplified59.8%
Taylor expanded in x around inf 50.4%
mul-1-neg50.4%
distribute-frac-neg250.4%
Simplified50.4%
if -3.60000000000000029e101 < x < 1.0999999999999999e95Initial program 98.1%
Taylor expanded in x around 0 59.9%
Final simplification56.2%
(FPCore (x y z t) :precision binary64 (+ t (* (- z t) (/ x y))))
double code(double x, double y, double z, double t) {
return t + ((z - t) * (x / y));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = t + ((z - t) * (x / y))
end function
public static double code(double x, double y, double z, double t) {
return t + ((z - t) * (x / y));
}
def code(x, y, z, t): return t + ((z - t) * (x / y))
function code(x, y, z, t) return Float64(t + Float64(Float64(z - t) * Float64(x / y))) end
function tmp = code(x, y, z, t) tmp = t + ((z - t) * (x / y)); end
code[x_, y_, z_, t_] := N[(t + N[(N[(z - t), $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
t + \left(z - t\right) \cdot \frac{x}{y}
\end{array}
Initial program 96.9%
Final simplification96.9%
(FPCore (x y z t) :precision binary64 (* t (/ (- y x) y)))
double code(double x, double y, double z, double t) {
return t * ((y - x) / y);
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = t * ((y - x) / y)
end function
public static double code(double x, double y, double z, double t) {
return t * ((y - x) / y);
}
def code(x, y, z, t): return t * ((y - x) / y)
function code(x, y, z, t) return Float64(t * Float64(Float64(y - x) / y)) end
function tmp = code(x, y, z, t) tmp = t * ((y - x) / y); end
code[x_, y_, z_, t_] := N[(t * N[(N[(y - x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
t \cdot \frac{y - x}{y}
\end{array}
Initial program 96.9%
Taylor expanded in z around 0 61.5%
mul-1-neg61.5%
unsub-neg61.5%
*-rgt-identity61.5%
associate-/l*66.3%
distribute-lft-out--66.3%
Simplified66.3%
Taylor expanded in y around 0 66.3%
(FPCore (x y z t) :precision binary64 (* t (- 1.0 (/ x y))))
double code(double x, double y, double z, double t) {
return t * (1.0 - (x / y));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = t * (1.0d0 - (x / y))
end function
public static double code(double x, double y, double z, double t) {
return t * (1.0 - (x / y));
}
def code(x, y, z, t): return t * (1.0 - (x / y))
function code(x, y, z, t) return Float64(t * Float64(1.0 - Float64(x / y))) end
function tmp = code(x, y, z, t) tmp = t * (1.0 - (x / y)); end
code[x_, y_, z_, t_] := N[(t * N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
t \cdot \left(1 - \frac{x}{y}\right)
\end{array}
Initial program 96.9%
Taylor expanded in z around 0 61.5%
mul-1-neg61.5%
unsub-neg61.5%
*-rgt-identity61.5%
associate-/l*66.3%
distribute-lft-out--66.3%
Simplified66.3%
(FPCore (x y z t) :precision binary64 t)
double code(double x, double y, double z, double t) {
return 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 = t
end function
public static double code(double x, double y, double z, double t) {
return t;
}
def code(x, y, z, t): return t
function code(x, y, z, t) return t end
function tmp = code(x, y, z, t) tmp = t; end
code[x_, y_, z_, t_] := t
\begin{array}{l}
\\
t
\end{array}
Initial program 96.9%
Taylor expanded in x around 0 41.2%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (+ (* (/ x y) (- z t)) t)))
(if (< z 2.759456554562692e-282)
t_1
(if (< z 2.326994450874436e-110) (+ (* x (/ (- z t) y)) t) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = ((x / y) * (z - t)) + t;
double tmp;
if (z < 2.759456554562692e-282) {
tmp = t_1;
} else if (z < 2.326994450874436e-110) {
tmp = (x * ((z - t) / y)) + t;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = ((x / y) * (z - t)) + t
if (z < 2.759456554562692d-282) then
tmp = t_1
else if (z < 2.326994450874436d-110) then
tmp = (x * ((z - t) / y)) + t
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = ((x / y) * (z - t)) + t;
double tmp;
if (z < 2.759456554562692e-282) {
tmp = t_1;
} else if (z < 2.326994450874436e-110) {
tmp = (x * ((z - t) / y)) + t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = ((x / y) * (z - t)) + t tmp = 0 if z < 2.759456554562692e-282: tmp = t_1 elif z < 2.326994450874436e-110: tmp = (x * ((z - t) / y)) + t else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(Float64(x / y) * Float64(z - t)) + t) tmp = 0.0 if (z < 2.759456554562692e-282) tmp = t_1; elseif (z < 2.326994450874436e-110) tmp = Float64(Float64(x * Float64(Float64(z - t) / y)) + t); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = ((x / y) * (z - t)) + t; tmp = 0.0; if (z < 2.759456554562692e-282) tmp = t_1; elseif (z < 2.326994450874436e-110) tmp = (x * ((z - t) / y)) + t; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(N[(x / y), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision] + t), $MachinePrecision]}, If[Less[z, 2.759456554562692e-282], t$95$1, If[Less[z, 2.326994450874436e-110], N[(N[(x * N[(N[(z - t), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision] + t), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{y} \cdot \left(z - t\right) + t\\
\mathbf{if}\;z < 2.759456554562692 \cdot 10^{-282}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z < 2.326994450874436 \cdot 10^{-110}:\\
\;\;\;\;x \cdot \frac{z - t}{y} + t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
herbie shell --seed 2024107
(FPCore (x y z t)
:name "Numeric.Signal.Multichannel:$cget from hsignal-0.2.7.1"
:precision binary64
:alt
(if (< z 2.759456554562692e-282) (+ (* (/ x y) (- z t)) t) (if (< z 2.326994450874436e-110) (+ (* x (/ (- z t) y)) t) (+ (* (/ x y) (- z t)) t)))
(+ (* (/ x y) (- z t)) t))