
(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 99.2%
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
--lowering--.f64N/A
--lowering--.f6499.3%
Applied egg-rr99.3%
(FPCore (x y z t a)
:precision binary64
(if (<= z -3.7e+78)
(+ x y)
(if (<= z -120000.0)
(* y (- 1.0 (/ t z)))
(if (<= z -5.5e-297) x (if (<= z 1.2e-184) (* t (/ y a)) (+ x y))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -3.7e+78) {
tmp = x + y;
} else if (z <= -120000.0) {
tmp = y * (1.0 - (t / z));
} else if (z <= -5.5e-297) {
tmp = x;
} else if (z <= 1.2e-184) {
tmp = t * (y / 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 <= (-3.7d+78)) then
tmp = x + y
else if (z <= (-120000.0d0)) then
tmp = y * (1.0d0 - (t / z))
else if (z <= (-5.5d-297)) then
tmp = x
else if (z <= 1.2d-184) then
tmp = t * (y / 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 <= -3.7e+78) {
tmp = x + y;
} else if (z <= -120000.0) {
tmp = y * (1.0 - (t / z));
} else if (z <= -5.5e-297) {
tmp = x;
} else if (z <= 1.2e-184) {
tmp = t * (y / a);
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -3.7e+78: tmp = x + y elif z <= -120000.0: tmp = y * (1.0 - (t / z)) elif z <= -5.5e-297: tmp = x elif z <= 1.2e-184: tmp = t * (y / a) else: tmp = x + y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -3.7e+78) tmp = Float64(x + y); elseif (z <= -120000.0) tmp = Float64(y * Float64(1.0 - Float64(t / z))); elseif (z <= -5.5e-297) tmp = x; elseif (z <= 1.2e-184) tmp = Float64(t * Float64(y / a)); else tmp = Float64(x + y); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -3.7e+78) tmp = x + y; elseif (z <= -120000.0) tmp = y * (1.0 - (t / z)); elseif (z <= -5.5e-297) tmp = x; elseif (z <= 1.2e-184) tmp = t * (y / a); else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -3.7e+78], N[(x + y), $MachinePrecision], If[LessEqual[z, -120000.0], N[(y * N[(1.0 - N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -5.5e-297], x, If[LessEqual[z, 1.2e-184], N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision], N[(x + y), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.7 \cdot 10^{+78}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;z \leq -120000:\\
\;\;\;\;y \cdot \left(1 - \frac{t}{z}\right)\\
\mathbf{elif}\;z \leq -5.5 \cdot 10^{-297}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 1.2 \cdot 10^{-184}:\\
\;\;\;\;t \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if z < -3.69999999999999985e78 or 1.20000000000000012e-184 < z Initial program 99.3%
Taylor expanded in z around inf
+-commutativeN/A
+-lowering-+.f6477.2%
Simplified77.2%
if -3.69999999999999985e78 < z < -1.2e5Initial program 99.9%
Taylor expanded in a around 0
+-lowering-+.f64N/A
associate-/l*N/A
*-lowering-*.f64N/A
div-subN/A
*-inversesN/A
--lowering--.f64N/A
/-lowering-/.f6476.4%
Simplified76.4%
Taylor expanded in x around 0
*-lowering-*.f64N/A
--lowering--.f64N/A
/-lowering-/.f6468.6%
Simplified68.6%
if -1.2e5 < z < -5.5000000000000003e-297Initial program 99.8%
Taylor expanded in x around inf
Simplified64.9%
if -5.5000000000000003e-297 < z < 1.20000000000000012e-184Initial program 97.5%
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
--lowering--.f64N/A
--lowering--.f6497.7%
Applied egg-rr97.7%
Taylor expanded in z around 0
/-lowering-/.f6492.7%
Simplified92.7%
Taylor expanded in x around 0
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f6454.9%
Simplified54.9%
*-commutativeN/A
associate-/l*N/A
*-lowering-*.f64N/A
/-lowering-/.f6457.5%
Applied egg-rr57.5%
Final simplification71.6%
(FPCore (x y z t a) :precision binary64 (if (<= z -1.02e-22) (+ x y) (if (<= z -9.5e-298) x (if (<= z 1.2e-184) (* t (/ y a)) (+ x y)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.02e-22) {
tmp = x + y;
} else if (z <= -9.5e-298) {
tmp = x;
} else if (z <= 1.2e-184) {
tmp = t * (y / 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 <= (-1.02d-22)) then
tmp = x + y
else if (z <= (-9.5d-298)) then
tmp = x
else if (z <= 1.2d-184) then
tmp = t * (y / 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 <= -1.02e-22) {
tmp = x + y;
} else if (z <= -9.5e-298) {
tmp = x;
} else if (z <= 1.2e-184) {
tmp = t * (y / a);
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -1.02e-22: tmp = x + y elif z <= -9.5e-298: tmp = x elif z <= 1.2e-184: tmp = t * (y / a) else: tmp = x + y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.02e-22) tmp = Float64(x + y); elseif (z <= -9.5e-298) tmp = x; elseif (z <= 1.2e-184) tmp = Float64(t * Float64(y / a)); else tmp = Float64(x + y); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -1.02e-22) tmp = x + y; elseif (z <= -9.5e-298) tmp = x; elseif (z <= 1.2e-184) tmp = t * (y / a); else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.02e-22], N[(x + y), $MachinePrecision], If[LessEqual[z, -9.5e-298], x, If[LessEqual[z, 1.2e-184], N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision], N[(x + y), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.02 \cdot 10^{-22}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;z \leq -9.5 \cdot 10^{-298}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 1.2 \cdot 10^{-184}:\\
\;\;\;\;t \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if z < -1.02000000000000002e-22 or 1.20000000000000012e-184 < z Initial program 99.4%
Taylor expanded in z around inf
+-commutativeN/A
+-lowering-+.f6473.5%
Simplified73.5%
if -1.02000000000000002e-22 < z < -9.50000000000000012e-298Initial program 99.9%
Taylor expanded in x around inf
Simplified66.1%
if -9.50000000000000012e-298 < z < 1.20000000000000012e-184Initial program 97.5%
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
--lowering--.f64N/A
--lowering--.f6497.7%
Applied egg-rr97.7%
Taylor expanded in z around 0
/-lowering-/.f6492.7%
Simplified92.7%
Taylor expanded in x around 0
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f6454.9%
Simplified54.9%
*-commutativeN/A
associate-/l*N/A
*-lowering-*.f64N/A
/-lowering-/.f6457.5%
Applied egg-rr57.5%
Final simplification69.9%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (+ x (* y (- 1.0 (/ t z)))))) (if (<= z -6e-66) t_1 (if (<= z 3.3e-50) (+ x (/ y (/ a t))) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x + (y * (1.0 - (t / z)));
double tmp;
if (z <= -6e-66) {
tmp = t_1;
} else if (z <= 3.3e-50) {
tmp = x + (y / (a / t));
} else {
tmp = t_1;
}
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 = x + (y * (1.0d0 - (t / z)))
if (z <= (-6d-66)) then
tmp = t_1
else if (z <= 3.3d-50) then
tmp = x + (y / (a / t))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = x + (y * (1.0 - (t / z)));
double tmp;
if (z <= -6e-66) {
tmp = t_1;
} else if (z <= 3.3e-50) {
tmp = x + (y / (a / t));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x + (y * (1.0 - (t / z))) tmp = 0 if z <= -6e-66: tmp = t_1 elif z <= 3.3e-50: tmp = x + (y / (a / t)) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(x + Float64(y * Float64(1.0 - Float64(t / z)))) tmp = 0.0 if (z <= -6e-66) tmp = t_1; elseif (z <= 3.3e-50) tmp = Float64(x + Float64(y / Float64(a / t))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x + (y * (1.0 - (t / z))); tmp = 0.0; if (z <= -6e-66) tmp = t_1; elseif (z <= 3.3e-50) tmp = x + (y / (a / t)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(y * N[(1.0 - N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -6e-66], t$95$1, If[LessEqual[z, 3.3e-50], N[(x + N[(y / N[(a / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + y \cdot \left(1 - \frac{t}{z}\right)\\
\mathbf{if}\;z \leq -6 \cdot 10^{-66}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 3.3 \cdot 10^{-50}:\\
\;\;\;\;x + \frac{y}{\frac{a}{t}}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -6.0000000000000004e-66 or 3.2999999999999998e-50 < z Initial program 99.9%
Taylor expanded in a around 0
+-lowering-+.f64N/A
associate-/l*N/A
*-lowering-*.f64N/A
div-subN/A
*-inversesN/A
--lowering--.f64N/A
/-lowering-/.f6488.6%
Simplified88.6%
if -6.0000000000000004e-66 < z < 3.2999999999999998e-50Initial program 98.1%
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
--lowering--.f64N/A
--lowering--.f6498.3%
Applied egg-rr98.3%
Taylor expanded in z around 0
/-lowering-/.f6488.9%
Simplified88.9%
(FPCore (x y z t a) :precision binary64 (if (<= z -1.3e+16) (+ x y) (if (<= z 0.0012) (+ x (/ y (/ a t))) (+ x y))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.3e+16) {
tmp = x + y;
} else if (z <= 0.0012) {
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 <= (-1.3d+16)) then
tmp = x + y
else if (z <= 0.0012d0) 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 <= -1.3e+16) {
tmp = x + y;
} else if (z <= 0.0012) {
tmp = x + (y / (a / t));
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -1.3e+16: tmp = x + y elif z <= 0.0012: tmp = x + (y / (a / t)) else: tmp = x + y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.3e+16) tmp = Float64(x + y); elseif (z <= 0.0012) 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 <= -1.3e+16) tmp = x + y; elseif (z <= 0.0012) tmp = x + (y / (a / t)); else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.3e+16], N[(x + y), $MachinePrecision], If[LessEqual[z, 0.0012], N[(x + N[(y / N[(a / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.3 \cdot 10^{+16}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;z \leq 0.0012:\\
\;\;\;\;x + \frac{y}{\frac{a}{t}}\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if z < -1.3e16 or 0.00119999999999999989 < z Initial program 99.9%
Taylor expanded in z around inf
+-commutativeN/A
+-lowering-+.f6482.5%
Simplified82.5%
if -1.3e16 < z < 0.00119999999999999989Initial program 98.4%
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
--lowering--.f64N/A
--lowering--.f6498.5%
Applied egg-rr98.5%
Taylor expanded in z around 0
/-lowering-/.f6482.9%
Simplified82.9%
Final simplification82.7%
(FPCore (x y z t a) :precision binary64 (if (<= z -7.8e+20) (+ x y) (if (<= z 0.00039) (+ x (* t (/ y a))) (+ x y))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -7.8e+20) {
tmp = x + y;
} else if (z <= 0.00039) {
tmp = x + (t * (y / 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 <= (-7.8d+20)) then
tmp = x + y
else if (z <= 0.00039d0) then
tmp = x + (t * (y / 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 <= -7.8e+20) {
tmp = x + y;
} else if (z <= 0.00039) {
tmp = x + (t * (y / a));
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -7.8e+20: tmp = x + y elif z <= 0.00039: tmp = x + (t * (y / a)) else: tmp = x + y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -7.8e+20) tmp = Float64(x + y); elseif (z <= 0.00039) tmp = Float64(x + Float64(t * Float64(y / a))); else tmp = Float64(x + y); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -7.8e+20) tmp = x + y; elseif (z <= 0.00039) tmp = x + (t * (y / a)); else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -7.8e+20], N[(x + y), $MachinePrecision], If[LessEqual[z, 0.00039], N[(x + N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.8 \cdot 10^{+20}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;z \leq 0.00039:\\
\;\;\;\;x + t \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if z < -7.8e20 or 3.89999999999999993e-4 < z Initial program 99.9%
Taylor expanded in z around inf
+-commutativeN/A
+-lowering-+.f6482.5%
Simplified82.5%
if -7.8e20 < z < 3.89999999999999993e-4Initial program 98.4%
Taylor expanded in z around 0
+-lowering-+.f64N/A
associate-/l*N/A
*-lowering-*.f64N/A
/-lowering-/.f6482.8%
Simplified82.8%
Final simplification82.6%
(FPCore (x y z t a) :precision binary64 (if (<= z -2.2e-17) (+ x y) (if (<= z 8.5e-40) x (+ x y))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2.2e-17) {
tmp = x + y;
} else if (z <= 8.5e-40) {
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 <= (-2.2d-17)) then
tmp = x + y
else if (z <= 8.5d-40) 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 <= -2.2e-17) {
tmp = x + y;
} else if (z <= 8.5e-40) {
tmp = x;
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -2.2e-17: tmp = x + y elif z <= 8.5e-40: tmp = x else: tmp = x + y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -2.2e-17) tmp = Float64(x + y); elseif (z <= 8.5e-40) 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 <= -2.2e-17) tmp = x + y; elseif (z <= 8.5e-40) tmp = x; else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -2.2e-17], N[(x + y), $MachinePrecision], If[LessEqual[z, 8.5e-40], x, N[(x + y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.2 \cdot 10^{-17}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;z \leq 8.5 \cdot 10^{-40}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if z < -2.2e-17 or 8.4999999999999998e-40 < z Initial program 99.9%
Taylor expanded in z around inf
+-commutativeN/A
+-lowering-+.f6478.4%
Simplified78.4%
if -2.2e-17 < z < 8.4999999999999998e-40Initial program 98.2%
Taylor expanded in x around inf
Simplified55.2%
Final simplification68.3%
(FPCore (x y z t a) :precision binary64 (if (<= y -3.5e+132) y (if (<= y 1000.0) x y)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -3.5e+132) {
tmp = y;
} else if (y <= 1000.0) {
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 <= (-3.5d+132)) then
tmp = y
else if (y <= 1000.0d0) 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 <= -3.5e+132) {
tmp = y;
} else if (y <= 1000.0) {
tmp = x;
} else {
tmp = y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if y <= -3.5e+132: tmp = y elif y <= 1000.0: tmp = x else: tmp = y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (y <= -3.5e+132) tmp = y; elseif (y <= 1000.0) tmp = x; else tmp = y; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (y <= -3.5e+132) tmp = y; elseif (y <= 1000.0) tmp = x; else tmp = y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[y, -3.5e+132], y, If[LessEqual[y, 1000.0], x, y]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.5 \cdot 10^{+132}:\\
\;\;\;\;y\\
\mathbf{elif}\;y \leq 1000:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y\\
\end{array}
\end{array}
if y < -3.5000000000000002e132 or 1e3 < y Initial program 99.9%
Taylor expanded in z around inf
+-commutativeN/A
+-lowering-+.f6456.9%
Simplified56.9%
Taylor expanded in y around inf
Simplified39.7%
if -3.5000000000000002e132 < y < 1e3Initial program 98.7%
Taylor expanded in x around inf
Simplified62.1%
(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 99.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 99.2%
Taylor expanded in x around inf
Simplified45.2%
(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 2024160
(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)))))