
(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 (if (or (<= x -6.5e-195) (not (<= x 1.85e-152))) (+ t (* x (/ (- z t) y))) (+ t (* (/ x y) z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -6.5e-195) || !(x <= 1.85e-152)) {
tmp = t + (x * ((z - t) / 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 ((x <= (-6.5d-195)) .or. (.not. (x <= 1.85d-152))) then
tmp = t + (x * ((z - t) / 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 ((x <= -6.5e-195) || !(x <= 1.85e-152)) {
tmp = t + (x * ((z - t) / y));
} else {
tmp = t + ((x / y) * z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -6.5e-195) or not (x <= 1.85e-152): tmp = t + (x * ((z - t) / y)) else: tmp = t + ((x / y) * z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -6.5e-195) || !(x <= 1.85e-152)) tmp = Float64(t + Float64(x * Float64(Float64(z - t) / y))); else tmp = Float64(t + Float64(Float64(x / y) * z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -6.5e-195) || ~((x <= 1.85e-152))) tmp = t + (x * ((z - t) / y)); else tmp = t + ((x / y) * z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -6.5e-195], N[Not[LessEqual[x, 1.85e-152]], $MachinePrecision]], N[(t + N[(x * N[(N[(z - t), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t + N[(N[(x / y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6.5 \cdot 10^{-195} \lor \neg \left(x \leq 1.85 \cdot 10^{-152}\right):\\
\;\;\;\;t + x \cdot \frac{z - t}{y}\\
\mathbf{else}:\\
\;\;\;\;t + \frac{x}{y} \cdot z\\
\end{array}
\end{array}
if x < -6.50000000000000004e-195 or 1.8499999999999999e-152 < x Initial program 96.2%
Taylor expanded in x around 0 89.4%
associate-*r/98.9%
Simplified98.9%
if -6.50000000000000004e-195 < x < 1.8499999999999999e-152Initial program 98.5%
Taylor expanded in z around inf 97.9%
associate-*l/98.5%
*-commutative98.5%
Simplified98.5%
Final simplification98.8%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -200000.0) (not (<= (/ x y) 10.0))) (* (/ t y) (- x)) t))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -200000.0) || !((x / y) <= 10.0)) {
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 / y) <= (-200000.0d0)) .or. (.not. ((x / y) <= 10.0d0))) 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 / y) <= -200000.0) || !((x / y) <= 10.0)) {
tmp = (t / y) * -x;
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x / y) <= -200000.0) or not ((x / y) <= 10.0): tmp = (t / y) * -x else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(x / y) <= -200000.0) || !(Float64(x / y) <= 10.0)) tmp = Float64(Float64(t / y) * Float64(-x)); else tmp = t; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((x / y) <= -200000.0) || ~(((x / y) <= 10.0))) tmp = (t / y) * -x; else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(x / y), $MachinePrecision], -200000.0], N[Not[LessEqual[N[(x / y), $MachinePrecision], 10.0]], $MachinePrecision]], N[(N[(t / y), $MachinePrecision] * (-x)), $MachinePrecision], t]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -200000 \lor \neg \left(\frac{x}{y} \leq 10\right):\\
\;\;\;\;\frac{t}{y} \cdot \left(-x\right)\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if (/.f64 x y) < -2e5 or 10 < (/.f64 x y) Initial program 94.4%
Taylor expanded in z around 0 52.0%
mul-1-neg52.0%
unsub-neg52.0%
*-rgt-identity52.0%
associate-*r/52.7%
distribute-lft-out--52.7%
Simplified52.7%
Taylor expanded in x around inf 51.8%
mul-1-neg51.8%
distribute-neg-frac51.8%
Simplified51.8%
add-sqr-sqrt30.0%
sqrt-unprod32.7%
sqr-neg32.7%
sqrt-unprod3.9%
add-sqr-sqrt7.9%
clear-num7.9%
div-inv7.9%
frac-2neg7.9%
distribute-neg-frac7.9%
add-sqr-sqrt3.9%
sqrt-unprod32.0%
sqr-neg32.0%
sqrt-unprod29.2%
add-sqr-sqrt51.3%
frac-2neg51.3%
Applied egg-rr51.3%
distribute-frac-neg51.3%
associate-/r/53.1%
add-sqr-sqrt24.2%
sqrt-unprod23.4%
sqr-neg23.4%
sqrt-unprod4.0%
add-sqr-sqrt7.1%
*-commutative7.1%
add-sqr-sqrt4.0%
sqrt-unprod23.4%
sqr-neg23.4%
sqrt-unprod24.2%
add-sqr-sqrt53.1%
Applied egg-rr53.1%
if -2e5 < (/.f64 x y) < 10Initial program 98.7%
Taylor expanded in x around 0 69.3%
Final simplification61.6%
(FPCore (x y z t) :precision binary64 (if (<= (/ x y) -200000.0) (* t (/ (- x) y)) (if (<= (/ x y) 10.0) t (* (/ t y) (- x)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -200000.0) {
tmp = t * (-x / y);
} else if ((x / y) <= 10.0) {
tmp = t;
} else {
tmp = (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 ((x / y) <= (-200000.0d0)) then
tmp = t * (-x / y)
else if ((x / y) <= 10.0d0) then
tmp = t
else
tmp = (t / y) * -x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -200000.0) {
tmp = t * (-x / y);
} else if ((x / y) <= 10.0) {
tmp = t;
} else {
tmp = (t / y) * -x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x / y) <= -200000.0: tmp = t * (-x / y) elif (x / y) <= 10.0: tmp = t else: tmp = (t / y) * -x return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x / y) <= -200000.0) tmp = Float64(t * Float64(Float64(-x) / y)); elseif (Float64(x / y) <= 10.0) tmp = t; else tmp = Float64(Float64(t / y) * Float64(-x)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x / y) <= -200000.0) tmp = t * (-x / y); elseif ((x / y) <= 10.0) tmp = t; else tmp = (t / y) * -x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x / y), $MachinePrecision], -200000.0], N[(t * N[((-x) / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 10.0], t, N[(N[(t / y), $MachinePrecision] * (-x)), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -200000:\\
\;\;\;\;t \cdot \frac{-x}{y}\\
\mathbf{elif}\;\frac{x}{y} \leq 10:\\
\;\;\;\;t\\
\mathbf{else}:\\
\;\;\;\;\frac{t}{y} \cdot \left(-x\right)\\
\end{array}
\end{array}
if (/.f64 x y) < -2e5Initial program 96.1%
Taylor expanded in z around 0 48.6%
mul-1-neg48.6%
unsub-neg48.6%
*-rgt-identity48.6%
associate-*r/50.3%
distribute-lft-out--50.3%
Simplified50.3%
Taylor expanded in x around inf 49.3%
mul-1-neg49.3%
distribute-neg-frac49.3%
Simplified49.3%
if -2e5 < (/.f64 x y) < 10Initial program 98.7%
Taylor expanded in x around 0 69.3%
if 10 < (/.f64 x y) Initial program 93.2%
Taylor expanded in z around 0 54.4%
mul-1-neg54.4%
unsub-neg54.4%
*-rgt-identity54.4%
associate-*r/54.5%
distribute-lft-out--54.5%
Simplified54.5%
Taylor expanded in x around inf 53.6%
mul-1-neg53.6%
distribute-neg-frac53.6%
Simplified53.6%
add-sqr-sqrt32.4%
sqrt-unprod34.8%
sqr-neg34.8%
sqrt-unprod3.2%
add-sqr-sqrt8.1%
clear-num8.1%
div-inv8.1%
frac-2neg8.1%
distribute-neg-frac8.1%
add-sqr-sqrt3.2%
sqrt-unprod33.6%
sqr-neg33.6%
sqrt-unprod31.1%
add-sqr-sqrt52.5%
frac-2neg52.5%
Applied egg-rr52.5%
distribute-frac-neg52.5%
associate-/r/55.9%
add-sqr-sqrt26.4%
sqrt-unprod22.6%
sqr-neg22.6%
sqrt-unprod2.0%
add-sqr-sqrt6.8%
*-commutative6.8%
add-sqr-sqrt2.0%
sqrt-unprod22.6%
sqr-neg22.6%
sqrt-unprod26.4%
add-sqr-sqrt55.9%
Applied egg-rr55.9%
Final simplification61.6%
(FPCore (x y z t) :precision binary64 (if (<= (/ x y) -200000.0) (/ (- t) (/ y x)) (if (<= (/ x y) 10.0) t (* (/ t y) (- x)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -200000.0) {
tmp = -t / (y / x);
} else if ((x / y) <= 10.0) {
tmp = t;
} else {
tmp = (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 ((x / y) <= (-200000.0d0)) then
tmp = -t / (y / x)
else if ((x / y) <= 10.0d0) then
tmp = t
else
tmp = (t / y) * -x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -200000.0) {
tmp = -t / (y / x);
} else if ((x / y) <= 10.0) {
tmp = t;
} else {
tmp = (t / y) * -x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x / y) <= -200000.0: tmp = -t / (y / x) elif (x / y) <= 10.0: tmp = t else: tmp = (t / y) * -x return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x / y) <= -200000.0) tmp = Float64(Float64(-t) / Float64(y / x)); elseif (Float64(x / y) <= 10.0) tmp = t; else tmp = Float64(Float64(t / y) * Float64(-x)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x / y) <= -200000.0) tmp = -t / (y / x); elseif ((x / y) <= 10.0) tmp = t; else tmp = (t / y) * -x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x / y), $MachinePrecision], -200000.0], N[((-t) / N[(y / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 10.0], t, N[(N[(t / y), $MachinePrecision] * (-x)), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -200000:\\
\;\;\;\;\frac{-t}{\frac{y}{x}}\\
\mathbf{elif}\;\frac{x}{y} \leq 10:\\
\;\;\;\;t\\
\mathbf{else}:\\
\;\;\;\;\frac{t}{y} \cdot \left(-x\right)\\
\end{array}
\end{array}
if (/.f64 x y) < -2e5Initial program 96.1%
Taylor expanded in z around 0 48.6%
mul-1-neg48.6%
unsub-neg48.6%
*-rgt-identity48.6%
associate-*r/50.3%
distribute-lft-out--50.3%
Simplified50.3%
Taylor expanded in x around inf 49.3%
mul-1-neg49.3%
distribute-neg-frac49.3%
Simplified49.3%
add-sqr-sqrt26.6%
sqrt-unprod29.7%
sqr-neg29.7%
sqrt-unprod5.0%
add-sqr-sqrt7.7%
clear-num7.7%
div-inv7.7%
frac-2neg7.7%
distribute-neg-frac7.7%
add-sqr-sqrt5.0%
sqrt-unprod29.7%
sqr-neg29.7%
sqrt-unprod26.6%
add-sqr-sqrt49.5%
frac-2neg49.5%
Applied egg-rr49.5%
if -2e5 < (/.f64 x y) < 10Initial program 98.7%
Taylor expanded in x around 0 69.3%
if 10 < (/.f64 x y) Initial program 93.2%
Taylor expanded in z around 0 54.4%
mul-1-neg54.4%
unsub-neg54.4%
*-rgt-identity54.4%
associate-*r/54.5%
distribute-lft-out--54.5%
Simplified54.5%
Taylor expanded in x around inf 53.6%
mul-1-neg53.6%
distribute-neg-frac53.6%
Simplified53.6%
add-sqr-sqrt32.4%
sqrt-unprod34.8%
sqr-neg34.8%
sqrt-unprod3.2%
add-sqr-sqrt8.1%
clear-num8.1%
div-inv8.1%
frac-2neg8.1%
distribute-neg-frac8.1%
add-sqr-sqrt3.2%
sqrt-unprod33.6%
sqr-neg33.6%
sqrt-unprod31.1%
add-sqr-sqrt52.5%
frac-2neg52.5%
Applied egg-rr52.5%
distribute-frac-neg52.5%
associate-/r/55.9%
add-sqr-sqrt26.4%
sqrt-unprod22.6%
sqr-neg22.6%
sqrt-unprod2.0%
add-sqr-sqrt6.8%
*-commutative6.8%
add-sqr-sqrt2.0%
sqrt-unprod22.6%
sqr-neg22.6%
sqrt-unprod26.4%
add-sqr-sqrt55.9%
Applied egg-rr55.9%
Final simplification61.6%
(FPCore (x y z t) :precision binary64 (if (or (<= t -4e+67) (not (<= t 1.38e+54))) (* t (- 1.0 (/ x y))) (+ t (* (/ x y) z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -4e+67) || !(t <= 1.38e+54)) {
tmp = t * (1.0 - (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 <= (-4d+67)) .or. (.not. (t <= 1.38d+54))) then
tmp = t * (1.0d0 - (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 <= -4e+67) || !(t <= 1.38e+54)) {
tmp = t * (1.0 - (x / y));
} else {
tmp = t + ((x / y) * z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -4e+67) or not (t <= 1.38e+54): tmp = t * (1.0 - (x / y)) else: tmp = t + ((x / y) * z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -4e+67) || !(t <= 1.38e+54)) tmp = Float64(t * Float64(1.0 - Float64(x / y))); else tmp = Float64(t + Float64(Float64(x / y) * z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -4e+67) || ~((t <= 1.38e+54))) tmp = t * (1.0 - (x / y)); else tmp = t + ((x / y) * z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -4e+67], N[Not[LessEqual[t, 1.38e+54]], $MachinePrecision]], N[(t * N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t + N[(N[(x / y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4 \cdot 10^{+67} \lor \neg \left(t \leq 1.38 \cdot 10^{+54}\right):\\
\;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;t + \frac{x}{y} \cdot z\\
\end{array}
\end{array}
if t < -3.99999999999999993e67 or 1.38e54 < t Initial program 99.9%
Taylor expanded in z around 0 78.3%
mul-1-neg78.3%
unsub-neg78.3%
*-rgt-identity78.3%
associate-*r/86.5%
distribute-lft-out--86.5%
Simplified86.5%
if -3.99999999999999993e67 < t < 1.38e54Initial program 94.4%
Taylor expanded in z around inf 79.3%
associate-*l/83.7%
*-commutative83.7%
Simplified83.7%
Final simplification84.8%
(FPCore (x y z t) :precision binary64 (if (<= t -2.1e+67) (- t (* (/ x y) t)) (if (<= t 6.3e+55) (+ t (* (/ x y) z)) (* t (- 1.0 (/ x y))))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -2.1e+67) {
tmp = t - ((x / y) * t);
} else if (t <= 6.3e+55) {
tmp = t + ((x / y) * z);
} else {
tmp = t * (1.0 - (x / 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 <= (-2.1d+67)) then
tmp = t - ((x / y) * t)
else if (t <= 6.3d+55) then
tmp = t + ((x / y) * z)
else
tmp = t * (1.0d0 - (x / y))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= -2.1e+67) {
tmp = t - ((x / y) * t);
} else if (t <= 6.3e+55) {
tmp = t + ((x / y) * z);
} else {
tmp = t * (1.0 - (x / y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -2.1e+67: tmp = t - ((x / y) * t) elif t <= 6.3e+55: tmp = t + ((x / y) * z) else: tmp = t * (1.0 - (x / y)) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -2.1e+67) tmp = Float64(t - Float64(Float64(x / y) * t)); elseif (t <= 6.3e+55) tmp = Float64(t + Float64(Float64(x / y) * z)); else tmp = Float64(t * Float64(1.0 - Float64(x / y))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -2.1e+67) tmp = t - ((x / y) * t); elseif (t <= 6.3e+55) tmp = t + ((x / y) * z); else tmp = t * (1.0 - (x / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -2.1e+67], N[(t - N[(N[(x / y), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 6.3e+55], N[(t + N[(N[(x / y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], N[(t * N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.1 \cdot 10^{+67}:\\
\;\;\;\;t - \frac{x}{y} \cdot t\\
\mathbf{elif}\;t \leq 6.3 \cdot 10^{+55}:\\
\;\;\;\;t + \frac{x}{y} \cdot z\\
\mathbf{else}:\\
\;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\
\end{array}
\end{array}
if t < -2.1000000000000001e67Initial program 99.9%
*-commutative99.9%
clear-num99.9%
un-div-inv99.9%
Applied egg-rr99.9%
Taylor expanded in z around 0 73.5%
associate-*r/80.9%
neg-mul-180.9%
sub-neg80.9%
Simplified80.9%
if -2.1000000000000001e67 < t < 6.2999999999999996e55Initial program 94.4%
Taylor expanded in z around inf 79.3%
associate-*l/83.7%
*-commutative83.7%
Simplified83.7%
if 6.2999999999999996e55 < t Initial program 100.0%
Taylor expanded in z around 0 83.8%
mul-1-neg83.8%
unsub-neg83.8%
*-rgt-identity83.8%
associate-*r/92.9%
distribute-lft-out--92.9%
Simplified92.9%
Final simplification84.8%
(FPCore (x y z t) :precision binary64 (if (<= x 1.5e-7) (+ t (* (/ x y) (- z t))) (+ t (* x (/ (- z t) y)))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= 1.5e-7) {
tmp = t + ((x / y) * (z - t));
} else {
tmp = t + (x * ((z - t) / 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 (x <= 1.5d-7) then
tmp = t + ((x / y) * (z - t))
else
tmp = t + (x * ((z - t) / y))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= 1.5e-7) {
tmp = t + ((x / y) * (z - t));
} else {
tmp = t + (x * ((z - t) / y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= 1.5e-7: tmp = t + ((x / y) * (z - t)) else: tmp = t + (x * ((z - t) / y)) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= 1.5e-7) tmp = Float64(t + Float64(Float64(x / y) * Float64(z - t))); else tmp = Float64(t + Float64(x * Float64(Float64(z - t) / y))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= 1.5e-7) tmp = t + ((x / y) * (z - t)); else tmp = t + (x * ((z - t) / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, 1.5e-7], N[(t + N[(N[(x / y), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t + N[(x * N[(N[(z - t), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.5 \cdot 10^{-7}:\\
\;\;\;\;t + \frac{x}{y} \cdot \left(z - t\right)\\
\mathbf{else}:\\
\;\;\;\;t + x \cdot \frac{z - t}{y}\\
\end{array}
\end{array}
if x < 1.4999999999999999e-7Initial program 98.5%
if 1.4999999999999999e-7 < x Initial program 91.6%
Taylor expanded in x around 0 83.5%
associate-*r/99.5%
Simplified99.5%
Final simplification98.7%
(FPCore (x y z t) :precision binary64 (if (<= (/ x y) 1e+109) t (* (/ x y) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= 1e+109) {
tmp = t;
} 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 / y) <= 1d+109) then
tmp = t
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 / y) <= 1e+109) {
tmp = t;
} else {
tmp = (x / y) * t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x / y) <= 1e+109: tmp = t else: tmp = (x / y) * t return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x / y) <= 1e+109) tmp = t; else tmp = Float64(Float64(x / y) * t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x / y) <= 1e+109) tmp = t; else tmp = (x / y) * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x / y), $MachinePrecision], 1e+109], t, N[(N[(x / y), $MachinePrecision] * t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq 10^{+109}:\\
\;\;\;\;t\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} \cdot t\\
\end{array}
\end{array}
if (/.f64 x y) < 9.99999999999999982e108Initial program 98.1%
Taylor expanded in x around 0 47.8%
if 9.99999999999999982e108 < (/.f64 x y) Initial program 91.7%
Taylor expanded in z around 0 55.2%
mul-1-neg55.2%
unsub-neg55.2%
*-rgt-identity55.2%
associate-*r/52.6%
distribute-lft-out--52.6%
Simplified52.6%
Taylor expanded in x around inf 52.6%
mul-1-neg52.6%
distribute-neg-frac52.6%
Simplified52.6%
expm1-log1p-u28.6%
expm1-udef28.6%
add-sqr-sqrt15.9%
sqrt-unprod18.2%
sqr-neg18.2%
sqrt-unprod3.7%
add-sqr-sqrt5.8%
clear-num5.8%
div-inv5.8%
div-inv5.8%
clear-num5.8%
Applied egg-rr5.8%
expm1-def5.8%
expm1-log1p9.8%
Simplified9.8%
Final simplification39.3%
(FPCore (x y z t) :precision binary64 (if (<= (/ x y) 1e+109) t (/ t (/ y x))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= 1e+109) {
tmp = t;
} else {
tmp = 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 ((x / y) <= 1d+109) then
tmp = t
else
tmp = t / (y / x)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= 1e+109) {
tmp = t;
} else {
tmp = t / (y / x);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x / y) <= 1e+109: tmp = t else: tmp = t / (y / x) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x / y) <= 1e+109) tmp = t; else tmp = Float64(t / Float64(y / x)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x / y) <= 1e+109) tmp = t; else tmp = t / (y / x); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x / y), $MachinePrecision], 1e+109], t, N[(t / N[(y / x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq 10^{+109}:\\
\;\;\;\;t\\
\mathbf{else}:\\
\;\;\;\;\frac{t}{\frac{y}{x}}\\
\end{array}
\end{array}
if (/.f64 x y) < 9.99999999999999982e108Initial program 98.1%
Taylor expanded in x around 0 47.8%
if 9.99999999999999982e108 < (/.f64 x y) Initial program 91.7%
Taylor expanded in z around 0 55.2%
mul-1-neg55.2%
unsub-neg55.2%
*-rgt-identity55.2%
associate-*r/52.6%
distribute-lft-out--52.6%
Simplified52.6%
Taylor expanded in x around inf 52.6%
mul-1-neg52.6%
distribute-neg-frac52.6%
Simplified52.6%
add-sqr-sqrt30.5%
sqrt-unprod36.0%
sqr-neg36.0%
sqrt-unprod3.9%
add-sqr-sqrt9.8%
clear-num9.8%
div-inv9.8%
Applied egg-rr9.8%
Final simplification39.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.6%
Taylor expanded in z around 0 59.4%
mul-1-neg59.4%
unsub-neg59.4%
*-rgt-identity59.4%
associate-*r/62.3%
distribute-lft-out--62.3%
Simplified62.3%
Final simplification62.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.6%
Taylor expanded in x around 0 37.5%
Final simplification37.5%
(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 2024019
(FPCore (x y z t)
:name "Numeric.Signal.Multichannel:$cget from hsignal-0.2.7.1"
:precision binary64
:herbie-target
(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))