
(FPCore (x y z t a) :precision binary64 (+ x (* y (/ (- z t) (- z a)))))
double code(double x, double y, double z, double t, double a) {
return x + (y * ((z - t) / (z - a)));
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x + (y * ((z - t) / (z - a)))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (y * ((z - t) / (z - a)));
}
def code(x, y, z, t, a): return x + (y * ((z - t) / (z - a)))
function code(x, y, z, t, a) return Float64(x + Float64(y * Float64(Float64(z - t) / Float64(z - a)))) end
function tmp = code(x, y, z, t, a) tmp = x + (y * ((z - t) / (z - a))); end
code[x_, y_, z_, t_, a_] := N[(x + N[(y * N[(N[(z - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + y \cdot \frac{z - t}{z - a}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (+ x (* y (/ (- z t) (- z a)))))
double code(double x, double y, double z, double t, double a) {
return x + (y * ((z - t) / (z - a)));
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x + (y * ((z - t) / (z - a)))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (y * ((z - t) / (z - a)));
}
def code(x, y, z, t, a): return x + (y * ((z - t) / (z - a)))
function code(x, y, z, t, a) return Float64(x + Float64(y * Float64(Float64(z - t) / Float64(z - a)))) end
function tmp = code(x, y, z, t, a) tmp = x + (y * ((z - t) / (z - a))); end
code[x_, y_, z_, t_, a_] := N[(x + N[(y * N[(N[(z - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + y \cdot \frac{z - t}{z - a}
\end{array}
(FPCore (x y z t a) :precision binary64 (+ x (/ y (/ (- z a) (- z t)))))
double code(double x, double y, double z, double t, double a) {
return x + (y / ((z - a) / (z - t)));
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x + (y / ((z - a) / (z - t)))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (y / ((z - a) / (z - t)));
}
def code(x, y, z, t, a): return x + (y / ((z - a) / (z - t)))
function code(x, y, z, t, a) return Float64(x + Float64(y / Float64(Float64(z - a) / Float64(z - t)))) end
function tmp = code(x, y, z, t, a) tmp = x + (y / ((z - a) / (z - t))); end
code[x_, y_, z_, t_, a_] := N[(x + N[(y / N[(N[(z - a), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y}{\frac{z - a}{z - t}}
\end{array}
Initial program 98.5%
clear-num98.5%
un-div-inv98.5%
Applied egg-rr98.5%
(FPCore (x y z t a)
:precision binary64
(if (<= z -4.4e+93)
(+ x y)
(if (<= z -4.4e-102)
(- x (* t (/ y z)))
(if (<= z 6.7e+28) (+ x (* y (/ t a))) (+ x y)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -4.4e+93) {
tmp = x + y;
} else if (z <= -4.4e-102) {
tmp = x - (t * (y / z));
} else if (z <= 6.7e+28) {
tmp = x + (y * (t / a));
} else {
tmp = x + y;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (z <= (-4.4d+93)) then
tmp = x + y
else if (z <= (-4.4d-102)) then
tmp = x - (t * (y / z))
else if (z <= 6.7d+28) then
tmp = x + (y * (t / a))
else
tmp = x + y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -4.4e+93) {
tmp = x + y;
} else if (z <= -4.4e-102) {
tmp = x - (t * (y / z));
} else if (z <= 6.7e+28) {
tmp = x + (y * (t / a));
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -4.4e+93: tmp = x + y elif z <= -4.4e-102: tmp = x - (t * (y / z)) elif z <= 6.7e+28: tmp = x + (y * (t / a)) else: tmp = x + y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -4.4e+93) tmp = Float64(x + y); elseif (z <= -4.4e-102) tmp = Float64(x - Float64(t * Float64(y / z))); elseif (z <= 6.7e+28) tmp = Float64(x + Float64(y * Float64(t / a))); else tmp = Float64(x + y); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -4.4e+93) tmp = x + y; elseif (z <= -4.4e-102) tmp = x - (t * (y / z)); elseif (z <= 6.7e+28) tmp = x + (y * (t / a)); else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -4.4e+93], N[(x + y), $MachinePrecision], If[LessEqual[z, -4.4e-102], N[(x - N[(t * N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 6.7e+28], N[(x + N[(y * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + y), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.4 \cdot 10^{+93}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;z \leq -4.4 \cdot 10^{-102}:\\
\;\;\;\;x - t \cdot \frac{y}{z}\\
\mathbf{elif}\;z \leq 6.7 \cdot 10^{+28}:\\
\;\;\;\;x + y \cdot \frac{t}{a}\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if z < -4.40000000000000042e93 or 6.7e28 < z Initial program 99.9%
Taylor expanded in z around inf 77.9%
+-commutative77.9%
Simplified77.9%
if -4.40000000000000042e93 < z < -4.40000000000000026e-102Initial program 99.7%
clear-num99.7%
un-div-inv99.9%
Applied egg-rr99.9%
Taylor expanded in a around 0 79.9%
Taylor expanded in z around 0 67.0%
mul-1-neg67.0%
associate-/l*69.6%
distribute-rgt-neg-in69.6%
distribute-neg-frac269.6%
Simplified69.6%
if -4.40000000000000026e-102 < z < 6.7e28Initial program 97.1%
Taylor expanded in z around 0 82.1%
Final simplification78.9%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -8e+45) (not (<= z 4.5e+28))) (+ x (* y (- 1.0 (/ t z)))) (+ x (* y (/ t (- a z))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -8e+45) || !(z <= 4.5e+28)) {
tmp = x + (y * (1.0 - (t / z)));
} else {
tmp = x + (y * (t / (a - z)));
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((z <= (-8d+45)) .or. (.not. (z <= 4.5d+28))) then
tmp = x + (y * (1.0d0 - (t / z)))
else
tmp = x + (y * (t / (a - z)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -8e+45) || !(z <= 4.5e+28)) {
tmp = x + (y * (1.0 - (t / z)));
} else {
tmp = x + (y * (t / (a - z)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -8e+45) or not (z <= 4.5e+28): tmp = x + (y * (1.0 - (t / z))) else: tmp = x + (y * (t / (a - z))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -8e+45) || !(z <= 4.5e+28)) tmp = Float64(x + Float64(y * Float64(1.0 - Float64(t / z)))); else tmp = Float64(x + Float64(y * Float64(t / Float64(a - z)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -8e+45) || ~((z <= 4.5e+28))) tmp = x + (y * (1.0 - (t / z))); else tmp = x + (y * (t / (a - z))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -8e+45], N[Not[LessEqual[z, 4.5e+28]], $MachinePrecision]], N[(x + N[(y * N[(1.0 - N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(t / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -8 \cdot 10^{+45} \lor \neg \left(z \leq 4.5 \cdot 10^{+28}\right):\\
\;\;\;\;x + y \cdot \left(1 - \frac{t}{z}\right)\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{t}{a - z}\\
\end{array}
\end{array}
if z < -7.9999999999999994e45 or 4.4999999999999997e28 < z Initial program 99.9%
Taylor expanded in a around 0 63.6%
associate-/l*88.6%
div-sub88.6%
*-inverses88.6%
Simplified88.6%
if -7.9999999999999994e45 < z < 4.4999999999999997e28Initial program 97.4%
Taylor expanded in t around inf 87.3%
associate-*r/87.3%
mul-1-neg87.3%
distribute-lft-neg-out87.3%
*-commutative87.3%
*-lft-identity87.3%
times-frac89.8%
/-rgt-identity89.8%
distribute-neg-frac89.8%
distribute-neg-frac289.8%
neg-sub089.8%
sub-neg89.8%
+-commutative89.8%
associate--r+89.8%
neg-sub089.8%
remove-double-neg89.8%
Simplified89.8%
Final simplification89.3%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -4.5e-89) (not (<= z 1.65e-92))) (+ x (* y (- 1.0 (/ t z)))) (+ x (/ t (/ a y)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -4.5e-89) || !(z <= 1.65e-92)) {
tmp = x + (y * (1.0 - (t / z)));
} else {
tmp = x + (t / (a / y));
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((z <= (-4.5d-89)) .or. (.not. (z <= 1.65d-92))) then
tmp = x + (y * (1.0d0 - (t / z)))
else
tmp = x + (t / (a / y))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -4.5e-89) || !(z <= 1.65e-92)) {
tmp = x + (y * (1.0 - (t / z)));
} else {
tmp = x + (t / (a / y));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -4.5e-89) or not (z <= 1.65e-92): tmp = x + (y * (1.0 - (t / z))) else: tmp = x + (t / (a / y)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -4.5e-89) || !(z <= 1.65e-92)) tmp = Float64(x + Float64(y * Float64(1.0 - Float64(t / z)))); else tmp = Float64(x + Float64(t / Float64(a / y))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -4.5e-89) || ~((z <= 1.65e-92))) tmp = x + (y * (1.0 - (t / z))); else tmp = x + (t / (a / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -4.5e-89], N[Not[LessEqual[z, 1.65e-92]], $MachinePrecision]], N[(x + N[(y * N[(1.0 - N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(t / N[(a / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.5 \cdot 10^{-89} \lor \neg \left(z \leq 1.65 \cdot 10^{-92}\right):\\
\;\;\;\;x + y \cdot \left(1 - \frac{t}{z}\right)\\
\mathbf{else}:\\
\;\;\;\;x + \frac{t}{\frac{a}{y}}\\
\end{array}
\end{array}
if z < -4.4999999999999999e-89 or 1.64999999999999999e-92 < z Initial program 99.9%
Taylor expanded in a around 0 66.2%
associate-/l*84.0%
div-sub84.0%
*-inverses84.0%
Simplified84.0%
if -4.4999999999999999e-89 < z < 1.64999999999999999e-92Initial program 96.2%
Taylor expanded in z around 0 82.0%
+-commutative82.0%
associate-/l*84.9%
Simplified84.9%
clear-num84.9%
un-div-inv85.0%
Applied egg-rr85.0%
Final simplification84.4%
(FPCore (x y z t a) :precision binary64 (if (<= z -6.5e+91) (+ x (/ y (/ (- z a) z))) (if (<= z 3.05e+29) (+ x (* y (/ t (- a z)))) (+ x (* y (- 1.0 (/ t z)))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -6.5e+91) {
tmp = x + (y / ((z - a) / z));
} else if (z <= 3.05e+29) {
tmp = x + (y * (t / (a - z)));
} else {
tmp = x + (y * (1.0 - (t / z)));
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (z <= (-6.5d+91)) then
tmp = x + (y / ((z - a) / z))
else if (z <= 3.05d+29) then
tmp = x + (y * (t / (a - z)))
else
tmp = x + (y * (1.0d0 - (t / z)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -6.5e+91) {
tmp = x + (y / ((z - a) / z));
} else if (z <= 3.05e+29) {
tmp = x + (y * (t / (a - z)));
} else {
tmp = x + (y * (1.0 - (t / z)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -6.5e+91: tmp = x + (y / ((z - a) / z)) elif z <= 3.05e+29: tmp = x + (y * (t / (a - z))) else: tmp = x + (y * (1.0 - (t / z))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -6.5e+91) tmp = Float64(x + Float64(y / Float64(Float64(z - a) / z))); elseif (z <= 3.05e+29) tmp = Float64(x + Float64(y * Float64(t / Float64(a - z)))); else tmp = Float64(x + Float64(y * Float64(1.0 - Float64(t / z)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -6.5e+91) tmp = x + (y / ((z - a) / z)); elseif (z <= 3.05e+29) tmp = x + (y * (t / (a - z))); else tmp = x + (y * (1.0 - (t / z))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -6.5e+91], N[(x + N[(y / N[(N[(z - a), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.05e+29], N[(x + N[(y * N[(t / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(1.0 - N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.5 \cdot 10^{+91}:\\
\;\;\;\;x + \frac{y}{\frac{z - a}{z}}\\
\mathbf{elif}\;z \leq 3.05 \cdot 10^{+29}:\\
\;\;\;\;x + y \cdot \frac{t}{a - z}\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \left(1 - \frac{t}{z}\right)\\
\end{array}
\end{array}
if z < -6.4999999999999997e91Initial program 99.8%
Taylor expanded in t around 0 55.9%
+-commutative55.9%
associate-/l*91.6%
Simplified91.6%
clear-num91.7%
un-div-inv91.7%
Applied egg-rr91.7%
if -6.4999999999999997e91 < z < 3.0499999999999999e29Initial program 97.6%
Taylor expanded in t around inf 86.3%
associate-*r/86.3%
mul-1-neg86.3%
distribute-lft-neg-out86.3%
*-commutative86.3%
*-lft-identity86.3%
times-frac89.1%
/-rgt-identity89.1%
distribute-neg-frac89.1%
distribute-neg-frac289.1%
neg-sub089.1%
sub-neg89.1%
+-commutative89.1%
associate--r+89.1%
neg-sub089.1%
remove-double-neg89.1%
Simplified89.1%
if 3.0499999999999999e29 < z Initial program 99.9%
Taylor expanded in a around 0 67.0%
associate-/l*88.0%
div-sub88.0%
*-inverses88.0%
Simplified88.0%
Final simplification89.4%
(FPCore (x y z t a) :precision binary64 (if (<= z -3.9e+93) (+ x (* y (/ z (- z a)))) (if (<= z 3.45e+28) (+ x (* y (/ t (- a z)))) (+ x (* y (- 1.0 (/ t z)))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -3.9e+93) {
tmp = x + (y * (z / (z - a)));
} else if (z <= 3.45e+28) {
tmp = x + (y * (t / (a - z)));
} else {
tmp = x + (y * (1.0 - (t / z)));
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (z <= (-3.9d+93)) then
tmp = x + (y * (z / (z - a)))
else if (z <= 3.45d+28) then
tmp = x + (y * (t / (a - z)))
else
tmp = x + (y * (1.0d0 - (t / z)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -3.9e+93) {
tmp = x + (y * (z / (z - a)));
} else if (z <= 3.45e+28) {
tmp = x + (y * (t / (a - z)));
} else {
tmp = x + (y * (1.0 - (t / z)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -3.9e+93: tmp = x + (y * (z / (z - a))) elif z <= 3.45e+28: tmp = x + (y * (t / (a - z))) else: tmp = x + (y * (1.0 - (t / z))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -3.9e+93) tmp = Float64(x + Float64(y * Float64(z / Float64(z - a)))); elseif (z <= 3.45e+28) tmp = Float64(x + Float64(y * Float64(t / Float64(a - z)))); else tmp = Float64(x + Float64(y * Float64(1.0 - Float64(t / z)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -3.9e+93) tmp = x + (y * (z / (z - a))); elseif (z <= 3.45e+28) tmp = x + (y * (t / (a - z))); else tmp = x + (y * (1.0 - (t / z))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -3.9e+93], N[(x + N[(y * N[(z / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.45e+28], N[(x + N[(y * N[(t / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(1.0 - N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.9 \cdot 10^{+93}:\\
\;\;\;\;x + y \cdot \frac{z}{z - a}\\
\mathbf{elif}\;z \leq 3.45 \cdot 10^{+28}:\\
\;\;\;\;x + y \cdot \frac{t}{a - z}\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \left(1 - \frac{t}{z}\right)\\
\end{array}
\end{array}
if z < -3.9000000000000002e93Initial program 99.8%
Taylor expanded in t around 0 55.9%
+-commutative55.9%
associate-/l*91.6%
Simplified91.6%
if -3.9000000000000002e93 < z < 3.45e28Initial program 97.6%
Taylor expanded in t around inf 86.3%
associate-*r/86.3%
mul-1-neg86.3%
distribute-lft-neg-out86.3%
*-commutative86.3%
*-lft-identity86.3%
times-frac89.1%
/-rgt-identity89.1%
distribute-neg-frac89.1%
distribute-neg-frac289.1%
neg-sub089.1%
sub-neg89.1%
+-commutative89.1%
associate--r+89.1%
neg-sub089.1%
remove-double-neg89.1%
Simplified89.1%
if 3.45e28 < z Initial program 99.9%
Taylor expanded in a around 0 67.0%
associate-/l*88.0%
div-sub88.0%
*-inverses88.0%
Simplified88.0%
Final simplification89.4%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.15e-80) (not (<= z 7.1e+28))) (+ x y) (+ x (* y (/ t a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.15e-80) || !(z <= 7.1e+28)) {
tmp = x + y;
} else {
tmp = x + (y * (t / a));
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((z <= (-1.15d-80)) .or. (.not. (z <= 7.1d+28))) then
tmp = x + y
else
tmp = x + (y * (t / a))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.15e-80) || !(z <= 7.1e+28)) {
tmp = x + y;
} else {
tmp = x + (y * (t / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -1.15e-80) or not (z <= 7.1e+28): tmp = x + y else: tmp = x + (y * (t / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1.15e-80) || !(z <= 7.1e+28)) tmp = Float64(x + y); else tmp = Float64(x + Float64(y * Float64(t / a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -1.15e-80) || ~((z <= 7.1e+28))) tmp = x + y; else tmp = x + (y * (t / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1.15e-80], N[Not[LessEqual[z, 7.1e+28]], $MachinePrecision]], N[(x + y), $MachinePrecision], N[(x + N[(y * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.15 \cdot 10^{-80} \lor \neg \left(z \leq 7.1 \cdot 10^{+28}\right):\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{t}{a}\\
\end{array}
\end{array}
if z < -1.1499999999999999e-80 or 7.0999999999999999e28 < z Initial program 99.9%
Taylor expanded in z around inf 71.0%
+-commutative71.0%
Simplified71.0%
if -1.1499999999999999e-80 < z < 7.0999999999999999e28Initial program 97.1%
Taylor expanded in z around 0 81.6%
Final simplification76.3%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -2.5e-76) (not (<= z 0.0068))) (+ x y) x))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -2.5e-76) || !(z <= 0.0068)) {
tmp = x + y;
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((z <= (-2.5d-76)) .or. (.not. (z <= 0.0068d0))) then
tmp = x + y
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -2.5e-76) || !(z <= 0.0068)) {
tmp = x + y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -2.5e-76) or not (z <= 0.0068): tmp = x + y else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -2.5e-76) || !(z <= 0.0068)) tmp = Float64(x + y); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -2.5e-76) || ~((z <= 0.0068))) tmp = x + y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -2.5e-76], N[Not[LessEqual[z, 0.0068]], $MachinePrecision]], N[(x + y), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.5 \cdot 10^{-76} \lor \neg \left(z \leq 0.0068\right):\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -2.4999999999999999e-76 or 0.00679999999999999962 < z Initial program 99.9%
Taylor expanded in z around inf 69.6%
+-commutative69.6%
Simplified69.6%
if -2.4999999999999999e-76 < z < 0.00679999999999999962Initial program 96.9%
Taylor expanded in x around inf 58.3%
Final simplification64.2%
(FPCore (x y z t a) :precision binary64 (+ x (* y (/ (- z t) (- z a)))))
double code(double x, double y, double z, double t, double a) {
return x + (y * ((z - t) / (z - a)));
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x + (y * ((z - t) / (z - a)))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (y * ((z - t) / (z - a)));
}
def code(x, y, z, t, a): return x + (y * ((z - t) / (z - a)))
function code(x, y, z, t, a) return Float64(x + Float64(y * Float64(Float64(z - t) / Float64(z - a)))) end
function tmp = code(x, y, z, t, a) tmp = x + (y * ((z - t) / (z - a))); end
code[x_, y_, z_, t_, a_] := N[(x + N[(y * N[(N[(z - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + y \cdot \frac{z - t}{z - a}
\end{array}
Initial program 98.5%
(FPCore (x y z t a) :precision binary64 x)
double code(double x, double y, double z, double t, double a) {
return x;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x
end function
public static double code(double x, double y, double z, double t, double a) {
return x;
}
def code(x, y, z, t, a): return x
function code(x, y, z, t, a) return x end
function tmp = code(x, y, z, t, a) tmp = x; end
code[x_, y_, z_, t_, a_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 98.5%
Taylor expanded in x around inf 51.6%
(FPCore (x y z t a) :precision binary64 (+ x (/ y (/ (- z a) (- z t)))))
double code(double x, double y, double z, double t, double a) {
return x + (y / ((z - a) / (z - t)));
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x + (y / ((z - a) / (z - t)))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (y / ((z - a) / (z - t)));
}
def code(x, y, z, t, a): return x + (y / ((z - a) / (z - t)))
function code(x, y, z, t, a) return Float64(x + Float64(y / Float64(Float64(z - a) / Float64(z - t)))) end
function tmp = code(x, y, z, t, a) tmp = x + (y / ((z - a) / (z - t))); end
code[x_, y_, z_, t_, a_] := N[(x + N[(y / N[(N[(z - a), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y}{\frac{z - a}{z - t}}
\end{array}
herbie shell --seed 2024137
(FPCore (x y z t a)
:name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisLine from plot-0.2.3.4, A"
:precision binary64
:alt
(! :herbie-platform default (+ x (/ y (/ (- z a) (- z t)))))
(+ x (* y (/ (- z t) (- z a)))))