
(FPCore (x y z t) :precision binary64 (+ x (* (- y x) (/ z t))))
double code(double x, double y, double z, double t) {
return x + ((y - x) * (z / t));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x + ((y - x) * (z / t))
end function
public static double code(double x, double y, double z, double t) {
return x + ((y - x) * (z / t));
}
def code(x, y, z, t): return x + ((y - x) * (z / t))
function code(x, y, z, t) return Float64(x + Float64(Float64(y - x) * Float64(z / t))) end
function tmp = code(x, y, z, t) tmp = x + ((y - x) * (z / t)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(y - x), $MachinePrecision] * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(y - x\right) \cdot \frac{z}{t}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (+ x (* (- y x) (/ z t))))
double code(double x, double y, double z, double t) {
return x + ((y - x) * (z / t));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x + ((y - x) * (z / t))
end function
public static double code(double x, double y, double z, double t) {
return x + ((y - x) * (z / t));
}
def code(x, y, z, t): return x + ((y - x) * (z / t))
function code(x, y, z, t) return Float64(x + Float64(Float64(y - x) * Float64(z / t))) end
function tmp = code(x, y, z, t) tmp = x + ((y - x) * (z / t)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(y - x), $MachinePrecision] * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(y - x\right) \cdot \frac{z}{t}
\end{array}
(FPCore (x y z t) :precision binary64 (let* ((t_1 (+ x (* (- y x) (/ z t))))) (if (<= t_1 5e+301) t_1 (/ (* (- y x) z) t))))
double code(double x, double y, double z, double t) {
double t_1 = x + ((y - x) * (z / t));
double tmp;
if (t_1 <= 5e+301) {
tmp = t_1;
} else {
tmp = ((y - x) * z) / t;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = x + ((y - x) * (z / t))
if (t_1 <= 5d+301) then
tmp = t_1
else
tmp = ((y - x) * z) / t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x + ((y - x) * (z / t));
double tmp;
if (t_1 <= 5e+301) {
tmp = t_1;
} else {
tmp = ((y - x) * z) / t;
}
return tmp;
}
def code(x, y, z, t): t_1 = x + ((y - x) * (z / t)) tmp = 0 if t_1 <= 5e+301: tmp = t_1 else: tmp = ((y - x) * z) / t return tmp
function code(x, y, z, t) t_1 = Float64(x + Float64(Float64(y - x) * Float64(z / t))) tmp = 0.0 if (t_1 <= 5e+301) tmp = t_1; else tmp = Float64(Float64(Float64(y - x) * z) / t); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x + ((y - x) * (z / t)); tmp = 0.0; if (t_1 <= 5e+301) tmp = t_1; else tmp = ((y - x) * z) / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x + N[(N[(y - x), $MachinePrecision] * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 5e+301], t$95$1, N[(N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision] / t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \left(y - x\right) \cdot \frac{z}{t}\\
\mathbf{if}\;t_1 \leq 5 \cdot 10^{+301}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(y - x\right) \cdot z}{t}\\
\end{array}
\end{array}
if (+.f64 x (*.f64 (-.f64 y x) (/.f64 z t))) < 5.0000000000000004e301Initial program 99.4%
if 5.0000000000000004e301 < (+.f64 x (*.f64 (-.f64 y x) (/.f64 z t))) Initial program 87.2%
Taylor expanded in z around inf 89.4%
sub-div97.6%
*-commutative97.6%
associate-*l/99.9%
Applied egg-rr99.9%
Final simplification99.5%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ y (/ t z))))
(if (<= (/ z t) -2e+148)
t_1
(if (<= (/ z t) -1000.0)
(* x (- (/ z t)))
(if (<= (/ z t) 2e-7) x t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = y / (t / z);
double tmp;
if ((z / t) <= -2e+148) {
tmp = t_1;
} else if ((z / t) <= -1000.0) {
tmp = x * -(z / t);
} else if ((z / t) <= 2e-7) {
tmp = x;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = y / (t / z)
if ((z / t) <= (-2d+148)) then
tmp = t_1
else if ((z / t) <= (-1000.0d0)) then
tmp = x * -(z / t)
else if ((z / t) <= 2d-7) then
tmp = x
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = y / (t / z);
double tmp;
if ((z / t) <= -2e+148) {
tmp = t_1;
} else if ((z / t) <= -1000.0) {
tmp = x * -(z / t);
} else if ((z / t) <= 2e-7) {
tmp = x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = y / (t / z) tmp = 0 if (z / t) <= -2e+148: tmp = t_1 elif (z / t) <= -1000.0: tmp = x * -(z / t) elif (z / t) <= 2e-7: tmp = x else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(y / Float64(t / z)) tmp = 0.0 if (Float64(z / t) <= -2e+148) tmp = t_1; elseif (Float64(z / t) <= -1000.0) tmp = Float64(x * Float64(-Float64(z / t))); elseif (Float64(z / t) <= 2e-7) tmp = x; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = y / (t / z); tmp = 0.0; if ((z / t) <= -2e+148) tmp = t_1; elseif ((z / t) <= -1000.0) tmp = x * -(z / t); elseif ((z / t) <= 2e-7) tmp = x; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y / N[(t / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(z / t), $MachinePrecision], -2e+148], t$95$1, If[LessEqual[N[(z / t), $MachinePrecision], -1000.0], N[(x * (-N[(z / t), $MachinePrecision])), $MachinePrecision], If[LessEqual[N[(z / t), $MachinePrecision], 2e-7], x, t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y}{\frac{t}{z}}\\
\mathbf{if}\;\frac{z}{t} \leq -2 \cdot 10^{+148}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\frac{z}{t} \leq -1000:\\
\;\;\;\;x \cdot \left(-\frac{z}{t}\right)\\
\mathbf{elif}\;\frac{z}{t} \leq 2 \cdot 10^{-7}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if (/.f64 z t) < -2.0000000000000001e148 or 1.9999999999999999e-7 < (/.f64 z t) Initial program 95.9%
Taylor expanded in z around inf 86.4%
Taylor expanded in y around inf 57.9%
*-commutative57.9%
associate-*l/58.7%
associate-/l*63.0%
Applied egg-rr63.0%
if -2.0000000000000001e148 < (/.f64 z t) < -1e3Initial program 99.7%
Taylor expanded in x around inf 67.4%
mul-1-neg67.4%
unsub-neg67.4%
Simplified67.4%
Taylor expanded in z around inf 67.4%
neg-mul-167.4%
distribute-neg-frac67.4%
Simplified67.4%
if -1e3 < (/.f64 z t) < 1.9999999999999999e-7Initial program 99.1%
Taylor expanded in z around 0 80.7%
Final simplification71.3%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ z t) -50000.0) (not (<= (/ z t) 2e+58))) (* z (/ (- y x) t)) (* x (- 1.0 (/ z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (((z / t) <= -50000.0) || !((z / t) <= 2e+58)) {
tmp = z * ((y - x) / t);
} else {
tmp = x * (1.0 - (z / t));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (((z / t) <= (-50000.0d0)) .or. (.not. ((z / t) <= 2d+58))) then
tmp = z * ((y - x) / t)
else
tmp = x * (1.0d0 - (z / t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (((z / t) <= -50000.0) || !((z / t) <= 2e+58)) {
tmp = z * ((y - x) / t);
} else {
tmp = x * (1.0 - (z / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((z / t) <= -50000.0) or not ((z / t) <= 2e+58): tmp = z * ((y - x) / t) else: tmp = x * (1.0 - (z / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(z / t) <= -50000.0) || !(Float64(z / t) <= 2e+58)) tmp = Float64(z * Float64(Float64(y - x) / t)); else tmp = Float64(x * Float64(1.0 - Float64(z / t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((z / t) <= -50000.0) || ~(((z / t) <= 2e+58))) tmp = z * ((y - x) / t); else tmp = x * (1.0 - (z / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(z / t), $MachinePrecision], -50000.0], N[Not[LessEqual[N[(z / t), $MachinePrecision], 2e+58]], $MachinePrecision]], N[(z * N[(N[(y - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 - N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{z}{t} \leq -50000 \lor \neg \left(\frac{z}{t} \leq 2 \cdot 10^{+58}\right):\\
\;\;\;\;z \cdot \frac{y - x}{t}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - \frac{z}{t}\right)\\
\end{array}
\end{array}
if (/.f64 z t) < -5e4 or 1.99999999999999989e58 < (/.f64 z t) Initial program 96.1%
Taylor expanded in z around inf 89.5%
Taylor expanded in y around 0 89.5%
mul-1-neg89.5%
distribute-frac-neg89.5%
+-commutative89.5%
distribute-frac-neg89.5%
sub-neg89.5%
div-sub94.2%
Simplified94.2%
if -5e4 < (/.f64 z t) < 1.99999999999999989e58Initial program 99.1%
Taylor expanded in x around inf 79.3%
mul-1-neg79.3%
unsub-neg79.3%
Simplified79.3%
Final simplification86.7%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ z t) -2.0) (not (<= (/ z t) 2e-7))) (* (- y x) (/ z t)) (* x (- 1.0 (/ z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (((z / t) <= -2.0) || !((z / t) <= 2e-7)) {
tmp = (y - x) * (z / t);
} else {
tmp = x * (1.0 - (z / t));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (((z / t) <= (-2.0d0)) .or. (.not. ((z / t) <= 2d-7))) then
tmp = (y - x) * (z / t)
else
tmp = x * (1.0d0 - (z / t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (((z / t) <= -2.0) || !((z / t) <= 2e-7)) {
tmp = (y - x) * (z / t);
} else {
tmp = x * (1.0 - (z / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((z / t) <= -2.0) or not ((z / t) <= 2e-7): tmp = (y - x) * (z / t) else: tmp = x * (1.0 - (z / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(z / t) <= -2.0) || !(Float64(z / t) <= 2e-7)) tmp = Float64(Float64(y - x) * Float64(z / t)); else tmp = Float64(x * Float64(1.0 - Float64(z / t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((z / t) <= -2.0) || ~(((z / t) <= 2e-7))) tmp = (y - x) * (z / t); else tmp = x * (1.0 - (z / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(z / t), $MachinePrecision], -2.0], N[Not[LessEqual[N[(z / t), $MachinePrecision], 2e-7]], $MachinePrecision]], N[(N[(y - x), $MachinePrecision] * N[(z / t), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 - N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{z}{t} \leq -2 \lor \neg \left(\frac{z}{t} \leq 2 \cdot 10^{-7}\right):\\
\;\;\;\;\left(y - x\right) \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - \frac{z}{t}\right)\\
\end{array}
\end{array}
if (/.f64 z t) < -2 or 1.9999999999999999e-7 < (/.f64 z t) Initial program 96.5%
Taylor expanded in z around inf 84.8%
sub-div89.1%
*-commutative89.1%
associate-/r/96.3%
Applied egg-rr96.3%
clear-num96.1%
associate-/r/95.3%
clear-num95.3%
Applied egg-rr95.3%
if -2 < (/.f64 z t) < 1.9999999999999999e-7Initial program 99.1%
Taylor expanded in x around inf 82.1%
mul-1-neg82.1%
unsub-neg82.1%
Simplified82.1%
Final simplification89.5%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ z t) -2.0) (not (<= (/ z t) 2e-7))) (* (- y x) (/ z t)) (+ x (* y (/ z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (((z / t) <= -2.0) || !((z / t) <= 2e-7)) {
tmp = (y - x) * (z / t);
} else {
tmp = x + (y * (z / t));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (((z / t) <= (-2.0d0)) .or. (.not. ((z / t) <= 2d-7))) then
tmp = (y - x) * (z / t)
else
tmp = x + (y * (z / t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (((z / t) <= -2.0) || !((z / t) <= 2e-7)) {
tmp = (y - x) * (z / t);
} else {
tmp = x + (y * (z / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((z / t) <= -2.0) or not ((z / t) <= 2e-7): tmp = (y - x) * (z / t) else: tmp = x + (y * (z / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(z / t) <= -2.0) || !(Float64(z / t) <= 2e-7)) tmp = Float64(Float64(y - x) * Float64(z / t)); else tmp = Float64(x + Float64(y * Float64(z / t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((z / t) <= -2.0) || ~(((z / t) <= 2e-7))) tmp = (y - x) * (z / t); else tmp = x + (y * (z / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(z / t), $MachinePrecision], -2.0], N[Not[LessEqual[N[(z / t), $MachinePrecision], 2e-7]], $MachinePrecision]], N[(N[(y - x), $MachinePrecision] * N[(z / t), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{z}{t} \leq -2 \lor \neg \left(\frac{z}{t} \leq 2 \cdot 10^{-7}\right):\\
\;\;\;\;\left(y - x\right) \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\end{array}
\end{array}
if (/.f64 z t) < -2 or 1.9999999999999999e-7 < (/.f64 z t) Initial program 96.5%
Taylor expanded in z around inf 84.8%
sub-div89.1%
*-commutative89.1%
associate-/r/96.3%
Applied egg-rr96.3%
clear-num96.1%
associate-/r/95.3%
clear-num95.3%
Applied egg-rr95.3%
if -2 < (/.f64 z t) < 1.9999999999999999e-7Initial program 99.1%
Taylor expanded in y around inf 93.4%
associate-*r/98.4%
Simplified98.4%
Final simplification96.7%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ z t) -2.0) (not (<= (/ z t) 0.01))) (/ (- y x) (/ t z)) (+ x (* y (/ z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (((z / t) <= -2.0) || !((z / t) <= 0.01)) {
tmp = (y - x) / (t / z);
} else {
tmp = x + (y * (z / t));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (((z / t) <= (-2.0d0)) .or. (.not. ((z / t) <= 0.01d0))) then
tmp = (y - x) / (t / z)
else
tmp = x + (y * (z / t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (((z / t) <= -2.0) || !((z / t) <= 0.01)) {
tmp = (y - x) / (t / z);
} else {
tmp = x + (y * (z / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((z / t) <= -2.0) or not ((z / t) <= 0.01): tmp = (y - x) / (t / z) else: tmp = x + (y * (z / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(z / t) <= -2.0) || !(Float64(z / t) <= 0.01)) tmp = Float64(Float64(y - x) / Float64(t / z)); else tmp = Float64(x + Float64(y * Float64(z / t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((z / t) <= -2.0) || ~(((z / t) <= 0.01))) tmp = (y - x) / (t / z); else tmp = x + (y * (z / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(z / t), $MachinePrecision], -2.0], N[Not[LessEqual[N[(z / t), $MachinePrecision], 0.01]], $MachinePrecision]], N[(N[(y - x), $MachinePrecision] / N[(t / z), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{z}{t} \leq -2 \lor \neg \left(\frac{z}{t} \leq 0.01\right):\\
\;\;\;\;\frac{y - x}{\frac{t}{z}}\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\end{array}
\end{array}
if (/.f64 z t) < -2 or 0.0100000000000000002 < (/.f64 z t) Initial program 96.5%
Taylor expanded in z around inf 85.3%
sub-div89.7%
*-commutative89.7%
associate-/r/96.2%
Applied egg-rr96.2%
if -2 < (/.f64 z t) < 0.0100000000000000002Initial program 99.1%
Taylor expanded in y around inf 93.4%
associate-*r/98.4%
Simplified98.4%
Final simplification97.2%
(FPCore (x y z t) :precision binary64 (if (<= (/ z t) -2.0) (* (- y x) (/ z t)) (if (<= (/ z t) 2e-7) (+ x (* y (/ z t))) (/ (* (- y x) z) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z / t) <= -2.0) {
tmp = (y - x) * (z / t);
} else if ((z / t) <= 2e-7) {
tmp = x + (y * (z / t));
} else {
tmp = ((y - x) * z) / t;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((z / t) <= (-2.0d0)) then
tmp = (y - x) * (z / t)
else if ((z / t) <= 2d-7) then
tmp = x + (y * (z / t))
else
tmp = ((y - x) * z) / t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z / t) <= -2.0) {
tmp = (y - x) * (z / t);
} else if ((z / t) <= 2e-7) {
tmp = x + (y * (z / t));
} else {
tmp = ((y - x) * z) / t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z / t) <= -2.0: tmp = (y - x) * (z / t) elif (z / t) <= 2e-7: tmp = x + (y * (z / t)) else: tmp = ((y - x) * z) / t return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(z / t) <= -2.0) tmp = Float64(Float64(y - x) * Float64(z / t)); elseif (Float64(z / t) <= 2e-7) tmp = Float64(x + Float64(y * Float64(z / t))); else tmp = Float64(Float64(Float64(y - x) * z) / t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z / t) <= -2.0) tmp = (y - x) * (z / t); elseif ((z / t) <= 2e-7) tmp = x + (y * (z / t)); else tmp = ((y - x) * z) / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(z / t), $MachinePrecision], -2.0], N[(N[(y - x), $MachinePrecision] * N[(z / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z / t), $MachinePrecision], 2e-7], N[(x + N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision] / t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{z}{t} \leq -2:\\
\;\;\;\;\left(y - x\right) \cdot \frac{z}{t}\\
\mathbf{elif}\;\frac{z}{t} \leq 2 \cdot 10^{-7}:\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(y - x\right) \cdot z}{t}\\
\end{array}
\end{array}
if (/.f64 z t) < -2Initial program 98.3%
Taylor expanded in z around inf 86.6%
sub-div91.4%
*-commutative91.4%
associate-/r/97.1%
Applied egg-rr97.1%
clear-num96.9%
associate-/r/96.7%
clear-num96.7%
Applied egg-rr96.7%
if -2 < (/.f64 z t) < 1.9999999999999999e-7Initial program 99.1%
Taylor expanded in y around inf 93.4%
associate-*r/98.4%
Simplified98.4%
if 1.9999999999999999e-7 < (/.f64 z t) Initial program 95.1%
Taylor expanded in z around inf 83.4%
sub-div87.3%
*-commutative87.3%
associate-*l/95.4%
Applied egg-rr95.4%
Final simplification97.0%
(FPCore (x y z t)
:precision binary64
(if (or (<= z -2.9e-100)
(and (not (<= z 2.6e-85)) (or (<= z 5.6e-32) (not (<= z 1.7e+23)))))
(* z (/ y t))
x))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -2.9e-100) || (!(z <= 2.6e-85) && ((z <= 5.6e-32) || !(z <= 1.7e+23)))) {
tmp = z * (y / t);
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((z <= (-2.9d-100)) .or. (.not. (z <= 2.6d-85)) .and. (z <= 5.6d-32) .or. (.not. (z <= 1.7d+23))) then
tmp = z * (y / t)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -2.9e-100) || (!(z <= 2.6e-85) && ((z <= 5.6e-32) || !(z <= 1.7e+23)))) {
tmp = z * (y / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -2.9e-100) or (not (z <= 2.6e-85) and ((z <= 5.6e-32) or not (z <= 1.7e+23))): tmp = z * (y / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -2.9e-100) || (!(z <= 2.6e-85) && ((z <= 5.6e-32) || !(z <= 1.7e+23)))) tmp = Float64(z * Float64(y / t)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -2.9e-100) || (~((z <= 2.6e-85)) && ((z <= 5.6e-32) || ~((z <= 1.7e+23))))) tmp = z * (y / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -2.9e-100], And[N[Not[LessEqual[z, 2.6e-85]], $MachinePrecision], Or[LessEqual[z, 5.6e-32], N[Not[LessEqual[z, 1.7e+23]], $MachinePrecision]]]], N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.9 \cdot 10^{-100} \lor \neg \left(z \leq 2.6 \cdot 10^{-85}\right) \land \left(z \leq 5.6 \cdot 10^{-32} \lor \neg \left(z \leq 1.7 \cdot 10^{+23}\right)\right):\\
\;\;\;\;z \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -2.89999999999999975e-100 or 2.60000000000000011e-85 < z < 5.5999999999999998e-32 or 1.69999999999999996e23 < z Initial program 96.9%
Taylor expanded in z around inf 77.9%
Taylor expanded in y around inf 52.3%
if -2.89999999999999975e-100 < z < 2.60000000000000011e-85 or 5.5999999999999998e-32 < z < 1.69999999999999996e23Initial program 98.9%
Taylor expanded in z around 0 72.4%
Final simplification59.8%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ z t) -2.0) (not (<= (/ z t) 2e-7))) (* y (/ z t)) x))
double code(double x, double y, double z, double t) {
double tmp;
if (((z / t) <= -2.0) || !((z / t) <= 2e-7)) {
tmp = y * (z / t);
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (((z / t) <= (-2.0d0)) .or. (.not. ((z / t) <= 2d-7))) then
tmp = y * (z / t)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (((z / t) <= -2.0) || !((z / t) <= 2e-7)) {
tmp = y * (z / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((z / t) <= -2.0) or not ((z / t) <= 2e-7): tmp = y * (z / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(z / t) <= -2.0) || !(Float64(z / t) <= 2e-7)) tmp = Float64(y * Float64(z / t)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((z / t) <= -2.0) || ~(((z / t) <= 2e-7))) tmp = y * (z / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(z / t), $MachinePrecision], -2.0], N[Not[LessEqual[N[(z / t), $MachinePrecision], 2e-7]], $MachinePrecision]], N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{z}{t} \leq -2 \lor \neg \left(\frac{z}{t} \leq 2 \cdot 10^{-7}\right):\\
\;\;\;\;y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if (/.f64 z t) < -2 or 1.9999999999999999e-7 < (/.f64 z t) Initial program 96.5%
Taylor expanded in z around inf 84.8%
Taylor expanded in y around inf 52.8%
*-commutative52.8%
associate-*l/53.2%
associate-/l*58.1%
Applied egg-rr58.1%
Taylor expanded in y around 0 53.2%
*-commutative53.2%
associate-*l/57.8%
Simplified57.8%
if -2 < (/.f64 z t) < 1.9999999999999999e-7Initial program 99.1%
Taylor expanded in z around 0 81.4%
Final simplification68.2%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ z t) -2.0) (not (<= (/ z t) 2e-7))) (/ y (/ t z)) x))
double code(double x, double y, double z, double t) {
double tmp;
if (((z / t) <= -2.0) || !((z / t) <= 2e-7)) {
tmp = y / (t / z);
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (((z / t) <= (-2.0d0)) .or. (.not. ((z / t) <= 2d-7))) then
tmp = y / (t / z)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (((z / t) <= -2.0) || !((z / t) <= 2e-7)) {
tmp = y / (t / z);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((z / t) <= -2.0) or not ((z / t) <= 2e-7): tmp = y / (t / z) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(z / t) <= -2.0) || !(Float64(z / t) <= 2e-7)) tmp = Float64(y / Float64(t / z)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((z / t) <= -2.0) || ~(((z / t) <= 2e-7))) tmp = y / (t / z); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(z / t), $MachinePrecision], -2.0], N[Not[LessEqual[N[(z / t), $MachinePrecision], 2e-7]], $MachinePrecision]], N[(y / N[(t / z), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{z}{t} \leq -2 \lor \neg \left(\frac{z}{t} \leq 2 \cdot 10^{-7}\right):\\
\;\;\;\;\frac{y}{\frac{t}{z}}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if (/.f64 z t) < -2 or 1.9999999999999999e-7 < (/.f64 z t) Initial program 96.5%
Taylor expanded in z around inf 84.8%
Taylor expanded in y around inf 52.8%
*-commutative52.8%
associate-*l/53.2%
associate-/l*58.1%
Applied egg-rr58.1%
if -2 < (/.f64 z t) < 1.9999999999999999e-7Initial program 99.1%
Taylor expanded in z around 0 81.4%
Final simplification68.4%
(FPCore (x y z t) :precision binary64 (if (or (<= y -6e+140) (not (<= y 4.2e+178))) (* y (/ z t)) (* x (- 1.0 (/ z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -6e+140) || !(y <= 4.2e+178)) {
tmp = y * (z / t);
} else {
tmp = x * (1.0 - (z / t));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((y <= (-6d+140)) .or. (.not. (y <= 4.2d+178))) then
tmp = y * (z / t)
else
tmp = x * (1.0d0 - (z / t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -6e+140) || !(y <= 4.2e+178)) {
tmp = y * (z / t);
} else {
tmp = x * (1.0 - (z / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -6e+140) or not (y <= 4.2e+178): tmp = y * (z / t) else: tmp = x * (1.0 - (z / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -6e+140) || !(y <= 4.2e+178)) tmp = Float64(y * Float64(z / t)); else tmp = Float64(x * Float64(1.0 - Float64(z / t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -6e+140) || ~((y <= 4.2e+178))) tmp = y * (z / t); else tmp = x * (1.0 - (z / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -6e+140], N[Not[LessEqual[y, 4.2e+178]], $MachinePrecision]], N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 - N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -6 \cdot 10^{+140} \lor \neg \left(y \leq 4.2 \cdot 10^{+178}\right):\\
\;\;\;\;y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - \frac{z}{t}\right)\\
\end{array}
\end{array}
if y < -5.99999999999999993e140 or 4.1999999999999997e178 < y Initial program 98.4%
Taylor expanded in z around inf 68.5%
Taylor expanded in y around inf 71.5%
*-commutative71.5%
associate-*l/72.4%
associate-/l*80.5%
Applied egg-rr80.5%
Taylor expanded in y around 0 72.4%
*-commutative72.4%
associate-*l/80.6%
Simplified80.6%
if -5.99999999999999993e140 < y < 4.1999999999999997e178Initial program 97.4%
Taylor expanded in x around inf 80.0%
mul-1-neg80.0%
unsub-neg80.0%
Simplified80.0%
Final simplification80.2%
(FPCore (x y z t) :precision binary64 (+ x (/ (- y x) (/ t z))))
double code(double x, double y, double z, double t) {
return x + ((y - x) / (t / z));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x + ((y - x) / (t / z))
end function
public static double code(double x, double y, double z, double t) {
return x + ((y - x) / (t / z));
}
def code(x, y, z, t): return x + ((y - x) / (t / z))
function code(x, y, z, t) return Float64(x + Float64(Float64(y - x) / Float64(t / z))) end
function tmp = code(x, y, z, t) tmp = x + ((y - x) / (t / z)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(y - x), $MachinePrecision] / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y - x}{\frac{t}{z}}
\end{array}
Initial program 97.6%
Taylor expanded in y around 0 88.9%
+-commutative88.9%
mul-1-neg88.9%
sub-neg88.9%
associate-/l*90.9%
associate-/l*92.3%
div-sub98.2%
Simplified98.2%
Final simplification98.2%
(FPCore (x y z t) :precision binary64 x)
double code(double x, double y, double z, double t) {
return x;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x
end function
public static double code(double x, double y, double z, double t) {
return x;
}
def code(x, y, z, t): return x
function code(x, y, z, t) return x end
function tmp = code(x, y, z, t) tmp = x; end
code[x_, y_, z_, t_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 97.6%
Taylor expanded in z around 0 37.5%
Final simplification37.5%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (- y x) (/ z t))) (t_2 (+ x (/ (- y x) (/ t z)))))
(if (< t_1 -1013646692435.8867)
t_2
(if (< t_1 0.0) (+ x (/ (* (- y x) z) t)) t_2))))
double code(double x, double y, double z, double t) {
double t_1 = (y - x) * (z / t);
double t_2 = x + ((y - x) / (t / z));
double tmp;
if (t_1 < -1013646692435.8867) {
tmp = t_2;
} else if (t_1 < 0.0) {
tmp = x + (((y - x) * z) / t);
} else {
tmp = t_2;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = (y - x) * (z / t)
t_2 = x + ((y - x) / (t / z))
if (t_1 < (-1013646692435.8867d0)) then
tmp = t_2
else if (t_1 < 0.0d0) then
tmp = x + (((y - x) * z) / t)
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (y - x) * (z / t);
double t_2 = x + ((y - x) / (t / z));
double tmp;
if (t_1 < -1013646692435.8867) {
tmp = t_2;
} else if (t_1 < 0.0) {
tmp = x + (((y - x) * z) / t);
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t): t_1 = (y - x) * (z / t) t_2 = x + ((y - x) / (t / z)) tmp = 0 if t_1 < -1013646692435.8867: tmp = t_2 elif t_1 < 0.0: tmp = x + (((y - x) * z) / t) else: tmp = t_2 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(y - x) * Float64(z / t)) t_2 = Float64(x + Float64(Float64(y - x) / Float64(t / z))) tmp = 0.0 if (t_1 < -1013646692435.8867) tmp = t_2; elseif (t_1 < 0.0) tmp = Float64(x + Float64(Float64(Float64(y - x) * z) / t)); else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (y - x) * (z / t); t_2 = x + ((y - x) / (t / z)); tmp = 0.0; if (t_1 < -1013646692435.8867) tmp = t_2; elseif (t_1 < 0.0) tmp = x + (((y - x) * z) / t); else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(y - x), $MachinePrecision] * N[(z / t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x + N[(N[(y - x), $MachinePrecision] / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Less[t$95$1, -1013646692435.8867], t$95$2, If[Less[t$95$1, 0.0], N[(x + N[(N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], t$95$2]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(y - x\right) \cdot \frac{z}{t}\\
t_2 := x + \frac{y - x}{\frac{t}{z}}\\
\mathbf{if}\;t_1 < -1013646692435.8867:\\
\;\;\;\;t_2\\
\mathbf{elif}\;t_1 < 0:\\
\;\;\;\;x + \frac{\left(y - x\right) \cdot z}{t}\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
herbie shell --seed 2023312
(FPCore (x y z t)
:name "Graphics.Rendering.Plot.Render.Plot.Axis:tickPosition from plot-0.2.3.4"
:precision binary64
:herbie-target
(if (< (* (- y x) (/ z t)) -1013646692435.8867) (+ x (/ (- y x) (/ t z))) (if (< (* (- y x) (/ z t)) 0.0) (+ x (/ (* (- y x) z) t)) (+ x (/ (- y x) (/ t z)))))
(+ x (* (- y x) (/ z t))))