
(FPCore (x y z t a) :precision binary64 (+ x (/ (* (- y z) t) (- a z))))
double code(double x, double y, double z, double t, double a) {
return x + (((y - z) * t) / (a - z));
}
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) / (a - z))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (((y - z) * t) / (a - z));
}
def code(x, y, z, t, a): return x + (((y - z) * t) / (a - z))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(Float64(y - z) * t) / Float64(a - z))) end
function tmp = code(x, y, z, t, a) tmp = x + (((y - z) * t) / (a - z)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{\left(y - z\right) \cdot t}{a - z}
\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) (- a z))))
double code(double x, double y, double z, double t, double a) {
return x + (((y - z) * t) / (a - z));
}
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) / (a - z))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (((y - z) * t) / (a - z));
}
def code(x, y, z, t, a): return x + (((y - z) * t) / (a - z))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(Float64(y - z) * t) / Float64(a - z))) end
function tmp = code(x, y, z, t, a) tmp = x + (((y - z) * t) / (a - z)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{\left(y - z\right) \cdot t}{a - z}
\end{array}
(FPCore (x y z t a) :precision binary64 (fma (/ (- y z) (- a z)) t x))
double code(double x, double y, double z, double t, double a) {
return fma(((y - z) / (a - z)), t, x);
}
function code(x, y, z, t, a) return fma(Float64(Float64(y - z) / Float64(a - z)), t, x) end
code[x_, y_, z_, t_, a_] := N[(N[(N[(y - z), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision] * t + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\frac{y - z}{a - z}, t, x\right)
\end{array}
Initial program 84.1%
+-commutative84.1%
associate-*l/98.1%
fma-def98.1%
Simplified98.1%
Final simplification98.1%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (* t (- 1.0 (/ y z))))))
(if (<= z -8.0)
t_1
(if (<= z -1.4e-123)
(+ x (* t (/ (- y z) a)))
(if (<= z 9e+36) (+ x (/ (* y t) (- a z))) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x + (t * (1.0 - (y / z)));
double tmp;
if (z <= -8.0) {
tmp = t_1;
} else if (z <= -1.4e-123) {
tmp = x + (t * ((y - z) / a));
} else if (z <= 9e+36) {
tmp = x + ((y * t) / (a - z));
} 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 + (t * (1.0d0 - (y / z)))
if (z <= (-8.0d0)) then
tmp = t_1
else if (z <= (-1.4d-123)) then
tmp = x + (t * ((y - z) / a))
else if (z <= 9d+36) then
tmp = x + ((y * t) / (a - z))
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 + (t * (1.0 - (y / z)));
double tmp;
if (z <= -8.0) {
tmp = t_1;
} else if (z <= -1.4e-123) {
tmp = x + (t * ((y - z) / a));
} else if (z <= 9e+36) {
tmp = x + ((y * t) / (a - z));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x + (t * (1.0 - (y / z))) tmp = 0 if z <= -8.0: tmp = t_1 elif z <= -1.4e-123: tmp = x + (t * ((y - z) / a)) elif z <= 9e+36: tmp = x + ((y * t) / (a - z)) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(x + Float64(t * Float64(1.0 - Float64(y / z)))) tmp = 0.0 if (z <= -8.0) tmp = t_1; elseif (z <= -1.4e-123) tmp = Float64(x + Float64(t * Float64(Float64(y - z) / a))); elseif (z <= 9e+36) tmp = Float64(x + Float64(Float64(y * t) / Float64(a - z))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x + (t * (1.0 - (y / z))); tmp = 0.0; if (z <= -8.0) tmp = t_1; elseif (z <= -1.4e-123) tmp = x + (t * ((y - z) / a)); elseif (z <= 9e+36) tmp = x + ((y * t) / (a - z)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(t * N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -8.0], t$95$1, If[LessEqual[z, -1.4e-123], N[(x + N[(t * N[(N[(y - z), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 9e+36], N[(x + N[(N[(y * t), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + t \cdot \left(1 - \frac{y}{z}\right)\\
\mathbf{if}\;z \leq -8:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -1.4 \cdot 10^{-123}:\\
\;\;\;\;x + t \cdot \frac{y - z}{a}\\
\mathbf{elif}\;z \leq 9 \cdot 10^{+36}:\\
\;\;\;\;x + \frac{y \cdot t}{a - z}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if z < -8 or 8.99999999999999994e36 < z Initial program 74.1%
associate-*l/99.9%
Simplified99.9%
Taylor expanded in a around 0 91.1%
mul-1-neg91.1%
div-sub91.1%
*-inverses91.1%
Simplified91.1%
Taylor expanded in t around 0 91.1%
if -8 < z < -1.3999999999999999e-123Initial program 80.8%
associate-*l/99.8%
Simplified99.8%
Taylor expanded in a around inf 90.2%
if -1.3999999999999999e-123 < z < 8.99999999999999994e36Initial program 98.8%
associate-*l/95.2%
Simplified95.2%
Taylor expanded in y around inf 92.0%
Final simplification91.4%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -3.0) (not (<= z 6.2e-130))) (+ x (* t (- 1.0 (/ y z)))) (+ x (* y (/ t a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -3.0) || !(z <= 6.2e-130)) {
tmp = x + (t * (1.0 - (y / 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 <= (-3.0d0)) .or. (.not. (z <= 6.2d-130))) then
tmp = x + (t * (1.0d0 - (y / 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 <= -3.0) || !(z <= 6.2e-130)) {
tmp = x + (t * (1.0 - (y / z)));
} else {
tmp = x + (y * (t / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -3.0) or not (z <= 6.2e-130): tmp = x + (t * (1.0 - (y / z))) else: tmp = x + (y * (t / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -3.0) || !(z <= 6.2e-130)) tmp = Float64(x + Float64(t * Float64(1.0 - Float64(y / 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 <= -3.0) || ~((z <= 6.2e-130))) tmp = x + (t * (1.0 - (y / z))); else tmp = x + (y * (t / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -3.0], N[Not[LessEqual[z, 6.2e-130]], $MachinePrecision]], N[(x + N[(t * N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3 \lor \neg \left(z \leq 6.2 \cdot 10^{-130}\right):\\
\;\;\;\;x + t \cdot \left(1 - \frac{y}{z}\right)\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{t}{a}\\
\end{array}
\end{array}
if z < -3 or 6.20000000000000021e-130 < z Initial program 79.1%
associate-*l/99.9%
Simplified99.9%
Taylor expanded in a around 0 86.0%
mul-1-neg86.0%
div-sub86.1%
*-inverses86.1%
Simplified86.1%
Taylor expanded in t around 0 86.1%
if -3 < z < 6.20000000000000021e-130Initial program 94.1%
associate-*l/94.4%
Simplified94.4%
Taylor expanded in z around 0 83.2%
+-commutative83.2%
associate-/l*84.4%
Simplified84.4%
associate-/r/88.9%
Applied egg-rr88.9%
Final simplification87.0%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -8e+28) (not (<= z 1.2e+37))) (+ x (* t (- 1.0 (/ y z)))) (+ x (* t (/ y (- a z))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -8e+28) || !(z <= 1.2e+37)) {
tmp = x + (t * (1.0 - (y / 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 <= (-8d+28)) .or. (.not. (z <= 1.2d+37))) then
tmp = x + (t * (1.0d0 - (y / 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 <= -8e+28) || !(z <= 1.2e+37)) {
tmp = x + (t * (1.0 - (y / z)));
} else {
tmp = x + (t * (y / (a - z)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -8e+28) or not (z <= 1.2e+37): tmp = x + (t * (1.0 - (y / z))) else: tmp = x + (t * (y / (a - z))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -8e+28) || !(z <= 1.2e+37)) tmp = Float64(x + Float64(t * Float64(1.0 - Float64(y / 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 <= -8e+28) || ~((z <= 1.2e+37))) tmp = x + (t * (1.0 - (y / z))); else tmp = x + (t * (y / (a - z))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -8e+28], N[Not[LessEqual[z, 1.2e+37]], $MachinePrecision]], N[(x + N[(t * N[(1.0 - N[(y / 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 -8 \cdot 10^{+28} \lor \neg \left(z \leq 1.2 \cdot 10^{+37}\right):\\
\;\;\;\;x + t \cdot \left(1 - \frac{y}{z}\right)\\
\mathbf{else}:\\
\;\;\;\;x + t \cdot \frac{y}{a - z}\\
\end{array}
\end{array}
if z < -7.99999999999999967e28 or 1.2e37 < z Initial program 73.1%
associate-*l/99.9%
Simplified99.9%
Taylor expanded in a around 0 92.0%
mul-1-neg92.0%
div-sub92.0%
*-inverses92.0%
Simplified92.0%
Taylor expanded in t around 0 92.0%
if -7.99999999999999967e28 < z < 1.2e37Initial program 95.2%
associate-*l/96.2%
Simplified96.2%
Taylor expanded in y around inf 87.3%
Final simplification89.7%
(FPCore (x y z t a) :precision binary64 (if (<= z -3200000000.0) (+ t x) (if (<= z 1.5e-139) (* t (/ y (- a z))) (+ t x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -3200000000.0) {
tmp = t + x;
} else if (z <= 1.5e-139) {
tmp = t * (y / (a - z));
} else {
tmp = t + 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 <= (-3200000000.0d0)) then
tmp = t + x
else if (z <= 1.5d-139) then
tmp = t * (y / (a - z))
else
tmp = t + 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 <= -3200000000.0) {
tmp = t + x;
} else if (z <= 1.5e-139) {
tmp = t * (y / (a - z));
} else {
tmp = t + x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -3200000000.0: tmp = t + x elif z <= 1.5e-139: tmp = t * (y / (a - z)) else: tmp = t + x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -3200000000.0) tmp = Float64(t + x); elseif (z <= 1.5e-139) tmp = Float64(t * Float64(y / Float64(a - z))); else tmp = Float64(t + x); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -3200000000.0) tmp = t + x; elseif (z <= 1.5e-139) tmp = t * (y / (a - z)); else tmp = t + x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -3200000000.0], N[(t + x), $MachinePrecision], If[LessEqual[z, 1.5e-139], N[(t * N[(y / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3200000000:\\
\;\;\;\;t + x\\
\mathbf{elif}\;z \leq 1.5 \cdot 10^{-139}:\\
\;\;\;\;t \cdot \frac{y}{a - z}\\
\mathbf{else}:\\
\;\;\;\;t + x\\
\end{array}
\end{array}
if z < -3.2e9 or 1.5e-139 < z Initial program 79.1%
associate-*l/99.9%
Simplified99.9%
Taylor expanded in z around inf 77.7%
if -3.2e9 < z < 1.5e-139Initial program 94.1%
+-commutative94.1%
associate-*l/94.4%
fma-def94.4%
Simplified94.4%
fma-udef94.4%
div-inv94.4%
associate-*l*97.6%
fma-def97.6%
*-commutative97.6%
div-inv97.7%
fma-def97.7%
Applied egg-rr97.7%
clear-num97.6%
un-div-inv97.6%
Applied egg-rr97.6%
Taylor expanded in y around inf 88.7%
Taylor expanded in t around inf 48.9%
associate-*r/46.8%
Simplified46.8%
Final simplification67.4%
(FPCore (x y z t a) :precision binary64 (if (<= z -1.45) (+ t x) (if (<= z 6.4e+58) (+ x (* t (/ y a))) (+ t x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.45) {
tmp = t + x;
} else if (z <= 6.4e+58) {
tmp = x + (t * (y / a));
} else {
tmp = t + 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 <= (-1.45d0)) then
tmp = t + x
else if (z <= 6.4d+58) then
tmp = x + (t * (y / a))
else
tmp = t + 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 <= -1.45) {
tmp = t + x;
} else if (z <= 6.4e+58) {
tmp = x + (t * (y / a));
} else {
tmp = t + x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -1.45: tmp = t + x elif z <= 6.4e+58: tmp = x + (t * (y / a)) else: tmp = t + x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.45) tmp = Float64(t + x); elseif (z <= 6.4e+58) tmp = Float64(x + Float64(t * Float64(y / a))); else tmp = Float64(t + x); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -1.45) tmp = t + x; elseif (z <= 6.4e+58) tmp = x + (t * (y / a)); else tmp = t + x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.45], N[(t + x), $MachinePrecision], If[LessEqual[z, 6.4e+58], N[(x + N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.45:\\
\;\;\;\;t + x\\
\mathbf{elif}\;z \leq 6.4 \cdot 10^{+58}:\\
\;\;\;\;x + t \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;t + x\\
\end{array}
\end{array}
if z < -1.44999999999999996 or 6.40000000000000031e58 < z Initial program 73.3%
associate-*l/99.9%
Simplified99.9%
Taylor expanded in z around inf 83.1%
if -1.44999999999999996 < z < 6.40000000000000031e58Initial program 95.9%
associate-*l/96.1%
Simplified96.1%
Taylor expanded in z around 0 78.9%
Final simplification81.1%
(FPCore (x y z t a) :precision binary64 (if (<= z -11000.0) (+ t x) (if (<= z 2.2e+58) (+ x (* y (/ t a))) (+ t x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -11000.0) {
tmp = t + x;
} else if (z <= 2.2e+58) {
tmp = x + (y * (t / a));
} else {
tmp = t + 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 <= (-11000.0d0)) then
tmp = t + x
else if (z <= 2.2d+58) then
tmp = x + (y * (t / a))
else
tmp = t + 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 <= -11000.0) {
tmp = t + x;
} else if (z <= 2.2e+58) {
tmp = x + (y * (t / a));
} else {
tmp = t + x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -11000.0: tmp = t + x elif z <= 2.2e+58: tmp = x + (y * (t / a)) else: tmp = t + x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -11000.0) tmp = Float64(t + x); elseif (z <= 2.2e+58) tmp = Float64(x + Float64(y * Float64(t / a))); else tmp = Float64(t + x); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -11000.0) tmp = t + x; elseif (z <= 2.2e+58) tmp = x + (y * (t / a)); else tmp = t + x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -11000.0], N[(t + x), $MachinePrecision], If[LessEqual[z, 2.2e+58], N[(x + N[(y * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -11000:\\
\;\;\;\;t + x\\
\mathbf{elif}\;z \leq 2.2 \cdot 10^{+58}:\\
\;\;\;\;x + y \cdot \frac{t}{a}\\
\mathbf{else}:\\
\;\;\;\;t + x\\
\end{array}
\end{array}
if z < -11000 or 2.2000000000000001e58 < z Initial program 73.3%
associate-*l/99.9%
Simplified99.9%
Taylor expanded in z around inf 83.1%
if -11000 < z < 2.2000000000000001e58Initial program 95.9%
associate-*l/96.1%
Simplified96.1%
Taylor expanded in z around 0 78.0%
+-commutative78.0%
associate-/l*78.8%
Simplified78.8%
associate-/r/81.9%
Applied egg-rr81.9%
Final simplification82.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(Float64(Float64(y - z) / Float64(a - 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[(N[(N[(y - z), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y - z}{a - z} \cdot t
\end{array}
Initial program 84.1%
associate-*l/98.1%
Simplified98.1%
Final simplification98.1%
(FPCore (x y z t a) :precision binary64 (if (<= z -0.44) (+ t x) (if (<= z 12500000.0) x (+ t x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -0.44) {
tmp = t + x;
} else if (z <= 12500000.0) {
tmp = x;
} else {
tmp = t + 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 <= (-0.44d0)) then
tmp = t + x
else if (z <= 12500000.0d0) then
tmp = x
else
tmp = t + 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 <= -0.44) {
tmp = t + x;
} else if (z <= 12500000.0) {
tmp = x;
} else {
tmp = t + x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -0.44: tmp = t + x elif z <= 12500000.0: tmp = x else: tmp = t + x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -0.44) tmp = Float64(t + x); elseif (z <= 12500000.0) tmp = x; else tmp = Float64(t + x); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -0.44) tmp = t + x; elseif (z <= 12500000.0) tmp = x; else tmp = t + x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -0.44], N[(t + x), $MachinePrecision], If[LessEqual[z, 12500000.0], x, N[(t + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.44:\\
\;\;\;\;t + x\\
\mathbf{elif}\;z \leq 12500000:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t + x\\
\end{array}
\end{array}
if z < -0.440000000000000002 or 1.25e7 < z Initial program 75.5%
associate-*l/99.9%
Simplified99.9%
Taylor expanded in z around inf 81.9%
if -0.440000000000000002 < z < 1.25e7Initial program 95.5%
associate-*l/95.7%
Simplified95.7%
Taylor expanded in x around inf 48.1%
Final simplification67.4%
(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 84.1%
associate-*l/98.1%
Simplified98.1%
Taylor expanded in x around inf 47.9%
Final simplification47.9%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (* (/ (- y z) (- a z)) t))))
(if (< t -1.0682974490174067e-39)
t_1
(if (< t 3.9110949887586375e-141) (+ x (/ (* (- y z) t) (- a z))) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x + (((y - z) / (a - z)) * t);
double tmp;
if (t < -1.0682974490174067e-39) {
tmp = t_1;
} else if (t < 3.9110949887586375e-141) {
tmp = x + (((y - z) * t) / (a - z));
} 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 - z) / (a - z)) * t)
if (t < (-1.0682974490174067d-39)) then
tmp = t_1
else if (t < 3.9110949887586375d-141) then
tmp = x + (((y - z) * t) / (a - z))
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 - z) / (a - z)) * t);
double tmp;
if (t < -1.0682974490174067e-39) {
tmp = t_1;
} else if (t < 3.9110949887586375e-141) {
tmp = x + (((y - z) * t) / (a - z));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x + (((y - z) / (a - z)) * t) tmp = 0 if t < -1.0682974490174067e-39: tmp = t_1 elif t < 3.9110949887586375e-141: tmp = x + (((y - z) * t) / (a - z)) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(x + Float64(Float64(Float64(y - z) / Float64(a - z)) * t)) tmp = 0.0 if (t < -1.0682974490174067e-39) tmp = t_1; elseif (t < 3.9110949887586375e-141) tmp = Float64(x + Float64(Float64(Float64(y - z) * t) / Float64(a - z))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x + (((y - z) / (a - z)) * t); tmp = 0.0; if (t < -1.0682974490174067e-39) tmp = t_1; elseif (t < 3.9110949887586375e-141) tmp = x + (((y - z) * t) / (a - z)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(N[(N[(y - z), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]}, If[Less[t, -1.0682974490174067e-39], t$95$1, If[Less[t, 3.9110949887586375e-141], N[(x + N[(N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \frac{y - z}{a - z} \cdot t\\
\mathbf{if}\;t < -1.0682974490174067 \cdot 10^{-39}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t < 3.9110949887586375 \cdot 10^{-141}:\\
\;\;\;\;x + \frac{\left(y - z\right) \cdot t}{a - z}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
herbie shell --seed 2023297
(FPCore (x y z t a)
:name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisTick from plot-0.2.3.4, A"
:precision binary64
:herbie-target
(if (< t -1.0682974490174067e-39) (+ x (* (/ (- y z) (- a z)) t)) (if (< t 3.9110949887586375e-141) (+ x (/ (* (- y z) t) (- a z))) (+ x (* (/ (- y z) (- a z)) t))))
(+ x (/ (* (- y z) t) (- a z))))