
(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 11 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 (+ 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.7%
clear-num97.6%
un-div-inv97.9%
Applied egg-rr97.9%
Final simplification97.9%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* y (/ z t))) (t_2 (* z (/ (- x) t))))
(if (<= (/ z t) -5e+85)
t_2
(if (<= (/ z t) -1e-41)
t_1
(if (<= (/ z t) 1e-24) x (if (<= (/ z t) 1e+84) t_1 t_2))))))
double code(double x, double y, double z, double t) {
double t_1 = y * (z / t);
double t_2 = z * (-x / t);
double tmp;
if ((z / t) <= -5e+85) {
tmp = t_2;
} else if ((z / t) <= -1e-41) {
tmp = t_1;
} else if ((z / t) <= 1e-24) {
tmp = x;
} else if ((z / t) <= 1e+84) {
tmp = t_1;
} 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 * (z / t)
t_2 = z * (-x / t)
if ((z / t) <= (-5d+85)) then
tmp = t_2
else if ((z / t) <= (-1d-41)) then
tmp = t_1
else if ((z / t) <= 1d-24) then
tmp = x
else if ((z / t) <= 1d+84) then
tmp = t_1
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 * (z / t);
double t_2 = z * (-x / t);
double tmp;
if ((z / t) <= -5e+85) {
tmp = t_2;
} else if ((z / t) <= -1e-41) {
tmp = t_1;
} else if ((z / t) <= 1e-24) {
tmp = x;
} else if ((z / t) <= 1e+84) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t): t_1 = y * (z / t) t_2 = z * (-x / t) tmp = 0 if (z / t) <= -5e+85: tmp = t_2 elif (z / t) <= -1e-41: tmp = t_1 elif (z / t) <= 1e-24: tmp = x elif (z / t) <= 1e+84: tmp = t_1 else: tmp = t_2 return tmp
function code(x, y, z, t) t_1 = Float64(y * Float64(z / t)) t_2 = Float64(z * Float64(Float64(-x) / t)) tmp = 0.0 if (Float64(z / t) <= -5e+85) tmp = t_2; elseif (Float64(z / t) <= -1e-41) tmp = t_1; elseif (Float64(z / t) <= 1e-24) tmp = x; elseif (Float64(z / t) <= 1e+84) tmp = t_1; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = y * (z / t); t_2 = z * (-x / t); tmp = 0.0; if ((z / t) <= -5e+85) tmp = t_2; elseif ((z / t) <= -1e-41) tmp = t_1; elseif ((z / t) <= 1e-24) tmp = x; elseif ((z / t) <= 1e+84) tmp = t_1; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(z * N[((-x) / t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(z / t), $MachinePrecision], -5e+85], t$95$2, If[LessEqual[N[(z / t), $MachinePrecision], -1e-41], t$95$1, If[LessEqual[N[(z / t), $MachinePrecision], 1e-24], x, If[LessEqual[N[(z / t), $MachinePrecision], 1e+84], t$95$1, t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \frac{z}{t}\\
t_2 := z \cdot \frac{-x}{t}\\
\mathbf{if}\;\frac{z}{t} \leq -5 \cdot 10^{+85}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;\frac{z}{t} \leq -1 \cdot 10^{-41}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\frac{z}{t} \leq 10^{-24}:\\
\;\;\;\;x\\
\mathbf{elif}\;\frac{z}{t} \leq 10^{+84}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if (/.f64 z t) < -5.0000000000000001e85 or 1.00000000000000006e84 < (/.f64 z t) Initial program 94.4%
Taylor expanded in z around inf 91.2%
Taylor expanded in y around 0 63.1%
neg-mul-163.1%
distribute-neg-frac63.1%
Simplified63.1%
if -5.0000000000000001e85 < (/.f64 z t) < -1.00000000000000001e-41 or 9.99999999999999924e-25 < (/.f64 z t) < 1.00000000000000006e84Initial program 99.6%
Taylor expanded in z around inf 77.0%
sub-div77.0%
associate-/r/91.0%
Applied egg-rr91.0%
Taylor expanded in y around inf 50.8%
associate-*r/61.4%
Simplified61.4%
if -1.00000000000000001e-41 < (/.f64 z t) < 9.99999999999999924e-25Initial program 99.9%
Taylor expanded in z around 0 79.8%
Final simplification69.9%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (/ (- z) t))))
(if (<= (/ z t) -50000000000000.0)
t_1
(if (<= (/ z t) 1e-24) x (if (<= (/ z t) 1e+84) (* y (/ z t)) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = x * (-z / t);
double tmp;
if ((z / t) <= -50000000000000.0) {
tmp = t_1;
} else if ((z / t) <= 1e-24) {
tmp = x;
} else if ((z / t) <= 1e+84) {
tmp = y * (z / t);
} 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 = x * (-z / t)
if ((z / t) <= (-50000000000000.0d0)) then
tmp = t_1
else if ((z / t) <= 1d-24) then
tmp = x
else if ((z / t) <= 1d+84) then
tmp = y * (z / t)
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 = x * (-z / t);
double tmp;
if ((z / t) <= -50000000000000.0) {
tmp = t_1;
} else if ((z / t) <= 1e-24) {
tmp = x;
} else if ((z / t) <= 1e+84) {
tmp = y * (z / t);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (-z / t) tmp = 0 if (z / t) <= -50000000000000.0: tmp = t_1 elif (z / t) <= 1e-24: tmp = x elif (z / t) <= 1e+84: tmp = y * (z / t) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(Float64(-z) / t)) tmp = 0.0 if (Float64(z / t) <= -50000000000000.0) tmp = t_1; elseif (Float64(z / t) <= 1e-24) tmp = x; elseif (Float64(z / t) <= 1e+84) tmp = Float64(y * Float64(z / t)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (-z / t); tmp = 0.0; if ((z / t) <= -50000000000000.0) tmp = t_1; elseif ((z / t) <= 1e-24) tmp = x; elseif ((z / t) <= 1e+84) tmp = y * (z / t); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[((-z) / t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(z / t), $MachinePrecision], -50000000000000.0], t$95$1, If[LessEqual[N[(z / t), $MachinePrecision], 1e-24], x, If[LessEqual[N[(z / t), $MachinePrecision], 1e+84], N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \frac{-z}{t}\\
\mathbf{if}\;\frac{z}{t} \leq -50000000000000:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\frac{z}{t} \leq 10^{-24}:\\
\;\;\;\;x\\
\mathbf{elif}\;\frac{z}{t} \leq 10^{+84}:\\
\;\;\;\;y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if (/.f64 z t) < -5e13 or 1.00000000000000006e84 < (/.f64 z t) Initial program 95.2%
Taylor expanded in x around inf 65.0%
*-commutative65.0%
mul-1-neg65.0%
unsub-neg65.0%
distribute-lft-out--65.0%
*-rgt-identity65.0%
Simplified65.0%
clear-num65.0%
div-inv63.5%
Applied egg-rr63.5%
Taylor expanded in t around 0 60.0%
mul-1-neg60.0%
associate-*l/64.9%
distribute-lft-neg-in64.9%
distribute-neg-frac64.9%
Simplified64.9%
if -5e13 < (/.f64 z t) < 9.99999999999999924e-25Initial program 99.9%
Taylor expanded in z around 0 76.6%
if 9.99999999999999924e-25 < (/.f64 z t) < 1.00000000000000006e84Initial program 99.5%
Taylor expanded in z around inf 81.2%
sub-div81.2%
associate-/r/97.1%
Applied egg-rr97.1%
Taylor expanded in y around inf 68.1%
associate-*r/73.3%
Simplified73.3%
Final simplification70.9%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ z t) -5e+85) (not (<= (/ z t) 1e+84))) (* x (/ (- z) t)) (+ x (* y (/ z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (((z / t) <= -5e+85) || !((z / t) <= 1e+84)) {
tmp = 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) <= (-5d+85)) .or. (.not. ((z / t) <= 1d+84))) then
tmp = 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) <= -5e+85) || !((z / t) <= 1e+84)) {
tmp = x * (-z / t);
} else {
tmp = x + (y * (z / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((z / t) <= -5e+85) or not ((z / t) <= 1e+84): tmp = x * (-z / t) else: tmp = x + (y * (z / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(z / t) <= -5e+85) || !(Float64(z / t) <= 1e+84)) tmp = Float64(x * Float64(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) <= -5e+85) || ~(((z / t) <= 1e+84))) tmp = 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], -5e+85], N[Not[LessEqual[N[(z / t), $MachinePrecision], 1e+84]], $MachinePrecision]], N[(x * 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 -5 \cdot 10^{+85} \lor \neg \left(\frac{z}{t} \leq 10^{+84}\right):\\
\;\;\;\;x \cdot \frac{-z}{t}\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\end{array}
\end{array}
if (/.f64 z t) < -5.0000000000000001e85 or 1.00000000000000006e84 < (/.f64 z t) Initial program 94.4%
Taylor expanded in x around inf 68.7%
*-commutative68.7%
mul-1-neg68.7%
unsub-neg68.7%
distribute-lft-out--68.7%
*-rgt-identity68.7%
Simplified68.7%
clear-num68.7%
div-inv66.8%
Applied egg-rr66.8%
Taylor expanded in t around 0 64.7%
mul-1-neg64.7%
associate-*l/68.7%
distribute-lft-neg-in68.7%
distribute-neg-frac68.7%
Simplified68.7%
if -5.0000000000000001e85 < (/.f64 z t) < 1.00000000000000006e84Initial program 99.8%
Taylor expanded in y around inf 85.0%
associate-*r/91.2%
Simplified91.2%
Final simplification82.2%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ z t) -5e-25) (not (<= (/ z t) 200000.0))) (/ (* (- y x) z) t) (+ x (* y (/ z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (((z / t) <= -5e-25) || !((z / t) <= 200000.0)) {
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) <= (-5d-25)) .or. (.not. ((z / t) <= 200000.0d0))) 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) <= -5e-25) || !((z / t) <= 200000.0)) {
tmp = ((y - x) * z) / t;
} else {
tmp = x + (y * (z / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((z / t) <= -5e-25) or not ((z / t) <= 200000.0): 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) <= -5e-25) || !(Float64(z / t) <= 200000.0)) tmp = Float64(Float64(Float64(y - x) * 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) <= -5e-25) || ~(((z / t) <= 200000.0))) 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], -5e-25], N[Not[LessEqual[N[(z / t), $MachinePrecision], 200000.0]], $MachinePrecision]], N[(N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision] / t), $MachinePrecision], N[(x + N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{z}{t} \leq -5 \cdot 10^{-25} \lor \neg \left(\frac{z}{t} \leq 200000\right):\\
\;\;\;\;\frac{\left(y - x\right) \cdot z}{t}\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\end{array}
\end{array}
if (/.f64 z t) < -4.99999999999999962e-25 or 2e5 < (/.f64 z t) Initial program 95.7%
Taylor expanded in z around inf 88.6%
Taylor expanded in t around inf 92.6%
if -4.99999999999999962e-25 < (/.f64 z t) < 2e5Initial program 99.9%
Taylor expanded in y around inf 93.6%
associate-*r/99.9%
Simplified99.9%
Final simplification96.0%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ z t) -5e-25) (not (<= (/ z t) 1e-24))) (/ (- y x) (/ t z)) (+ x (* y (/ z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (((z / t) <= -5e-25) || !((z / t) <= 1e-24)) {
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) <= (-5d-25)) .or. (.not. ((z / t) <= 1d-24))) 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) <= -5e-25) || !((z / t) <= 1e-24)) {
tmp = (y - x) / (t / z);
} else {
tmp = x + (y * (z / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((z / t) <= -5e-25) or not ((z / t) <= 1e-24): 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) <= -5e-25) || !(Float64(z / t) <= 1e-24)) 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) <= -5e-25) || ~(((z / t) <= 1e-24))) 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], -5e-25], N[Not[LessEqual[N[(z / t), $MachinePrecision], 1e-24]], $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 -5 \cdot 10^{-25} \lor \neg \left(\frac{z}{t} \leq 10^{-24}\right):\\
\;\;\;\;\frac{y - x}{\frac{t}{z}}\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\end{array}
\end{array}
if (/.f64 z t) < -4.99999999999999962e-25 or 9.99999999999999924e-25 < (/.f64 z t) Initial program 95.8%
Taylor expanded in z around inf 88.9%
sub-div93.2%
associate-/r/95.9%
Applied egg-rr95.9%
if -4.99999999999999962e-25 < (/.f64 z t) < 9.99999999999999924e-25Initial program 99.9%
Taylor expanded in y around inf 94.2%
associate-*r/99.9%
Simplified99.9%
Final simplification97.7%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ z t) -1e-41) (not (<= (/ z t) 1e-24))) (* y (/ z t)) x))
double code(double x, double y, double z, double t) {
double tmp;
if (((z / t) <= -1e-41) || !((z / t) <= 1e-24)) {
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) <= (-1d-41)) .or. (.not. ((z / t) <= 1d-24))) 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) <= -1e-41) || !((z / t) <= 1e-24)) {
tmp = y * (z / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((z / t) <= -1e-41) or not ((z / t) <= 1e-24): tmp = y * (z / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(z / t) <= -1e-41) || !(Float64(z / t) <= 1e-24)) 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) <= -1e-41) || ~(((z / t) <= 1e-24))) tmp = y * (z / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(z / t), $MachinePrecision], -1e-41], N[Not[LessEqual[N[(z / t), $MachinePrecision], 1e-24]], $MachinePrecision]], N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{z}{t} \leq -1 \cdot 10^{-41} \lor \neg \left(\frac{z}{t} \leq 10^{-24}\right):\\
\;\;\;\;y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if (/.f64 z t) < -1.00000000000000001e-41 or 9.99999999999999924e-25 < (/.f64 z t) Initial program 96.0%
Taylor expanded in z around inf 86.8%
sub-div90.9%
associate-/r/93.8%
Applied egg-rr93.8%
Taylor expanded in y around inf 46.4%
associate-*r/50.4%
Simplified50.4%
if -1.00000000000000001e-41 < (/.f64 z t) < 9.99999999999999924e-25Initial program 99.9%
Taylor expanded in z around 0 79.8%
Final simplification62.9%
(FPCore (x y z t) :precision binary64 (if (or (<= x -6.5e-26) (not (<= x 2.3e+61))) (- x (* x (/ z t))) (+ x (* y (/ z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -6.5e-26) || !(x <= 2.3e+61)) {
tmp = x - (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 ((x <= (-6.5d-26)) .or. (.not. (x <= 2.3d+61))) then
tmp = x - (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 ((x <= -6.5e-26) || !(x <= 2.3e+61)) {
tmp = x - (x * (z / t));
} else {
tmp = x + (y * (z / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -6.5e-26) or not (x <= 2.3e+61): tmp = x - (x * (z / t)) else: tmp = x + (y * (z / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -6.5e-26) || !(x <= 2.3e+61)) tmp = Float64(x - Float64(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 ((x <= -6.5e-26) || ~((x <= 2.3e+61))) tmp = x - (x * (z / t)); else tmp = x + (y * (z / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -6.5e-26], N[Not[LessEqual[x, 2.3e+61]], $MachinePrecision]], N[(x - N[(x * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6.5 \cdot 10^{-26} \lor \neg \left(x \leq 2.3 \cdot 10^{+61}\right):\\
\;\;\;\;x - x \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\end{array}
\end{array}
if x < -6.5e-26 or 2.3e61 < x Initial program 99.9%
Taylor expanded in x around inf 91.7%
*-commutative91.7%
mul-1-neg91.7%
unsub-neg91.7%
distribute-lft-out--91.6%
*-rgt-identity91.6%
Simplified91.6%
if -6.5e-26 < x < 2.3e61Initial program 95.4%
Taylor expanded in y around inf 79.2%
associate-*r/83.6%
Simplified83.6%
Final simplification87.6%
(FPCore (x y z t) :precision binary64 (if (or (<= x -4.8e-26) (not (<= x 1.15e+63))) (- x (/ x (/ t z))) (+ x (* y (/ z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -4.8e-26) || !(x <= 1.15e+63)) {
tmp = x - (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 ((x <= (-4.8d-26)) .or. (.not. (x <= 1.15d+63))) then
tmp = x - (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 ((x <= -4.8e-26) || !(x <= 1.15e+63)) {
tmp = x - (x / (t / z));
} else {
tmp = x + (y * (z / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -4.8e-26) or not (x <= 1.15e+63): tmp = x - (x / (t / z)) else: tmp = x + (y * (z / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -4.8e-26) || !(x <= 1.15e+63)) tmp = Float64(x - Float64(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 ((x <= -4.8e-26) || ~((x <= 1.15e+63))) tmp = x - (x / (t / z)); else tmp = x + (y * (z / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -4.8e-26], N[Not[LessEqual[x, 1.15e+63]], $MachinePrecision]], N[(x - N[(x / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.8 \cdot 10^{-26} \lor \neg \left(x \leq 1.15 \cdot 10^{+63}\right):\\
\;\;\;\;x - \frac{x}{\frac{t}{z}}\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\end{array}
\end{array}
if x < -4.8000000000000002e-26 or 1.14999999999999997e63 < x Initial program 99.9%
Taylor expanded in x around inf 91.7%
*-commutative91.7%
mul-1-neg91.7%
unsub-neg91.7%
distribute-lft-out--91.6%
*-rgt-identity91.6%
Simplified91.6%
clear-num91.6%
div-inv91.7%
Applied egg-rr91.7%
if -4.8000000000000002e-26 < x < 1.14999999999999997e63Initial program 95.4%
Taylor expanded in y around inf 79.2%
associate-*r/83.6%
Simplified83.6%
Final simplification87.6%
(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}
Initial program 97.7%
Final simplification97.7%
(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.7%
Taylor expanded in z around 0 36.6%
Final simplification36.6%
(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 2023196
(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))))