
(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(Float64(y * 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[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y \cdot \left(z - t\right)}{z - a}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 13 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(Float64(y * 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[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y \cdot \left(z - t\right)}{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 86.1%
associate-/l*99.4%
Simplified99.4%
Final simplification99.4%
(FPCore (x y z t a)
:precision binary64
(if (<= z -6.4e+44)
(+ x y)
(if (<= z 1.05e+32)
(+ x (/ y (/ a t)))
(if (<= z 2.3e+74)
(- x (* t (/ y z)))
(if (<= z 1.45e+95)
(+ x (* y (/ t a)))
(if (<= z 5.3e+126) (* (- z t) (/ y z)) (+ x y)))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -6.4e+44) {
tmp = x + y;
} else if (z <= 1.05e+32) {
tmp = x + (y / (a / t));
} else if (z <= 2.3e+74) {
tmp = x - (t * (y / z));
} else if (z <= 1.45e+95) {
tmp = x + (y * (t / a));
} else if (z <= 5.3e+126) {
tmp = (z - t) * (y / z);
} 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 <= (-6.4d+44)) then
tmp = x + y
else if (z <= 1.05d+32) then
tmp = x + (y / (a / t))
else if (z <= 2.3d+74) then
tmp = x - (t * (y / z))
else if (z <= 1.45d+95) then
tmp = x + (y * (t / a))
else if (z <= 5.3d+126) then
tmp = (z - t) * (y / z)
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 <= -6.4e+44) {
tmp = x + y;
} else if (z <= 1.05e+32) {
tmp = x + (y / (a / t));
} else if (z <= 2.3e+74) {
tmp = x - (t * (y / z));
} else if (z <= 1.45e+95) {
tmp = x + (y * (t / a));
} else if (z <= 5.3e+126) {
tmp = (z - t) * (y / z);
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -6.4e+44: tmp = x + y elif z <= 1.05e+32: tmp = x + (y / (a / t)) elif z <= 2.3e+74: tmp = x - (t * (y / z)) elif z <= 1.45e+95: tmp = x + (y * (t / a)) elif z <= 5.3e+126: tmp = (z - t) * (y / z) else: tmp = x + y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -6.4e+44) tmp = Float64(x + y); elseif (z <= 1.05e+32) tmp = Float64(x + Float64(y / Float64(a / t))); elseif (z <= 2.3e+74) tmp = Float64(x - Float64(t * Float64(y / z))); elseif (z <= 1.45e+95) tmp = Float64(x + Float64(y * Float64(t / a))); elseif (z <= 5.3e+126) tmp = Float64(Float64(z - t) * Float64(y / z)); else tmp = Float64(x + y); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -6.4e+44) tmp = x + y; elseif (z <= 1.05e+32) tmp = x + (y / (a / t)); elseif (z <= 2.3e+74) tmp = x - (t * (y / z)); elseif (z <= 1.45e+95) tmp = x + (y * (t / a)); elseif (z <= 5.3e+126) tmp = (z - t) * (y / z); else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -6.4e+44], N[(x + y), $MachinePrecision], If[LessEqual[z, 1.05e+32], N[(x + N[(y / N[(a / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.3e+74], N[(x - N[(t * N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.45e+95], N[(x + N[(y * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 5.3e+126], N[(N[(z - t), $MachinePrecision] * N[(y / z), $MachinePrecision]), $MachinePrecision], N[(x + y), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.4 \cdot 10^{+44}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;z \leq 1.05 \cdot 10^{+32}:\\
\;\;\;\;x + \frac{y}{\frac{a}{t}}\\
\mathbf{elif}\;z \leq 2.3 \cdot 10^{+74}:\\
\;\;\;\;x - t \cdot \frac{y}{z}\\
\mathbf{elif}\;z \leq 1.45 \cdot 10^{+95}:\\
\;\;\;\;x + y \cdot \frac{t}{a}\\
\mathbf{elif}\;z \leq 5.3 \cdot 10^{+126}:\\
\;\;\;\;\left(z - t\right) \cdot \frac{y}{z}\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if z < -6.40000000000000009e44 or 5.30000000000000028e126 < z Initial program 73.8%
+-commutative73.8%
associate-*r/100.0%
fma-def100.0%
Simplified100.0%
Taylor expanded in z around inf 84.1%
if -6.40000000000000009e44 < z < 1.05e32Initial program 96.6%
+-commutative96.6%
associate-*r/98.6%
fma-def98.6%
Simplified98.6%
Taylor expanded in z around 0 78.6%
associate-/l*80.2%
Simplified80.2%
if 1.05e32 < z < 2.2999999999999999e74Initial program 63.7%
associate-/l*100.0%
Simplified100.0%
Taylor expanded in t around inf 80.1%
associate-*r/80.1%
neg-mul-180.1%
sub-neg80.1%
mul-1-neg80.1%
distribute-neg-in80.1%
mul-1-neg80.1%
remove-double-neg80.1%
Simplified80.1%
Taylor expanded in z around inf 61.9%
+-commutative61.9%
mul-1-neg61.9%
unsub-neg61.9%
*-commutative61.9%
associate-*r/80.1%
Simplified80.1%
if 2.2999999999999999e74 < z < 1.45000000000000007e95Initial program 61.5%
associate-/l*100.0%
Simplified100.0%
Taylor expanded in t around inf 81.0%
associate-*r/81.0%
neg-mul-181.0%
sub-neg81.0%
mul-1-neg81.0%
distribute-neg-in81.0%
mul-1-neg81.0%
remove-double-neg81.0%
Simplified81.0%
Taylor expanded in z around 0 61.6%
associate-*r/81.0%
Simplified81.0%
if 1.45000000000000007e95 < z < 5.30000000000000028e126Initial program 81.3%
+-commutative81.3%
associate-*r/99.7%
fma-def99.7%
Simplified99.7%
Taylor expanded in x around 0 81.3%
Taylor expanded in a around 0 81.3%
*-commutative81.3%
associate-/l*100.0%
associate-/r/99.7%
Simplified99.7%
Final simplification82.0%
(FPCore (x y z t a)
:precision binary64
(if (<= z -4.6e+44)
(+ x y)
(if (<= z 1.6e+32)
(+ x (/ y (/ a t)))
(if (<= z 1.8e+89)
(- x (* t (/ y z)))
(if (<= z 2.5e+93) (* (/ y a) (- t z)) (+ x y))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -4.6e+44) {
tmp = x + y;
} else if (z <= 1.6e+32) {
tmp = x + (y / (a / t));
} else if (z <= 1.8e+89) {
tmp = x - (t * (y / z));
} else if (z <= 2.5e+93) {
tmp = (y / a) * (t - z);
} 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.6d+44)) then
tmp = x + y
else if (z <= 1.6d+32) then
tmp = x + (y / (a / t))
else if (z <= 1.8d+89) then
tmp = x - (t * (y / z))
else if (z <= 2.5d+93) then
tmp = (y / a) * (t - z)
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.6e+44) {
tmp = x + y;
} else if (z <= 1.6e+32) {
tmp = x + (y / (a / t));
} else if (z <= 1.8e+89) {
tmp = x - (t * (y / z));
} else if (z <= 2.5e+93) {
tmp = (y / a) * (t - z);
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -4.6e+44: tmp = x + y elif z <= 1.6e+32: tmp = x + (y / (a / t)) elif z <= 1.8e+89: tmp = x - (t * (y / z)) elif z <= 2.5e+93: tmp = (y / a) * (t - z) else: tmp = x + y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -4.6e+44) tmp = Float64(x + y); elseif (z <= 1.6e+32) tmp = Float64(x + Float64(y / Float64(a / t))); elseif (z <= 1.8e+89) tmp = Float64(x - Float64(t * Float64(y / z))); elseif (z <= 2.5e+93) tmp = Float64(Float64(y / a) * Float64(t - z)); else tmp = Float64(x + y); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -4.6e+44) tmp = x + y; elseif (z <= 1.6e+32) tmp = x + (y / (a / t)); elseif (z <= 1.8e+89) tmp = x - (t * (y / z)); elseif (z <= 2.5e+93) tmp = (y / a) * (t - z); else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -4.6e+44], N[(x + y), $MachinePrecision], If[LessEqual[z, 1.6e+32], N[(x + N[(y / N[(a / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.8e+89], N[(x - N[(t * N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.5e+93], N[(N[(y / a), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision], N[(x + y), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.6 \cdot 10^{+44}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;z \leq 1.6 \cdot 10^{+32}:\\
\;\;\;\;x + \frac{y}{\frac{a}{t}}\\
\mathbf{elif}\;z \leq 1.8 \cdot 10^{+89}:\\
\;\;\;\;x - t \cdot \frac{y}{z}\\
\mathbf{elif}\;z \leq 2.5 \cdot 10^{+93}:\\
\;\;\;\;\frac{y}{a} \cdot \left(t - z\right)\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if z < -4.60000000000000009e44 or 2.5000000000000001e93 < z Initial program 74.2%
+-commutative74.2%
associate-*r/100.0%
fma-def100.0%
Simplified100.0%
Taylor expanded in z around inf 83.0%
if -4.60000000000000009e44 < z < 1.5999999999999999e32Initial program 96.6%
+-commutative96.6%
associate-*r/98.6%
fma-def98.6%
Simplified98.6%
Taylor expanded in z around 0 78.6%
associate-/l*80.2%
Simplified80.2%
if 1.5999999999999999e32 < z < 1.8e89Initial program 72.1%
associate-/l*100.0%
Simplified100.0%
Taylor expanded in t around inf 84.7%
associate-*r/84.7%
neg-mul-184.7%
sub-neg84.7%
mul-1-neg84.7%
distribute-neg-in84.7%
mul-1-neg84.7%
remove-double-neg84.7%
Simplified84.7%
Taylor expanded in z around inf 65.8%
+-commutative65.8%
mul-1-neg65.8%
unsub-neg65.8%
*-commutative65.8%
associate-*r/79.8%
Simplified79.8%
if 1.8e89 < z < 2.5000000000000001e93Initial program 3.9%
+-commutative3.9%
associate-*r/100.0%
fma-def100.0%
Simplified100.0%
Taylor expanded in a around inf 3.9%
+-commutative3.9%
*-commutative3.9%
mul-1-neg3.9%
unsub-neg3.9%
*-commutative3.9%
associate-/l*100.0%
Simplified100.0%
Taylor expanded in x around 0 3.9%
associate-/l*100.0%
associate-*r/100.0%
associate-*l/100.0%
metadata-eval100.0%
distribute-neg-frac100.0%
distribute-lft-neg-in100.0%
distribute-rgt-neg-in100.0%
associate-/r/100.0%
associate-*l/100.0%
*-lft-identity100.0%
Simplified100.0%
Final simplification81.4%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.03e+158) (not (<= z 4.4e+104))) (+ x (/ y (- 1.0 (/ a z)))) (+ x (* t (/ y (- a z))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.03e+158) || !(z <= 4.4e+104)) {
tmp = x + (y / (1.0 - (a / z)));
} else {
tmp = x + (t * (y / (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 <= (-1.03d+158)) .or. (.not. (z <= 4.4d+104))) then
tmp = x + (y / (1.0d0 - (a / z)))
else
tmp = x + (t * (y / (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 <= -1.03e+158) || !(z <= 4.4e+104)) {
tmp = x + (y / (1.0 - (a / z)));
} else {
tmp = x + (t * (y / (a - z)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -1.03e+158) or not (z <= 4.4e+104): tmp = x + (y / (1.0 - (a / z))) else: tmp = x + (t * (y / (a - z))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1.03e+158) || !(z <= 4.4e+104)) tmp = Float64(x + Float64(y / Float64(1.0 - Float64(a / z)))); else tmp = Float64(x + Float64(t * Float64(y / Float64(a - z)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -1.03e+158) || ~((z <= 4.4e+104))) tmp = x + (y / (1.0 - (a / z))); else tmp = x + (t * (y / (a - z))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1.03e+158], N[Not[LessEqual[z, 4.4e+104]], $MachinePrecision]], N[(x + N[(y / N[(1.0 - N[(a / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(t * N[(y / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.03 \cdot 10^{+158} \lor \neg \left(z \leq 4.4 \cdot 10^{+104}\right):\\
\;\;\;\;x + \frac{y}{1 - \frac{a}{z}}\\
\mathbf{else}:\\
\;\;\;\;x + t \cdot \frac{y}{a - z}\\
\end{array}
\end{array}
if z < -1.03000000000000002e158 or 4.40000000000000001e104 < z Initial program 65.8%
associate-*l/90.1%
Simplified90.1%
Taylor expanded in t around 0 60.5%
associate-/l*91.7%
div-sub91.7%
*-inverses91.7%
Simplified91.7%
if -1.03000000000000002e158 < z < 4.40000000000000001e104Initial program 94.3%
associate-/l*99.2%
Simplified99.2%
Taylor expanded in t around inf 91.3%
associate-*r/91.3%
neg-mul-191.3%
sub-neg91.3%
mul-1-neg91.3%
distribute-neg-in91.3%
mul-1-neg91.3%
remove-double-neg91.3%
Simplified91.3%
Taylor expanded in x around 0 87.9%
associate-/l*91.3%
associate-/r/90.9%
Simplified90.9%
Final simplification91.2%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -4.2e+44) (not (<= z 2.15e+32))) (+ x (/ y (/ z (- z t)))) (+ x (* t (/ y (- a z))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -4.2e+44) || !(z <= 2.15e+32)) {
tmp = x + (y / (z / (z - t)));
} else {
tmp = x + (t * (y / (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 <= (-4.2d+44)) .or. (.not. (z <= 2.15d+32))) then
tmp = x + (y / (z / (z - t)))
else
tmp = x + (t * (y / (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 <= -4.2e+44) || !(z <= 2.15e+32)) {
tmp = x + (y / (z / (z - t)));
} else {
tmp = x + (t * (y / (a - z)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -4.2e+44) or not (z <= 2.15e+32): tmp = x + (y / (z / (z - t))) else: tmp = x + (t * (y / (a - z))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -4.2e+44) || !(z <= 2.15e+32)) tmp = Float64(x + Float64(y / Float64(z / Float64(z - t)))); else tmp = Float64(x + Float64(t * Float64(y / Float64(a - z)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -4.2e+44) || ~((z <= 2.15e+32))) tmp = x + (y / (z / (z - t))); else tmp = x + (t * (y / (a - z))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -4.2e+44], N[Not[LessEqual[z, 2.15e+32]], $MachinePrecision]], N[(x + N[(y / N[(z / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(t * N[(y / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.2 \cdot 10^{+44} \lor \neg \left(z \leq 2.15 \cdot 10^{+32}\right):\\
\;\;\;\;x + \frac{y}{\frac{z}{z - t}}\\
\mathbf{else}:\\
\;\;\;\;x + t \cdot \frac{y}{a - z}\\
\end{array}
\end{array}
if z < -4.19999999999999974e44 or 2.1499999999999999e32 < z Initial program 72.7%
+-commutative72.7%
associate-*r/100.0%
fma-def99.9%
Simplified99.9%
Taylor expanded in a around 0 67.2%
+-commutative67.2%
*-commutative67.2%
associate-/l*91.2%
Simplified91.2%
if -4.19999999999999974e44 < z < 2.1499999999999999e32Initial program 96.6%
associate-/l*99.0%
Simplified99.0%
Taylor expanded in t around inf 94.3%
associate-*r/94.3%
neg-mul-194.3%
sub-neg94.3%
mul-1-neg94.3%
distribute-neg-in94.3%
mul-1-neg94.3%
remove-double-neg94.3%
Simplified94.3%
Taylor expanded in x around 0 91.9%
associate-/l*94.3%
associate-/r/93.8%
Simplified93.8%
Final simplification92.6%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -7.5e+44) (not (<= z 1.15e+32))) (+ x (/ y (/ z (- z t)))) (+ x (/ y (/ (- a z) t)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -7.5e+44) || !(z <= 1.15e+32)) {
tmp = x + (y / (z / (z - t)));
} else {
tmp = x + (y / ((a - z) / t));
}
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 <= (-7.5d+44)) .or. (.not. (z <= 1.15d+32))) then
tmp = x + (y / (z / (z - t)))
else
tmp = x + (y / ((a - z) / t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -7.5e+44) || !(z <= 1.15e+32)) {
tmp = x + (y / (z / (z - t)));
} else {
tmp = x + (y / ((a - z) / t));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -7.5e+44) or not (z <= 1.15e+32): tmp = x + (y / (z / (z - t))) else: tmp = x + (y / ((a - z) / t)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -7.5e+44) || !(z <= 1.15e+32)) tmp = Float64(x + Float64(y / Float64(z / Float64(z - t)))); else tmp = Float64(x + Float64(y / Float64(Float64(a - z) / t))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -7.5e+44) || ~((z <= 1.15e+32))) tmp = x + (y / (z / (z - t))); else tmp = x + (y / ((a - z) / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -7.5e+44], N[Not[LessEqual[z, 1.15e+32]], $MachinePrecision]], N[(x + N[(y / N[(z / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y / N[(N[(a - z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.5 \cdot 10^{+44} \lor \neg \left(z \leq 1.15 \cdot 10^{+32}\right):\\
\;\;\;\;x + \frac{y}{\frac{z}{z - t}}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{\frac{a - z}{t}}\\
\end{array}
\end{array}
if z < -7.50000000000000027e44 or 1.15e32 < z Initial program 72.7%
+-commutative72.7%
associate-*r/100.0%
fma-def99.9%
Simplified99.9%
Taylor expanded in a around 0 67.2%
+-commutative67.2%
*-commutative67.2%
associate-/l*91.2%
Simplified91.2%
if -7.50000000000000027e44 < z < 1.15e32Initial program 96.6%
associate-/l*99.0%
Simplified99.0%
Taylor expanded in t around inf 94.3%
associate-*r/94.3%
neg-mul-194.3%
sub-neg94.3%
mul-1-neg94.3%
distribute-neg-in94.3%
mul-1-neg94.3%
remove-double-neg94.3%
Simplified94.3%
Final simplification92.9%
(FPCore (x y z t a) :precision binary64 (if (<= a -7.2e+56) (+ x (* t (/ y a))) (if (<= a 2.1e-146) (+ x (* (- z t) (/ y z))) (+ x (/ y (/ a t))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -7.2e+56) {
tmp = x + (t * (y / a));
} else if (a <= 2.1e-146) {
tmp = x + ((z - t) * (y / z));
} else {
tmp = x + (y / (a / t));
}
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 (a <= (-7.2d+56)) then
tmp = x + (t * (y / a))
else if (a <= 2.1d-146) then
tmp = x + ((z - t) * (y / z))
else
tmp = x + (y / (a / t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -7.2e+56) {
tmp = x + (t * (y / a));
} else if (a <= 2.1e-146) {
tmp = x + ((z - t) * (y / z));
} else {
tmp = x + (y / (a / t));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -7.2e+56: tmp = x + (t * (y / a)) elif a <= 2.1e-146: tmp = x + ((z - t) * (y / z)) else: tmp = x + (y / (a / t)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -7.2e+56) tmp = Float64(x + Float64(t * Float64(y / a))); elseif (a <= 2.1e-146) tmp = Float64(x + Float64(Float64(z - t) * Float64(y / z))); else tmp = Float64(x + Float64(y / Float64(a / t))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (a <= -7.2e+56) tmp = x + (t * (y / a)); elseif (a <= 2.1e-146) tmp = x + ((z - t) * (y / z)); else tmp = x + (y / (a / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -7.2e+56], N[(x + N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 2.1e-146], N[(x + N[(N[(z - t), $MachinePrecision] * N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y / N[(a / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -7.2 \cdot 10^{+56}:\\
\;\;\;\;x + t \cdot \frac{y}{a}\\
\mathbf{elif}\;a \leq 2.1 \cdot 10^{-146}:\\
\;\;\;\;x + \left(z - t\right) \cdot \frac{y}{z}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{\frac{a}{t}}\\
\end{array}
\end{array}
if a < -7.19999999999999996e56Initial program 88.2%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in t around inf 84.0%
associate-*r/84.0%
neg-mul-184.0%
sub-neg84.0%
mul-1-neg84.0%
distribute-neg-in84.0%
mul-1-neg84.0%
remove-double-neg84.0%
Simplified84.0%
Taylor expanded in x around 0 78.3%
associate-/l*84.0%
associate-/r/82.9%
Simplified82.9%
Taylor expanded in a around inf 82.2%
if -7.19999999999999996e56 < a < 2.0999999999999999e-146Initial program 87.2%
associate-*l/98.3%
Simplified98.3%
Taylor expanded in z around inf 92.4%
if 2.0999999999999999e-146 < a Initial program 83.4%
+-commutative83.4%
associate-*r/98.8%
fma-def98.8%
Simplified98.8%
Taylor expanded in z around 0 71.6%
associate-/l*75.3%
Simplified75.3%
Final simplification84.4%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -8.2e+44) (not (<= z 2e+42))) (+ x y) (+ x (* y (/ t a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -8.2e+44) || !(z <= 2e+42)) {
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 <= (-8.2d+44)) .or. (.not. (z <= 2d+42))) 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 <= -8.2e+44) || !(z <= 2e+42)) {
tmp = x + y;
} else {
tmp = x + (y * (t / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -8.2e+44) or not (z <= 2e+42): tmp = x + y else: tmp = x + (y * (t / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -8.2e+44) || !(z <= 2e+42)) 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 <= -8.2e+44) || ~((z <= 2e+42))) tmp = x + y; else tmp = x + (y * (t / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -8.2e+44], N[Not[LessEqual[z, 2e+42]], $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 -8.2 \cdot 10^{+44} \lor \neg \left(z \leq 2 \cdot 10^{+42}\right):\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{t}{a}\\
\end{array}
\end{array}
if z < -8.1999999999999993e44 or 2.00000000000000009e42 < z Initial program 72.2%
+-commutative72.2%
associate-*r/100.0%
fma-def99.9%
Simplified99.9%
Taylor expanded in z around inf 80.5%
if -8.1999999999999993e44 < z < 2.00000000000000009e42Initial program 96.7%
associate-/l*99.0%
Simplified99.0%
Taylor expanded in t around inf 94.4%
associate-*r/94.4%
neg-mul-194.4%
sub-neg94.4%
mul-1-neg94.4%
distribute-neg-in94.4%
mul-1-neg94.4%
remove-double-neg94.4%
Simplified94.4%
Taylor expanded in z around 0 77.7%
associate-*r/79.2%
Simplified79.2%
Final simplification79.8%
(FPCore (x y z t a) :precision binary64 (if (<= z -3.4e+44) (+ x y) (if (<= z 4.4e+42) (+ x (/ y (/ a t))) (+ x y))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -3.4e+44) {
tmp = x + y;
} else if (z <= 4.4e+42) {
tmp = x + (y / (a / t));
} 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 <= (-3.4d+44)) then
tmp = x + y
else if (z <= 4.4d+42) then
tmp = x + (y / (a / t))
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 <= -3.4e+44) {
tmp = x + y;
} else if (z <= 4.4e+42) {
tmp = x + (y / (a / t));
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -3.4e+44: tmp = x + y elif z <= 4.4e+42: tmp = x + (y / (a / t)) else: tmp = x + y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -3.4e+44) tmp = Float64(x + y); elseif (z <= 4.4e+42) tmp = Float64(x + Float64(y / Float64(a / t))); else tmp = Float64(x + y); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -3.4e+44) tmp = x + y; elseif (z <= 4.4e+42) tmp = x + (y / (a / t)); else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -3.4e+44], N[(x + y), $MachinePrecision], If[LessEqual[z, 4.4e+42], N[(x + N[(y / N[(a / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.4 \cdot 10^{+44}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;z \leq 4.4 \cdot 10^{+42}:\\
\;\;\;\;x + \frac{y}{\frac{a}{t}}\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if z < -3.4e44 or 4.4000000000000003e42 < z Initial program 72.2%
+-commutative72.2%
associate-*r/100.0%
fma-def99.9%
Simplified99.9%
Taylor expanded in z around inf 80.5%
if -3.4e44 < z < 4.4000000000000003e42Initial program 96.7%
+-commutative96.7%
associate-*r/98.6%
fma-def98.6%
Simplified98.6%
Taylor expanded in z around 0 77.7%
associate-/l*79.2%
Simplified79.2%
Final simplification79.8%
(FPCore (x y z t a) :precision binary64 (+ x (* (- z t) (/ y (- z a)))))
double code(double x, double y, double z, double t, double a) {
return x + ((z - t) * (y / (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 + ((z - t) * (y / (z - a)))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + ((z - t) * (y / (z - a)));
}
def code(x, y, z, t, a): return x + ((z - t) * (y / (z - a)))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(z - t) * Float64(y / Float64(z - a)))) end
function tmp = code(x, y, z, t, a) tmp = x + ((z - t) * (y / (z - a))); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(z - t), $MachinePrecision] * N[(y / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(z - t\right) \cdot \frac{y}{z - a}
\end{array}
Initial program 86.1%
associate-*l/95.9%
Simplified95.9%
Final simplification95.9%
(FPCore (x y z t a) :precision binary64 (if (<= z -5.2e+60) (+ x y) (if (<= z 1.4e+37) x (+ x y))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -5.2e+60) {
tmp = x + y;
} else if (z <= 1.4e+37) {
tmp = x;
} 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 <= (-5.2d+60)) then
tmp = x + y
else if (z <= 1.4d+37) then
tmp = x
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 <= -5.2e+60) {
tmp = x + y;
} else if (z <= 1.4e+37) {
tmp = x;
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -5.2e+60: tmp = x + y elif z <= 1.4e+37: tmp = x else: tmp = x + y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -5.2e+60) tmp = Float64(x + y); elseif (z <= 1.4e+37) tmp = x; else tmp = Float64(x + y); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -5.2e+60) tmp = x + y; elseif (z <= 1.4e+37) tmp = x; else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -5.2e+60], N[(x + y), $MachinePrecision], If[LessEqual[z, 1.4e+37], x, N[(x + y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.2 \cdot 10^{+60}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;z \leq 1.4 \cdot 10^{+37}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if z < -5.20000000000000016e60 or 1.3999999999999999e37 < z Initial program 71.4%
+-commutative71.4%
associate-*r/100.0%
fma-def99.9%
Simplified99.9%
Taylor expanded in z around inf 80.7%
if -5.20000000000000016e60 < z < 1.3999999999999999e37Initial program 96.7%
+-commutative96.7%
associate-*r/98.6%
fma-def98.6%
Simplified98.6%
Taylor expanded in y around 0 55.1%
Final simplification65.9%
(FPCore (x y z t a) :precision binary64 (if (<= y 1.02e+114) x y))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= 1.02e+114) {
tmp = x;
} else {
tmp = 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 (y <= 1.02d+114) then
tmp = x
else
tmp = y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= 1.02e+114) {
tmp = x;
} else {
tmp = y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if y <= 1.02e+114: tmp = x else: tmp = y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (y <= 1.02e+114) tmp = x; else tmp = y; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (y <= 1.02e+114) tmp = x; else tmp = y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[y, 1.02e+114], x, y]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.02 \cdot 10^{+114}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y\\
\end{array}
\end{array}
if y < 1.01999999999999999e114Initial program 89.6%
+-commutative89.6%
associate-*r/99.1%
fma-def99.1%
Simplified99.1%
Taylor expanded in y around 0 56.9%
if 1.01999999999999999e114 < y Initial program 65.1%
+-commutative65.1%
associate-*r/99.8%
fma-def99.8%
Simplified99.8%
Taylor expanded in x around 0 54.9%
Taylor expanded in z around inf 38.1%
Final simplification54.2%
(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 86.1%
+-commutative86.1%
associate-*r/99.2%
fma-def99.2%
Simplified99.2%
Taylor expanded in y around 0 50.5%
Final simplification50.5%
(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 2023200
(FPCore (x y z t a)
:name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisTicks from plot-0.2.3.4, A"
:precision binary64
:herbie-target
(+ x (/ y (/ (- z a) (- z t))))
(+ x (/ (* y (- z t)) (- z a))))