
(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 12 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 (fma y (/ (- z t) (- z a)) x))
double code(double x, double y, double z, double t, double a) {
return fma(y, ((z - t) / (z - a)), x);
}
function code(x, y, z, t, a) return fma(y, Float64(Float64(z - t) / Float64(z - a)), x) end
code[x_, y_, z_, t_, a_] := N[(y * N[(N[(z - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(y, \frac{z - t}{z - a}, x\right)
\end{array}
Initial program 87.7%
+-commutative87.7%
associate-/l*99.6%
fma-define99.6%
Simplified99.6%
Final simplification99.6%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (* y (- t z)) (- a z))))
(if (or (<= t_1 (- INFINITY)) (not (<= t_1 1e+299)))
(* (- z t) (/ y (- z a)))
(+ x t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (y * (t - z)) / (a - z);
double tmp;
if ((t_1 <= -((double) INFINITY)) || !(t_1 <= 1e+299)) {
tmp = (z - t) * (y / (z - a));
} else {
tmp = x + t_1;
}
return tmp;
}
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (y * (t - z)) / (a - z);
double tmp;
if ((t_1 <= -Double.POSITIVE_INFINITY) || !(t_1 <= 1e+299)) {
tmp = (z - t) * (y / (z - a));
} else {
tmp = x + t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (y * (t - z)) / (a - z) tmp = 0 if (t_1 <= -math.inf) or not (t_1 <= 1e+299): tmp = (z - t) * (y / (z - a)) else: tmp = x + t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(y * Float64(t - z)) / Float64(a - z)) tmp = 0.0 if ((t_1 <= Float64(-Inf)) || !(t_1 <= 1e+299)) tmp = Float64(Float64(z - t) * Float64(y / Float64(z - a))); else tmp = Float64(x + t_1); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (y * (t - z)) / (a - z); tmp = 0.0; if ((t_1 <= -Inf) || ~((t_1 <= 1e+299))) tmp = (z - t) * (y / (z - a)); else tmp = x + t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y * N[(t - z), $MachinePrecision]), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, (-Infinity)], N[Not[LessEqual[t$95$1, 1e+299]], $MachinePrecision]], N[(N[(z - t), $MachinePrecision] * N[(y / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + t$95$1), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y \cdot \left(t - z\right)}{a - z}\\
\mathbf{if}\;t\_1 \leq -\infty \lor \neg \left(t\_1 \leq 10^{+299}\right):\\
\;\;\;\;\left(z - t\right) \cdot \frac{y}{z - a}\\
\mathbf{else}:\\
\;\;\;\;x + t\_1\\
\end{array}
\end{array}
if (/.f64 (*.f64 y (-.f64 z t)) (-.f64 z a)) < -inf.0 or 1.0000000000000001e299 < (/.f64 (*.f64 y (-.f64 z t)) (-.f64 z a)) Initial program 41.0%
+-commutative41.0%
associate-/l*99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in y around inf 87.1%
div-sub87.2%
associate-*r/41.0%
associate-*l/87.2%
Simplified87.2%
if -inf.0 < (/.f64 (*.f64 y (-.f64 z t)) (-.f64 z a)) < 1.0000000000000001e299Initial program 99.9%
Final simplification97.3%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (* y (- t z)) (- a z))))
(if (<= t_1 -2e+103)
(* (- z t) (/ y (- z a)))
(if (<= t_1 5e-8)
(+ x (* (/ -1.0 (- a z)) (* y z)))
(/ (- z t) (/ (- z a) y))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (y * (t - z)) / (a - z);
double tmp;
if (t_1 <= -2e+103) {
tmp = (z - t) * (y / (z - a));
} else if (t_1 <= 5e-8) {
tmp = x + ((-1.0 / (a - z)) * (y * z));
} else {
tmp = (z - t) / ((z - 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) :: t_1
real(8) :: tmp
t_1 = (y * (t - z)) / (a - z)
if (t_1 <= (-2d+103)) then
tmp = (z - t) * (y / (z - a))
else if (t_1 <= 5d-8) then
tmp = x + (((-1.0d0) / (a - z)) * (y * z))
else
tmp = (z - t) / ((z - a) / y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (y * (t - z)) / (a - z);
double tmp;
if (t_1 <= -2e+103) {
tmp = (z - t) * (y / (z - a));
} else if (t_1 <= 5e-8) {
tmp = x + ((-1.0 / (a - z)) * (y * z));
} else {
tmp = (z - t) / ((z - a) / y);
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (y * (t - z)) / (a - z) tmp = 0 if t_1 <= -2e+103: tmp = (z - t) * (y / (z - a)) elif t_1 <= 5e-8: tmp = x + ((-1.0 / (a - z)) * (y * z)) else: tmp = (z - t) / ((z - a) / y) return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(y * Float64(t - z)) / Float64(a - z)) tmp = 0.0 if (t_1 <= -2e+103) tmp = Float64(Float64(z - t) * Float64(y / Float64(z - a))); elseif (t_1 <= 5e-8) tmp = Float64(x + Float64(Float64(-1.0 / Float64(a - z)) * Float64(y * z))); else tmp = Float64(Float64(z - t) / Float64(Float64(z - a) / y)); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (y * (t - z)) / (a - z); tmp = 0.0; if (t_1 <= -2e+103) tmp = (z - t) * (y / (z - a)); elseif (t_1 <= 5e-8) tmp = x + ((-1.0 / (a - z)) * (y * z)); else tmp = (z - t) / ((z - a) / y); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y * N[(t - z), $MachinePrecision]), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -2e+103], N[(N[(z - t), $MachinePrecision] * N[(y / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 5e-8], N[(x + N[(N[(-1.0 / N[(a - z), $MachinePrecision]), $MachinePrecision] * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(z - t), $MachinePrecision] / N[(N[(z - a), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y \cdot \left(t - z\right)}{a - z}\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{+103}:\\
\;\;\;\;\left(z - t\right) \cdot \frac{y}{z - a}\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{-8}:\\
\;\;\;\;x + \frac{-1}{a - z} \cdot \left(y \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{z - t}{\frac{z - a}{y}}\\
\end{array}
\end{array}
if (/.f64 (*.f64 y (-.f64 z t)) (-.f64 z a)) < -2e103Initial program 61.7%
+-commutative61.7%
associate-/l*99.8%
fma-define99.8%
Simplified99.8%
Taylor expanded in y around inf 87.4%
div-sub87.5%
associate-*r/57.5%
associate-*l/83.6%
Simplified83.6%
if -2e103 < (/.f64 (*.f64 y (-.f64 z t)) (-.f64 z a)) < 4.9999999999999998e-8Initial program 99.9%
clear-num99.9%
inv-pow99.9%
Applied egg-rr99.9%
unpow-199.9%
*-commutative99.9%
associate-/r*99.8%
Simplified99.8%
associate-/l/99.9%
associate-/r/99.9%
*-commutative99.9%
Applied egg-rr99.9%
Taylor expanded in z around inf 94.9%
if 4.9999999999999998e-8 < (/.f64 (*.f64 y (-.f64 z t)) (-.f64 z a)) Initial program 76.2%
+-commutative76.2%
associate-/l*98.4%
fma-define98.4%
Simplified98.4%
Taylor expanded in y around inf 82.0%
div-sub82.0%
associate-*r/65.1%
associate-*l/80.2%
Simplified80.2%
*-commutative80.2%
clear-num80.2%
un-div-inv80.3%
Applied egg-rr80.3%
Final simplification89.6%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (* y (- t z)) (- a z))))
(if (<= t_1 (- INFINITY))
(/ (/ (- z t) (- z a)) (/ 1.0 y))
(if (<= t_1 1e+299) (+ x t_1) (* (- z t) (/ y (- z a)))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (y * (t - z)) / (a - z);
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = ((z - t) / (z - a)) / (1.0 / y);
} else if (t_1 <= 1e+299) {
tmp = x + t_1;
} else {
tmp = (z - t) * (y / (z - a));
}
return tmp;
}
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (y * (t - z)) / (a - z);
double tmp;
if (t_1 <= -Double.POSITIVE_INFINITY) {
tmp = ((z - t) / (z - a)) / (1.0 / y);
} else if (t_1 <= 1e+299) {
tmp = x + t_1;
} else {
tmp = (z - t) * (y / (z - a));
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (y * (t - z)) / (a - z) tmp = 0 if t_1 <= -math.inf: tmp = ((z - t) / (z - a)) / (1.0 / y) elif t_1 <= 1e+299: tmp = x + t_1 else: tmp = (z - t) * (y / (z - a)) return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(y * Float64(t - z)) / Float64(a - z)) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(Float64(Float64(z - t) / Float64(z - a)) / Float64(1.0 / y)); elseif (t_1 <= 1e+299) tmp = Float64(x + t_1); else tmp = Float64(Float64(z - t) * Float64(y / Float64(z - a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (y * (t - z)) / (a - z); tmp = 0.0; if (t_1 <= -Inf) tmp = ((z - t) / (z - a)) / (1.0 / y); elseif (t_1 <= 1e+299) tmp = x + t_1; else tmp = (z - t) * (y / (z - a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y * N[(t - z), $MachinePrecision]), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(N[(N[(z - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision] / N[(1.0 / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e+299], N[(x + t$95$1), $MachinePrecision], N[(N[(z - t), $MachinePrecision] * N[(y / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y \cdot \left(t - z\right)}{a - z}\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;\frac{\frac{z - t}{z - a}}{\frac{1}{y}}\\
\mathbf{elif}\;t\_1 \leq 10^{+299}:\\
\;\;\;\;x + t\_1\\
\mathbf{else}:\\
\;\;\;\;\left(z - t\right) \cdot \frac{y}{z - a}\\
\end{array}
\end{array}
if (/.f64 (*.f64 y (-.f64 z t)) (-.f64 z a)) < -inf.0Initial program 40.1%
+-commutative40.1%
associate-/l*99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in y around inf 87.0%
div-sub87.2%
associate-*r/40.1%
associate-*l/87.2%
Simplified87.2%
associate-/r/87.2%
clear-num87.1%
div-inv87.1%
associate-/r*87.3%
clear-num87.3%
Applied egg-rr87.3%
if -inf.0 < (/.f64 (*.f64 y (-.f64 z t)) (-.f64 z a)) < 1.0000000000000001e299Initial program 99.9%
if 1.0000000000000001e299 < (/.f64 (*.f64 y (-.f64 z t)) (-.f64 z a)) Initial program 42.2%
+-commutative42.2%
associate-/l*99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in y around inf 87.3%
div-sub87.3%
associate-*r/42.2%
associate-*l/87.3%
Simplified87.3%
Final simplification97.3%
(FPCore (x y z t a)
:precision binary64
(if (<= z -6.5e+167)
(+ y x)
(if (<= z -4e+34)
(- x (* t (/ y z)))
(if (or (<= z -5.2e-45) (not (<= z 7e+35)))
(+ y x)
(+ x (* y (/ t a)))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -6.5e+167) {
tmp = y + x;
} else if (z <= -4e+34) {
tmp = x - (t * (y / z));
} else if ((z <= -5.2e-45) || !(z <= 7e+35)) {
tmp = y + x;
} 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 <= (-6.5d+167)) then
tmp = y + x
else if (z <= (-4d+34)) then
tmp = x - (t * (y / z))
else if ((z <= (-5.2d-45)) .or. (.not. (z <= 7d+35))) then
tmp = y + x
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 <= -6.5e+167) {
tmp = y + x;
} else if (z <= -4e+34) {
tmp = x - (t * (y / z));
} else if ((z <= -5.2e-45) || !(z <= 7e+35)) {
tmp = y + x;
} else {
tmp = x + (y * (t / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -6.5e+167: tmp = y + x elif z <= -4e+34: tmp = x - (t * (y / z)) elif (z <= -5.2e-45) or not (z <= 7e+35): tmp = y + x else: tmp = x + (y * (t / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -6.5e+167) tmp = Float64(y + x); elseif (z <= -4e+34) tmp = Float64(x - Float64(t * Float64(y / z))); elseif ((z <= -5.2e-45) || !(z <= 7e+35)) tmp = Float64(y + x); 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 <= -6.5e+167) tmp = y + x; elseif (z <= -4e+34) tmp = x - (t * (y / z)); elseif ((z <= -5.2e-45) || ~((z <= 7e+35))) tmp = y + x; else tmp = x + (y * (t / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -6.5e+167], N[(y + x), $MachinePrecision], If[LessEqual[z, -4e+34], N[(x - N[(t * N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[z, -5.2e-45], N[Not[LessEqual[z, 7e+35]], $MachinePrecision]], N[(y + x), $MachinePrecision], N[(x + N[(y * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.5 \cdot 10^{+167}:\\
\;\;\;\;y + x\\
\mathbf{elif}\;z \leq -4 \cdot 10^{+34}:\\
\;\;\;\;x - t \cdot \frac{y}{z}\\
\mathbf{elif}\;z \leq -5.2 \cdot 10^{-45} \lor \neg \left(z \leq 7 \cdot 10^{+35}\right):\\
\;\;\;\;y + x\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{t}{a}\\
\end{array}
\end{array}
if z < -6.5e167 or -3.99999999999999978e34 < z < -5.19999999999999973e-45 or 7.0000000000000001e35 < z Initial program 72.5%
+-commutative72.5%
associate-/l*99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in z around inf 80.7%
+-commutative80.7%
Simplified80.7%
if -6.5e167 < z < -3.99999999999999978e34Initial program 91.3%
Taylor expanded in t around inf 79.6%
associate-*r/79.6%
mul-1-neg79.6%
distribute-lft-neg-out79.6%
*-commutative79.6%
Simplified79.6%
Taylor expanded in z around inf 73.4%
mul-1-neg73.4%
associate-*r/76.3%
*-commutative76.3%
distribute-rgt-neg-in76.3%
Simplified76.3%
if -5.19999999999999973e-45 < z < 7.0000000000000001e35Initial program 98.5%
Taylor expanded in z around 0 84.9%
*-commutative84.9%
associate-/l*84.9%
Applied egg-rr84.9%
Final simplification82.2%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.38e-45) (not (<= z 4.8e-29))) (+ x (* y (/ (- z t) z))) (+ x (* y (/ t a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.38e-45) || !(z <= 4.8e-29)) {
tmp = x + (y * ((z - t) / z));
} 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.38d-45)) .or. (.not. (z <= 4.8d-29))) then
tmp = x + (y * ((z - t) / z))
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.38e-45) || !(z <= 4.8e-29)) {
tmp = x + (y * ((z - t) / z));
} else {
tmp = x + (y * (t / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -1.38e-45) or not (z <= 4.8e-29): tmp = x + (y * ((z - t) / z)) else: tmp = x + (y * (t / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1.38e-45) || !(z <= 4.8e-29)) tmp = Float64(x + Float64(y * Float64(Float64(z - t) / z))); 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.38e-45) || ~((z <= 4.8e-29))) tmp = x + (y * ((z - t) / z)); else tmp = x + (y * (t / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1.38e-45], N[Not[LessEqual[z, 4.8e-29]], $MachinePrecision]], N[(x + N[(y * N[(N[(z - t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.38 \cdot 10^{-45} \lor \neg \left(z \leq 4.8 \cdot 10^{-29}\right):\\
\;\;\;\;x + y \cdot \frac{z - t}{z}\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{t}{a}\\
\end{array}
\end{array}
if z < -1.38e-45 or 4.79999999999999984e-29 < z Initial program 78.9%
+-commutative78.9%
associate-/l*99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in a around 0 69.4%
+-commutative69.4%
associate-/l*87.4%
Simplified87.4%
if -1.38e-45 < z < 4.79999999999999984e-29Initial program 98.3%
Taylor expanded in z around 0 86.0%
*-commutative86.0%
associate-/l*86.0%
Applied egg-rr86.0%
Final simplification86.8%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -5.2e-45) (not (<= z 2.1e+41))) (+ x (* y (/ (- z t) z))) (+ x (* y (/ (- t z) a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -5.2e-45) || !(z <= 2.1e+41)) {
tmp = x + (y * ((z - t) / z));
} else {
tmp = x + (y * ((t - z) / 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 <= (-5.2d-45)) .or. (.not. (z <= 2.1d+41))) then
tmp = x + (y * ((z - t) / z))
else
tmp = x + (y * ((t - z) / 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 <= -5.2e-45) || !(z <= 2.1e+41)) {
tmp = x + (y * ((z - t) / z));
} else {
tmp = x + (y * ((t - z) / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -5.2e-45) or not (z <= 2.1e+41): tmp = x + (y * ((z - t) / z)) else: tmp = x + (y * ((t - z) / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -5.2e-45) || !(z <= 2.1e+41)) tmp = Float64(x + Float64(y * Float64(Float64(z - t) / z))); else tmp = Float64(x + Float64(y * Float64(Float64(t - z) / a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -5.2e-45) || ~((z <= 2.1e+41))) tmp = x + (y * ((z - t) / z)); else tmp = x + (y * ((t - z) / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -5.2e-45], N[Not[LessEqual[z, 2.1e+41]], $MachinePrecision]], N[(x + N[(y * N[(N[(z - t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(N[(t - z), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.2 \cdot 10^{-45} \lor \neg \left(z \leq 2.1 \cdot 10^{+41}\right):\\
\;\;\;\;x + y \cdot \frac{z - t}{z}\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{t - z}{a}\\
\end{array}
\end{array}
if z < -5.19999999999999973e-45 or 2.1e41 < z Initial program 77.0%
+-commutative77.0%
associate-/l*99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in a around 0 69.4%
+-commutative69.4%
associate-/l*89.0%
Simplified89.0%
if -5.19999999999999973e-45 < z < 2.1e41Initial program 98.5%
+-commutative98.5%
associate-/l*99.2%
fma-define99.2%
Simplified99.2%
Taylor expanded in a around inf 89.8%
mul-1-neg89.8%
unsub-neg89.8%
associate-/l*89.2%
Simplified89.2%
Final simplification89.1%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -5.2e-45) (not (<= z 8.6e+35))) (+ y x) (+ x (* y (/ t a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -5.2e-45) || !(z <= 8.6e+35)) {
tmp = y + x;
} 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 <= (-5.2d-45)) .or. (.not. (z <= 8.6d+35))) then
tmp = y + x
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 <= -5.2e-45) || !(z <= 8.6e+35)) {
tmp = y + x;
} else {
tmp = x + (y * (t / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -5.2e-45) or not (z <= 8.6e+35): tmp = y + x else: tmp = x + (y * (t / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -5.2e-45) || !(z <= 8.6e+35)) tmp = Float64(y + x); 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 <= -5.2e-45) || ~((z <= 8.6e+35))) tmp = y + x; else tmp = x + (y * (t / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -5.2e-45], N[Not[LessEqual[z, 8.6e+35]], $MachinePrecision]], N[(y + x), $MachinePrecision], N[(x + N[(y * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.2 \cdot 10^{-45} \lor \neg \left(z \leq 8.6 \cdot 10^{+35}\right):\\
\;\;\;\;y + x\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{t}{a}\\
\end{array}
\end{array}
if z < -5.19999999999999973e-45 or 8.5999999999999995e35 < z Initial program 77.2%
+-commutative77.2%
associate-/l*99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in z around inf 75.5%
+-commutative75.5%
Simplified75.5%
if -5.19999999999999973e-45 < z < 8.5999999999999995e35Initial program 98.5%
Taylor expanded in z around 0 84.9%
*-commutative84.9%
associate-/l*84.9%
Applied egg-rr84.9%
Final simplification80.2%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -9.2e-48) (not (<= z 1.24e-110))) (+ y x) x))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -9.2e-48) || !(z <= 1.24e-110)) {
tmp = y + x;
} 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 <= (-9.2d-48)) .or. (.not. (z <= 1.24d-110))) then
tmp = y + x
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 <= -9.2e-48) || !(z <= 1.24e-110)) {
tmp = y + x;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -9.2e-48) or not (z <= 1.24e-110): tmp = y + x else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -9.2e-48) || !(z <= 1.24e-110)) tmp = Float64(y + x); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -9.2e-48) || ~((z <= 1.24e-110))) tmp = y + x; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -9.2e-48], N[Not[LessEqual[z, 1.24e-110]], $MachinePrecision]], N[(y + x), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -9.2 \cdot 10^{-48} \lor \neg \left(z \leq 1.24 \cdot 10^{-110}\right):\\
\;\;\;\;y + x\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -9.2000000000000003e-48 or 1.24000000000000006e-110 < z Initial program 81.5%
+-commutative81.5%
associate-/l*99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in z around inf 74.6%
+-commutative74.6%
Simplified74.6%
if -9.2000000000000003e-48 < z < 1.24000000000000006e-110Initial program 98.0%
+-commutative98.0%
associate-/l*99.0%
fma-define99.0%
Simplified99.0%
Taylor expanded in y around 0 57.6%
Final simplification68.1%
(FPCore (x y z t a) :precision binary64 (+ x (/ -1.0 (/ (/ (- z a) (- t z)) y))))
double code(double x, double y, double z, double t, double a) {
return x + (-1.0 / (((z - a) / (t - z)) / y));
}
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 + ((-1.0d0) / (((z - a) / (t - z)) / y))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (-1.0 / (((z - a) / (t - z)) / y));
}
def code(x, y, z, t, a): return x + (-1.0 / (((z - a) / (t - z)) / y))
function code(x, y, z, t, a) return Float64(x + Float64(-1.0 / Float64(Float64(Float64(z - a) / Float64(t - z)) / y))) end
function tmp = code(x, y, z, t, a) tmp = x + (-1.0 / (((z - a) / (t - z)) / y)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(-1.0 / N[(N[(N[(z - a), $MachinePrecision] / N[(t - z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{-1}{\frac{\frac{z - a}{t - z}}{y}}
\end{array}
Initial program 87.7%
clear-num87.6%
inv-pow87.6%
Applied egg-rr87.6%
unpow-187.6%
*-commutative87.6%
associate-/r*99.4%
Simplified99.4%
Final simplification99.4%
(FPCore (x y z t a) :precision binary64 (if (<= x -1.3e-188) x (if (<= x 2.6e-248) y x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (x <= -1.3e-188) {
tmp = x;
} else if (x <= 2.6e-248) {
tmp = 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 (x <= (-1.3d-188)) then
tmp = x
else if (x <= 2.6d-248) then
tmp = 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 (x <= -1.3e-188) {
tmp = x;
} else if (x <= 2.6e-248) {
tmp = y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if x <= -1.3e-188: tmp = x elif x <= 2.6e-248: tmp = y else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (x <= -1.3e-188) tmp = x; elseif (x <= 2.6e-248) tmp = y; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (x <= -1.3e-188) tmp = x; elseif (x <= 2.6e-248) tmp = y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[x, -1.3e-188], x, If[LessEqual[x, 2.6e-248], y, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.3 \cdot 10^{-188}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 2.6 \cdot 10^{-248}:\\
\;\;\;\;y\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -1.3e-188 or 2.60000000000000007e-248 < x Initial program 88.0%
+-commutative88.0%
associate-/l*99.5%
fma-define99.5%
Simplified99.5%
Taylor expanded in y around 0 62.0%
if -1.3e-188 < x < 2.60000000000000007e-248Initial program 85.7%
+-commutative85.7%
associate-/l*100.0%
fma-define100.0%
Simplified100.0%
Taylor expanded in y around inf 92.7%
div-sub92.7%
associate-*r/78.4%
associate-*l/80.5%
Simplified80.5%
*-commutative80.5%
clear-num79.6%
un-div-inv79.8%
Applied egg-rr79.8%
Taylor expanded in z around inf 47.8%
Taylor expanded in z around inf 41.2%
Final simplification59.3%
(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 87.7%
+-commutative87.7%
associate-/l*99.6%
fma-define99.6%
Simplified99.6%
Taylor expanded in y around 0 55.1%
Final simplification55.1%
(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 2024066
(FPCore (x y z t a)
:name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisTicks from plot-0.2.3.4, A"
:precision binary64
:alt
(+ x (/ y (/ (- z a) (- z t))))
(+ x (/ (* y (- z t)) (- z a))))