
(FPCore (x y z t) :precision binary64 (+ x (/ (* (- y x) z) t)))
double code(double x, double y, double z, double t) {
return x + (((y - x) * z) / 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 - x) * z) / t)
end function
public static double code(double x, double y, double z, double t) {
return x + (((y - x) * z) / t);
}
def code(x, y, z, t): return x + (((y - x) * z) / t)
function code(x, y, z, t) return Float64(x + Float64(Float64(Float64(y - x) * z) / t)) end
function tmp = code(x, y, z, t) tmp = x + (((y - x) * z) / t); end
code[x_, y_, z_, t_] := N[(x + N[(N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{\left(y - x\right) \cdot z}{t}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (+ x (/ (* (- y x) z) t)))
double code(double x, double y, double z, double t) {
return x + (((y - x) * z) / 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 - x) * z) / t)
end function
public static double code(double x, double y, double z, double t) {
return x + (((y - x) * z) / t);
}
def code(x, y, z, t): return x + (((y - x) * z) / t)
function code(x, y, z, t) return Float64(x + Float64(Float64(Float64(y - x) * z) / t)) end
function tmp = code(x, y, z, t) tmp = x + (((y - x) * z) / t); end
code[x_, y_, z_, t_] := N[(x + N[(N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{\left(y - x\right) \cdot z}{t}
\end{array}
(FPCore (x y z t) :precision binary64 (+ x (/ (- y x) (/ t z))))
double code(double x, double y, double z, double t) {
return x + ((y - x) / (t / z));
}
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 - x) / (t / z))
end function
public static double code(double x, double y, double z, double t) {
return x + ((y - x) / (t / z));
}
def code(x, y, z, t): return x + ((y - x) / (t / z))
function code(x, y, z, t) return Float64(x + Float64(Float64(y - x) / Float64(t / z))) end
function tmp = code(x, y, z, t) tmp = x + ((y - x) / (t / z)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(y - x), $MachinePrecision] / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y - x}{\frac{t}{z}}
\end{array}
Initial program 91.1%
associate-/l*97.9%
Simplified97.9%
Final simplification97.9%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (+ x (/ (* (- y x) z) t)))) (if (or (<= t_1 -2e+301) (not (<= t_1 2e+307))) (/ (- y x) (/ t z)) t_1)))
double code(double x, double y, double z, double t) {
double t_1 = x + (((y - x) * z) / t);
double tmp;
if ((t_1 <= -2e+301) || !(t_1 <= 2e+307)) {
tmp = (y - x) / (t / z);
} 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 - x) * z) / t)
if ((t_1 <= (-2d+301)) .or. (.not. (t_1 <= 2d+307))) then
tmp = (y - x) / (t / z)
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 - x) * z) / t);
double tmp;
if ((t_1 <= -2e+301) || !(t_1 <= 2e+307)) {
tmp = (y - x) / (t / z);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x + (((y - x) * z) / t) tmp = 0 if (t_1 <= -2e+301) or not (t_1 <= 2e+307): tmp = (y - x) / (t / z) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x + Float64(Float64(Float64(y - x) * z) / t)) tmp = 0.0 if ((t_1 <= -2e+301) || !(t_1 <= 2e+307)) tmp = Float64(Float64(y - x) / Float64(t / z)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x + (((y - x) * z) / t); tmp = 0.0; if ((t_1 <= -2e+301) || ~((t_1 <= 2e+307))) tmp = (y - x) / (t / z); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x + N[(N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, -2e+301], N[Not[LessEqual[t$95$1, 2e+307]], $MachinePrecision]], N[(N[(y - x), $MachinePrecision] / N[(t / z), $MachinePrecision]), $MachinePrecision], t$95$1]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \frac{\left(y - x\right) \cdot z}{t}\\
\mathbf{if}\;t_1 \leq -2 \cdot 10^{+301} \lor \neg \left(t_1 \leq 2 \cdot 10^{+307}\right):\\
\;\;\;\;\frac{y - x}{\frac{t}{z}}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if (+.f64 x (/.f64 (*.f64 (-.f64 y x) z) t)) < -2.00000000000000011e301 or 1.99999999999999997e307 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) z) t)) Initial program 75.6%
Taylor expanded in z around inf 85.0%
Taylor expanded in y around 0 60.4%
associate-*r/68.5%
+-commutative68.5%
mul-1-neg68.5%
associate-*r/75.3%
unsub-neg75.3%
associate-*r/64.2%
associate-/l*77.5%
*-commutative77.5%
associate-/r/74.2%
div-sub91.6%
Simplified91.6%
if -2.00000000000000011e301 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) z) t)) < 1.99999999999999997e307Initial program 99.8%
Final simplification96.9%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- x (/ x (/ t z)))))
(if (<= x -1.65e-12)
t_1
(if (<= x -2.2e-87)
(/ (- y x) (/ t z))
(if (<= x -1.92e-295)
(+ x (* z (/ y t)))
(if (<= x 4.6e+64) (+ x (/ y (/ t z))) t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = x - (x / (t / z));
double tmp;
if (x <= -1.65e-12) {
tmp = t_1;
} else if (x <= -2.2e-87) {
tmp = (y - x) / (t / z);
} else if (x <= -1.92e-295) {
tmp = x + (z * (y / t));
} else if (x <= 4.6e+64) {
tmp = x + (y / (t / z));
} 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 - (x / (t / z))
if (x <= (-1.65d-12)) then
tmp = t_1
else if (x <= (-2.2d-87)) then
tmp = (y - x) / (t / z)
else if (x <= (-1.92d-295)) then
tmp = x + (z * (y / t))
else if (x <= 4.6d+64) then
tmp = x + (y / (t / z))
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 - (x / (t / z));
double tmp;
if (x <= -1.65e-12) {
tmp = t_1;
} else if (x <= -2.2e-87) {
tmp = (y - x) / (t / z);
} else if (x <= -1.92e-295) {
tmp = x + (z * (y / t));
} else if (x <= 4.6e+64) {
tmp = x + (y / (t / z));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x - (x / (t / z)) tmp = 0 if x <= -1.65e-12: tmp = t_1 elif x <= -2.2e-87: tmp = (y - x) / (t / z) elif x <= -1.92e-295: tmp = x + (z * (y / t)) elif x <= 4.6e+64: tmp = x + (y / (t / z)) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x - Float64(x / Float64(t / z))) tmp = 0.0 if (x <= -1.65e-12) tmp = t_1; elseif (x <= -2.2e-87) tmp = Float64(Float64(y - x) / Float64(t / z)); elseif (x <= -1.92e-295) tmp = Float64(x + Float64(z * Float64(y / t))); elseif (x <= 4.6e+64) tmp = Float64(x + Float64(y / Float64(t / z))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x - (x / (t / z)); tmp = 0.0; if (x <= -1.65e-12) tmp = t_1; elseif (x <= -2.2e-87) tmp = (y - x) / (t / z); elseif (x <= -1.92e-295) tmp = x + (z * (y / t)); elseif (x <= 4.6e+64) tmp = x + (y / (t / z)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x - N[(x / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.65e-12], t$95$1, If[LessEqual[x, -2.2e-87], N[(N[(y - x), $MachinePrecision] / N[(t / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -1.92e-295], N[(x + N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 4.6e+64], N[(x + N[(y / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x - \frac{x}{\frac{t}{z}}\\
\mathbf{if}\;x \leq -1.65 \cdot 10^{-12}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -2.2 \cdot 10^{-87}:\\
\;\;\;\;\frac{y - x}{\frac{t}{z}}\\
\mathbf{elif}\;x \leq -1.92 \cdot 10^{-295}:\\
\;\;\;\;x + z \cdot \frac{y}{t}\\
\mathbf{elif}\;x \leq 4.6 \cdot 10^{+64}:\\
\;\;\;\;x + \frac{y}{\frac{t}{z}}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if x < -1.65e-12 or 4.6e64 < x Initial program 88.1%
Taylor expanded in x around inf 91.8%
*-commutative91.8%
distribute-rgt-in91.7%
*-lft-identity91.7%
mul-1-neg91.7%
cancel-sign-sub-inv91.7%
*-commutative91.7%
Simplified91.7%
clear-num91.7%
un-div-inv91.8%
Applied egg-rr91.8%
if -1.65e-12 < x < -2.19999999999999988e-87Initial program 88.4%
Taylor expanded in z around inf 83.0%
Taylor expanded in y around 0 82.7%
associate-*r/94.1%
+-commutative94.1%
mul-1-neg94.1%
associate-*r/94.1%
unsub-neg94.1%
associate-*r/82.7%
associate-/l*94.0%
*-commutative94.0%
associate-/r/94.0%
div-sub94.0%
Simplified94.0%
if -2.19999999999999988e-87 < x < -1.91999999999999997e-295Initial program 91.3%
Taylor expanded in y around inf 80.3%
associate-*l/88.0%
*-commutative88.0%
Simplified88.0%
if -1.91999999999999997e-295 < x < 4.6e64Initial program 97.1%
Taylor expanded in y around inf 82.6%
associate-*r/54.8%
Simplified85.3%
clear-num54.8%
un-div-inv55.6%
Applied egg-rr86.0%
Final simplification89.7%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (/ z t) (- x))))
(if (<= z -6e-16)
t_1
(if (<= z 6e-13) x (if (<= z 1.3e+287) t_1 (* y (/ z t)))))))
double code(double x, double y, double z, double t) {
double t_1 = (z / t) * -x;
double tmp;
if (z <= -6e-16) {
tmp = t_1;
} else if (z <= 6e-13) {
tmp = x;
} else if (z <= 1.3e+287) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_1 = (z / t) * -x
if (z <= (-6d-16)) then
tmp = t_1
else if (z <= 6d-13) then
tmp = x
else if (z <= 1.3d+287) then
tmp = t_1
else
tmp = y * (z / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (z / t) * -x;
double tmp;
if (z <= -6e-16) {
tmp = t_1;
} else if (z <= 6e-13) {
tmp = x;
} else if (z <= 1.3e+287) {
tmp = t_1;
} else {
tmp = y * (z / t);
}
return tmp;
}
def code(x, y, z, t): t_1 = (z / t) * -x tmp = 0 if z <= -6e-16: tmp = t_1 elif z <= 6e-13: tmp = x elif z <= 1.3e+287: tmp = t_1 else: tmp = y * (z / t) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(z / t) * Float64(-x)) tmp = 0.0 if (z <= -6e-16) tmp = t_1; elseif (z <= 6e-13) tmp = x; elseif (z <= 1.3e+287) tmp = t_1; else tmp = Float64(y * Float64(z / t)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (z / t) * -x; tmp = 0.0; if (z <= -6e-16) tmp = t_1; elseif (z <= 6e-13) tmp = x; elseif (z <= 1.3e+287) tmp = t_1; else tmp = y * (z / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(z / t), $MachinePrecision] * (-x)), $MachinePrecision]}, If[LessEqual[z, -6e-16], t$95$1, If[LessEqual[z, 6e-13], x, If[LessEqual[z, 1.3e+287], t$95$1, N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z}{t} \cdot \left(-x\right)\\
\mathbf{if}\;z \leq -6 \cdot 10^{-16}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 6 \cdot 10^{-13}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 1.3 \cdot 10^{+287}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{z}{t}\\
\end{array}
\end{array}
if z < -5.99999999999999987e-16 or 5.99999999999999968e-13 < z < 1.3000000000000001e287Initial program 86.0%
Taylor expanded in t around 0 74.0%
Taylor expanded in y around 0 46.1%
associate-*r/46.1%
mul-1-neg46.1%
distribute-rgt-neg-out46.1%
associate-*l/49.9%
Simplified49.9%
if -5.99999999999999987e-16 < z < 5.99999999999999968e-13Initial program 99.9%
Taylor expanded in z around 0 67.0%
if 1.3000000000000001e287 < z Initial program 76.5%
Taylor expanded in t around 0 76.5%
Taylor expanded in y around inf 76.5%
associate-*r/88.1%
Simplified88.1%
Final simplification57.8%
(FPCore (x y z t) :precision binary64 (if (<= z -7.2e-19) (/ x (- (/ t z))) (if (<= z 4.2e-13) x (if (<= z 8e+292) (* (/ z t) (- x)) (* y (/ z t))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -7.2e-19) {
tmp = x / -(t / z);
} else if (z <= 4.2e-13) {
tmp = x;
} else if (z <= 8e+292) {
tmp = (z / t) * -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 (z <= (-7.2d-19)) then
tmp = x / -(t / z)
else if (z <= 4.2d-13) then
tmp = x
else if (z <= 8d+292) then
tmp = (z / t) * -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 (z <= -7.2e-19) {
tmp = x / -(t / z);
} else if (z <= 4.2e-13) {
tmp = x;
} else if (z <= 8e+292) {
tmp = (z / t) * -x;
} else {
tmp = y * (z / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -7.2e-19: tmp = x / -(t / z) elif z <= 4.2e-13: tmp = x elif z <= 8e+292: tmp = (z / t) * -x else: tmp = y * (z / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -7.2e-19) tmp = Float64(x / Float64(-Float64(t / z))); elseif (z <= 4.2e-13) tmp = x; elseif (z <= 8e+292) tmp = Float64(Float64(z / t) * Float64(-x)); else tmp = Float64(y * Float64(z / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -7.2e-19) tmp = x / -(t / z); elseif (z <= 4.2e-13) tmp = x; elseif (z <= 8e+292) tmp = (z / t) * -x; else tmp = y * (z / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -7.2e-19], N[(x / (-N[(t / z), $MachinePrecision])), $MachinePrecision], If[LessEqual[z, 4.2e-13], x, If[LessEqual[z, 8e+292], N[(N[(z / t), $MachinePrecision] * (-x)), $MachinePrecision], N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.2 \cdot 10^{-19}:\\
\;\;\;\;\frac{x}{-\frac{t}{z}}\\
\mathbf{elif}\;z \leq 4.2 \cdot 10^{-13}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 8 \cdot 10^{+292}:\\
\;\;\;\;\frac{z}{t} \cdot \left(-x\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{z}{t}\\
\end{array}
\end{array}
if z < -7.2000000000000002e-19Initial program 83.0%
Taylor expanded in z around inf 77.5%
Taylor expanded in y around 0 45.7%
mul-1-neg45.7%
distribute-frac-neg45.7%
Simplified45.7%
associate-*l/44.1%
associate-/l*48.7%
add-sqr-sqrt26.8%
sqrt-unprod25.2%
sqr-neg25.2%
sqrt-unprod2.6%
add-sqr-sqrt4.6%
frac-2neg4.6%
add-sqr-sqrt2.1%
sqrt-unprod16.5%
sqr-neg16.5%
sqrt-unprod21.8%
add-sqr-sqrt48.7%
distribute-neg-frac48.7%
Applied egg-rr48.7%
if -7.2000000000000002e-19 < z < 4.19999999999999977e-13Initial program 99.9%
Taylor expanded in z around 0 67.0%
if 4.19999999999999977e-13 < z < 8.0000000000000001e292Initial program 88.4%
Taylor expanded in t around 0 77.2%
Taylor expanded in y around 0 47.7%
associate-*r/47.7%
mul-1-neg47.7%
distribute-rgt-neg-out47.7%
associate-*l/50.8%
Simplified50.8%
if 8.0000000000000001e292 < z Initial program 76.5%
Taylor expanded in t around 0 76.5%
Taylor expanded in y around inf 76.5%
associate-*r/88.1%
Simplified88.1%
Final simplification57.8%
(FPCore (x y z t) :precision binary64 (if (or (<= z 2.3e+238) (not (<= z 3.4e+293))) (+ x (* y (/ z t))) (/ x (- (/ t z)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= 2.3e+238) || !(z <= 3.4e+293)) {
tmp = x + (y * (z / t));
} else {
tmp = x / -(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 <= 2.3d+238) .or. (.not. (z <= 3.4d+293))) then
tmp = x + (y * (z / t))
else
tmp = x / -(t / z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= 2.3e+238) || !(z <= 3.4e+293)) {
tmp = x + (y * (z / t));
} else {
tmp = x / -(t / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= 2.3e+238) or not (z <= 3.4e+293): tmp = x + (y * (z / t)) else: tmp = x / -(t / z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= 2.3e+238) || !(z <= 3.4e+293)) tmp = Float64(x + Float64(y * Float64(z / t))); else tmp = Float64(x / Float64(-Float64(t / z))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= 2.3e+238) || ~((z <= 3.4e+293))) tmp = x + (y * (z / t)); else tmp = x / -(t / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, 2.3e+238], N[Not[LessEqual[z, 3.4e+293]], $MachinePrecision]], N[(x + N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x / (-N[(t / z), $MachinePrecision])), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 2.3 \cdot 10^{+238} \lor \neg \left(z \leq 3.4 \cdot 10^{+293}\right):\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{-\frac{t}{z}}\\
\end{array}
\end{array}
if z < 2.30000000000000003e238 or 3.4000000000000003e293 < z Initial program 91.0%
Taylor expanded in y around inf 71.0%
associate-*r/38.7%
Simplified76.2%
if 2.30000000000000003e238 < z < 3.4000000000000003e293Initial program 93.8%
Taylor expanded in z around inf 91.4%
Taylor expanded in y around 0 65.1%
mul-1-neg65.1%
distribute-frac-neg65.1%
Simplified65.1%
associate-*l/66.1%
associate-/l*72.0%
add-sqr-sqrt30.6%
sqrt-unprod31.2%
sqr-neg31.2%
sqrt-unprod0.3%
add-sqr-sqrt0.7%
frac-2neg0.7%
add-sqr-sqrt0.4%
sqrt-unprod35.1%
sqr-neg35.1%
sqrt-unprod41.1%
add-sqr-sqrt72.0%
distribute-neg-frac72.0%
Applied egg-rr72.0%
Final simplification75.9%
(FPCore (x y z t) :precision binary64 (if (or (<= x -3.2e-26) (not (<= x 9.5e+59))) (- x (* x (/ z t))) (+ x (/ y (/ t z)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -3.2e-26) || !(x <= 9.5e+59)) {
tmp = x - (x * (z / t));
} else {
tmp = x + (y / (t / z));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((x <= (-3.2d-26)) .or. (.not. (x <= 9.5d+59))) then
tmp = x - (x * (z / t))
else
tmp = x + (y / (t / z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -3.2e-26) || !(x <= 9.5e+59)) {
tmp = x - (x * (z / t));
} else {
tmp = x + (y / (t / z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -3.2e-26) or not (x <= 9.5e+59): tmp = x - (x * (z / t)) else: tmp = x + (y / (t / z)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -3.2e-26) || !(x <= 9.5e+59)) tmp = Float64(x - Float64(x * Float64(z / t))); 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 ((x <= -3.2e-26) || ~((x <= 9.5e+59))) tmp = x - (x * (z / t)); else tmp = x + (y / (t / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -3.2e-26], N[Not[LessEqual[x, 9.5e+59]], $MachinePrecision]], N[(x - N[(x * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.2 \cdot 10^{-26} \lor \neg \left(x \leq 9.5 \cdot 10^{+59}\right):\\
\;\;\;\;x - x \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{\frac{t}{z}}\\
\end{array}
\end{array}
if x < -3.2000000000000001e-26 or 9.50000000000000023e59 < x Initial program 88.4%
Taylor expanded in x around inf 91.7%
*-commutative91.7%
distribute-rgt-in91.6%
*-lft-identity91.6%
mul-1-neg91.6%
cancel-sign-sub-inv91.6%
*-commutative91.6%
Simplified91.6%
if -3.2000000000000001e-26 < x < 9.50000000000000023e59Initial program 93.9%
Taylor expanded in y around inf 79.2%
associate-*r/57.7%
Simplified83.6%
clear-num57.7%
un-div-inv58.1%
Applied egg-rr84.0%
Final simplification87.8%
(FPCore (x y z t) :precision binary64 (if (or (<= x -3.1e-27) (not (<= x 1.2e+66))) (- x (/ x (/ t z))) (+ x (/ y (/ t z)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -3.1e-27) || !(x <= 1.2e+66)) {
tmp = x - (x / (t / z));
} else {
tmp = x + (y / (t / z));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((x <= (-3.1d-27)) .or. (.not. (x <= 1.2d+66))) then
tmp = x - (x / (t / z))
else
tmp = x + (y / (t / z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -3.1e-27) || !(x <= 1.2e+66)) {
tmp = x - (x / (t / z));
} else {
tmp = x + (y / (t / z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -3.1e-27) or not (x <= 1.2e+66): tmp = x - (x / (t / z)) else: tmp = x + (y / (t / z)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -3.1e-27) || !(x <= 1.2e+66)) tmp = Float64(x - Float64(x / Float64(t / z))); 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 ((x <= -3.1e-27) || ~((x <= 1.2e+66))) tmp = x - (x / (t / z)); else tmp = x + (y / (t / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -3.1e-27], N[Not[LessEqual[x, 1.2e+66]], $MachinePrecision]], N[(x - N[(x / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.1 \cdot 10^{-27} \lor \neg \left(x \leq 1.2 \cdot 10^{+66}\right):\\
\;\;\;\;x - \frac{x}{\frac{t}{z}}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{\frac{t}{z}}\\
\end{array}
\end{array}
if x < -3.0999999999999998e-27 or 1.2000000000000001e66 < x Initial program 88.4%
Taylor expanded in x around inf 91.7%
*-commutative91.7%
distribute-rgt-in91.6%
*-lft-identity91.6%
mul-1-neg91.6%
cancel-sign-sub-inv91.6%
*-commutative91.6%
Simplified91.6%
clear-num91.6%
un-div-inv91.7%
Applied egg-rr91.7%
if -3.0999999999999998e-27 < x < 1.2000000000000001e66Initial program 93.9%
Taylor expanded in y around inf 79.2%
associate-*r/57.7%
Simplified83.6%
clear-num57.7%
un-div-inv58.1%
Applied egg-rr84.0%
Final simplification87.8%
(FPCore (x y z t) :precision binary64 (if (or (<= z -4.4e-131) (not (<= z 5.5e-13))) (* y (/ z t)) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -4.4e-131) || !(z <= 5.5e-13)) {
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 ((z <= (-4.4d-131)) .or. (.not. (z <= 5.5d-13))) 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 ((z <= -4.4e-131) || !(z <= 5.5e-13)) {
tmp = y * (z / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -4.4e-131) or not (z <= 5.5e-13): tmp = y * (z / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -4.4e-131) || !(z <= 5.5e-13)) 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 ((z <= -4.4e-131) || ~((z <= 5.5e-13))) tmp = y * (z / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -4.4e-131], N[Not[LessEqual[z, 5.5e-13]], $MachinePrecision]], N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.4 \cdot 10^{-131} \lor \neg \left(z \leq 5.5 \cdot 10^{-13}\right):\\
\;\;\;\;y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -4.3999999999999999e-131 or 5.49999999999999979e-13 < z Initial program 86.6%
Taylor expanded in t around 0 73.4%
Taylor expanded in y around inf 40.1%
associate-*r/45.2%
Simplified45.2%
if -4.3999999999999999e-131 < z < 5.49999999999999979e-13Initial program 100.0%
Taylor expanded in z around 0 72.6%
Final simplification54.4%
(FPCore (x y z t) :precision binary64 (if (<= z -4.4e-131) (* y (/ z t)) (if (<= z 1.2e-13) x (/ y (/ t z)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -4.4e-131) {
tmp = y * (z / t);
} else if (z <= 1.2e-13) {
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 <= (-4.4d-131)) then
tmp = y * (z / t)
else if (z <= 1.2d-13) 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 <= -4.4e-131) {
tmp = y * (z / t);
} else if (z <= 1.2e-13) {
tmp = x;
} else {
tmp = y / (t / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -4.4e-131: tmp = y * (z / t) elif z <= 1.2e-13: tmp = x else: tmp = y / (t / z) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -4.4e-131) tmp = Float64(y * Float64(z / t)); elseif (z <= 1.2e-13) 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 (z <= -4.4e-131) tmp = y * (z / t); elseif (z <= 1.2e-13) tmp = x; else tmp = y / (t / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -4.4e-131], N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.2e-13], x, N[(y / N[(t / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.4 \cdot 10^{-131}:\\
\;\;\;\;y \cdot \frac{z}{t}\\
\mathbf{elif}\;z \leq 1.2 \cdot 10^{-13}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{\frac{t}{z}}\\
\end{array}
\end{array}
if z < -4.3999999999999999e-131Initial program 85.9%
Taylor expanded in t around 0 69.3%
Taylor expanded in y around inf 35.1%
associate-*r/44.0%
Simplified44.0%
if -4.3999999999999999e-131 < z < 1.1999999999999999e-13Initial program 100.0%
Taylor expanded in z around 0 72.6%
if 1.1999999999999999e-13 < z Initial program 87.3%
Taylor expanded in t around 0 77.2%
Taylor expanded in y around inf 44.6%
associate-*r/46.3%
Simplified46.3%
clear-num46.3%
un-div-inv46.9%
Applied egg-rr46.9%
Final simplification54.6%
(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 91.1%
Taylor expanded in z around 0 36.6%
Final simplification36.6%
(FPCore (x y z t)
:precision binary64
(if (< x -9.025511195533005e-135)
(- x (* (/ z t) (- x y)))
(if (< x 4.275032163700715e-250)
(+ x (* (/ (- y x) t) z))
(+ x (/ (- y x) (/ t z))))))
double code(double x, double y, double z, double t) {
double tmp;
if (x < -9.025511195533005e-135) {
tmp = x - ((z / t) * (x - y));
} else if (x < 4.275032163700715e-250) {
tmp = x + (((y - x) / t) * z);
} else {
tmp = x + ((y - x) / (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 < (-9.025511195533005d-135)) then
tmp = x - ((z / t) * (x - y))
else if (x < 4.275032163700715d-250) then
tmp = x + (((y - x) / t) * z)
else
tmp = x + ((y - x) / (t / z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x < -9.025511195533005e-135) {
tmp = x - ((z / t) * (x - y));
} else if (x < 4.275032163700715e-250) {
tmp = x + (((y - x) / t) * z);
} else {
tmp = x + ((y - x) / (t / z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x < -9.025511195533005e-135: tmp = x - ((z / t) * (x - y)) elif x < 4.275032163700715e-250: tmp = x + (((y - x) / t) * z) else: tmp = x + ((y - x) / (t / z)) return tmp
function code(x, y, z, t) tmp = 0.0 if (x < -9.025511195533005e-135) tmp = Float64(x - Float64(Float64(z / t) * Float64(x - y))); elseif (x < 4.275032163700715e-250) tmp = Float64(x + Float64(Float64(Float64(y - x) / t) * z)); else tmp = Float64(x + Float64(Float64(y - x) / Float64(t / z))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x < -9.025511195533005e-135) tmp = x - ((z / t) * (x - y)); elseif (x < 4.275032163700715e-250) tmp = x + (((y - x) / t) * z); else tmp = x + ((y - x) / (t / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Less[x, -9.025511195533005e-135], N[(x - N[(N[(z / t), $MachinePrecision] * N[(x - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Less[x, 4.275032163700715e-250], N[(x + N[(N[(N[(y - x), $MachinePrecision] / t), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y - x), $MachinePrecision] / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x < -9.025511195533005 \cdot 10^{-135}:\\
\;\;\;\;x - \frac{z}{t} \cdot \left(x - y\right)\\
\mathbf{elif}\;x < 4.275032163700715 \cdot 10^{-250}:\\
\;\;\;\;x + \frac{y - x}{t} \cdot z\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y - x}{\frac{t}{z}}\\
\end{array}
\end{array}
herbie shell --seed 2023196
(FPCore (x y z t)
:name "Numeric.Histogram:binBounds from Chart-1.5.3"
:precision binary64
:herbie-target
(if (< x -9.025511195533005e-135) (- x (* (/ z t) (- x y))) (if (< x 4.275032163700715e-250) (+ x (* (/ (- y x) t) z)) (+ x (/ (- y x) (/ t z)))))
(+ x (/ (* (- y x) z) t)))