
(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 12 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 (- INFINITY)) (* z (/ (- y x) t)) t_1)))
double code(double x, double y, double z, double t) {
double t_1 = x + ((y - x) * (z / t));
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = z * ((y - x) / t);
} else {
tmp = t_1;
}
return tmp;
}
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 <= -Double.POSITIVE_INFINITY) {
tmp = z * ((y - x) / t);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x + ((y - x) * (z / t)) tmp = 0 if t_1 <= -math.inf: tmp = z * ((y - x) / t) else: tmp = t_1 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 <= Float64(-Inf)) tmp = Float64(z * Float64(Float64(y - x) / t)); else tmp = t_1; 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 <= -Inf) tmp = z * ((y - x) / t); else tmp = t_1; 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, (-Infinity)], N[(z * N[(N[(y - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], t$95$1]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \left(y - x\right) \cdot \frac{z}{t}\\
\mathbf{if}\;t_1 \leq -\infty:\\
\;\;\;\;z \cdot \frac{y - x}{t}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if (+.f64 x (*.f64 (-.f64 y x) (/.f64 z t))) < -inf.0Initial program 89.2%
Taylor expanded in z around inf 97.6%
Taylor expanded in y around 0 97.6%
mul-1-neg97.6%
distribute-frac-neg97.6%
+-commutative97.6%
distribute-frac-neg97.6%
sub-neg97.6%
div-sub100.0%
Simplified100.0%
if -inf.0 < (+.f64 x (*.f64 (-.f64 y x) (/.f64 z t))) Initial program 98.4%
Final simplification98.7%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* y (/ z t))))
(if (<= (/ z t) -5e-29)
t_1
(if (<= (/ z t) 5e-5) x (if (<= (/ z t) 1e+216) (* z (/ (- x) t)) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = y * (z / t);
double tmp;
if ((z / t) <= -5e-29) {
tmp = t_1;
} else if ((z / t) <= 5e-5) {
tmp = x;
} else if ((z / t) <= 1e+216) {
tmp = z * (-x / 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 = y * (z / t)
if ((z / t) <= (-5d-29)) then
tmp = t_1
else if ((z / t) <= 5d-5) then
tmp = x
else if ((z / t) <= 1d+216) then
tmp = z * (-x / 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 = y * (z / t);
double tmp;
if ((z / t) <= -5e-29) {
tmp = t_1;
} else if ((z / t) <= 5e-5) {
tmp = x;
} else if ((z / t) <= 1e+216) {
tmp = z * (-x / t);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = y * (z / t) tmp = 0 if (z / t) <= -5e-29: tmp = t_1 elif (z / t) <= 5e-5: tmp = x elif (z / t) <= 1e+216: tmp = z * (-x / t) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(y * Float64(z / t)) tmp = 0.0 if (Float64(z / t) <= -5e-29) tmp = t_1; elseif (Float64(z / t) <= 5e-5) tmp = x; elseif (Float64(z / t) <= 1e+216) tmp = Float64(z * Float64(Float64(-x) / t)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = y * (z / t); tmp = 0.0; if ((z / t) <= -5e-29) tmp = t_1; elseif ((z / t) <= 5e-5) tmp = x; elseif ((z / t) <= 1e+216) tmp = z * (-x / t); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(z / t), $MachinePrecision], -5e-29], t$95$1, If[LessEqual[N[(z / t), $MachinePrecision], 5e-5], x, If[LessEqual[N[(z / t), $MachinePrecision], 1e+216], N[(z * N[((-x) / t), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \frac{z}{t}\\
\mathbf{if}\;\frac{z}{t} \leq -5 \cdot 10^{-29}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\frac{z}{t} \leq 5 \cdot 10^{-5}:\\
\;\;\;\;x\\
\mathbf{elif}\;\frac{z}{t} \leq 10^{+216}:\\
\;\;\;\;z \cdot \frac{-x}{t}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if (/.f64 z t) < -4.99999999999999986e-29 or 1e216 < (/.f64 z t) Initial program 94.0%
Taylor expanded in z around inf 89.4%
Taylor expanded in y around inf 56.1%
associate-*l/54.6%
associate-/l*62.6%
Applied egg-rr62.6%
clear-num62.5%
associate-/r/62.6%
clear-num62.7%
Applied egg-rr62.7%
if -4.99999999999999986e-29 < (/.f64 z t) < 5.00000000000000024e-5Initial program 98.3%
Taylor expanded in z around 0 76.6%
if 5.00000000000000024e-5 < (/.f64 z t) < 1e216Initial program 99.6%
Taylor expanded in z around inf 84.9%
Taylor expanded in y around 0 63.1%
mul-1-neg63.1%
distribute-frac-neg63.1%
Simplified63.1%
Final simplification69.2%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ z t) -4e+15) (not (<= (/ z t) 5e+19))) (* z (/ (- y x) t)) (* x (- 1.0 (/ z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (((z / t) <= -4e+15) || !((z / t) <= 5e+19)) {
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) <= (-4d+15)) .or. (.not. ((z / t) <= 5d+19))) 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) <= -4e+15) || !((z / t) <= 5e+19)) {
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) <= -4e+15) or not ((z / t) <= 5e+19): 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) <= -4e+15) || !(Float64(z / t) <= 5e+19)) 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) <= -4e+15) || ~(((z / t) <= 5e+19))) 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], -4e+15], N[Not[LessEqual[N[(z / t), $MachinePrecision], 5e+19]], $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 -4 \cdot 10^{+15} \lor \neg \left(\frac{z}{t} \leq 5 \cdot 10^{+19}\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) < -4e15 or 5e19 < (/.f64 z t) Initial program 95.4%
Taylor expanded in z around inf 92.9%
Taylor expanded in y around 0 92.9%
mul-1-neg92.9%
distribute-frac-neg92.9%
+-commutative92.9%
distribute-frac-neg92.9%
sub-neg92.9%
div-sub93.8%
Simplified93.8%
if -4e15 < (/.f64 z t) < 5e19Initial program 98.4%
Taylor expanded in z around -inf 94.2%
Taylor expanded in x around inf 76.3%
*-commutative76.3%
mul-1-neg76.3%
unsub-neg76.3%
Simplified76.3%
Final simplification84.9%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ z t) -1e+40) (not (<= (/ z t) 5e-5))) (* z (/ (- y x) t)) (+ x (* y (/ z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (((z / t) <= -1e+40) || !((z / t) <= 5e-5)) {
tmp = z * ((y - x) / 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) <= (-1d+40)) .or. (.not. ((z / t) <= 5d-5))) then
tmp = z * ((y - x) / 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) <= -1e+40) || !((z / t) <= 5e-5)) {
tmp = z * ((y - x) / t);
} else {
tmp = x + (y * (z / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((z / t) <= -1e+40) or not ((z / t) <= 5e-5): tmp = z * ((y - x) / t) else: tmp = x + (y * (z / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(z / t) <= -1e+40) || !(Float64(z / t) <= 5e-5)) tmp = Float64(z * Float64(Float64(y - x) / 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) <= -1e+40) || ~(((z / t) <= 5e-5))) tmp = z * ((y - x) / t); else tmp = x + (y * (z / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(z / t), $MachinePrecision], -1e+40], N[Not[LessEqual[N[(z / t), $MachinePrecision], 5e-5]], $MachinePrecision]], N[(z * N[(N[(y - x), $MachinePrecision] / 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 -1 \cdot 10^{+40} \lor \neg \left(\frac{z}{t} \leq 5 \cdot 10^{-5}\right):\\
\;\;\;\;z \cdot \frac{y - x}{t}\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\end{array}
\end{array}
if (/.f64 z t) < -1.00000000000000003e40 or 5.00000000000000024e-5 < (/.f64 z t) Initial program 95.3%
Taylor expanded in z around inf 92.5%
Taylor expanded in y around 0 92.5%
mul-1-neg92.5%
distribute-frac-neg92.5%
+-commutative92.5%
distribute-frac-neg92.5%
sub-neg92.5%
div-sub93.3%
Simplified93.3%
if -1.00000000000000003e40 < (/.f64 z t) < 5.00000000000000024e-5Initial program 98.4%
Taylor expanded in y around inf 91.7%
associate-*r/93.9%
Simplified93.9%
Final simplification93.6%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ z t) -10.0) (not (<= (/ z t) 5e-5))) (/ (* (- y x) z) t) (+ x (* y (/ z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (((z / t) <= -10.0) || !((z / t) <= 5e-5)) {
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) <= (-10.0d0)) .or. (.not. ((z / t) <= 5d-5))) 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) <= -10.0) || !((z / t) <= 5e-5)) {
tmp = ((y - x) * z) / t;
} else {
tmp = x + (y * (z / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((z / t) <= -10.0) or not ((z / t) <= 5e-5): 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) <= -10.0) || !(Float64(z / t) <= 5e-5)) 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) <= -10.0) || ~(((z / t) <= 5e-5))) 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], -10.0], N[Not[LessEqual[N[(z / t), $MachinePrecision], 5e-5]], $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 -10 \lor \neg \left(\frac{z}{t} \leq 5 \cdot 10^{-5}\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) < -10 or 5.00000000000000024e-5 < (/.f64 z t) Initial program 95.6%
Taylor expanded in z around inf 88.5%
Taylor expanded in t around inf 91.7%
if -10 < (/.f64 z t) < 5.00000000000000024e-5Initial program 98.3%
Taylor expanded in y around inf 95.1%
associate-*r/97.4%
Simplified97.4%
Final simplification94.4%
(FPCore (x y z t) :precision binary64 (if (<= (/ z t) -10.0) (/ (* (- y x) z) t) (if (<= (/ z t) 5e-5) (+ x (* y (/ z t))) (/ (- y x) (/ t z)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z / t) <= -10.0) {
tmp = ((y - x) * z) / t;
} else if ((z / t) <= 5e-5) {
tmp = x + (y * (z / t));
} else {
tmp = (y - x) / (t / z);
}
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) <= (-10.0d0)) then
tmp = ((y - x) * z) / t
else if ((z / t) <= 5d-5) then
tmp = x + (y * (z / t))
else
tmp = (y - x) / (t / z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z / t) <= -10.0) {
tmp = ((y - x) * z) / t;
} else if ((z / t) <= 5e-5) {
tmp = x + (y * (z / t));
} else {
tmp = (y - x) / (t / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z / t) <= -10.0: tmp = ((y - x) * z) / t elif (z / t) <= 5e-5: tmp = x + (y * (z / t)) else: tmp = (y - x) / (t / z) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(z / t) <= -10.0) tmp = Float64(Float64(Float64(y - x) * z) / t); elseif (Float64(z / t) <= 5e-5) tmp = Float64(x + Float64(y * Float64(z / t))); else tmp = Float64(Float64(y - x) / Float64(t / z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z / t) <= -10.0) tmp = ((y - x) * z) / t; elseif ((z / t) <= 5e-5) tmp = x + (y * (z / t)); else tmp = (y - x) / (t / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(z / t), $MachinePrecision], -10.0], N[(N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[N[(z / t), $MachinePrecision], 5e-5], N[(x + N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y - x), $MachinePrecision] / N[(t / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{z}{t} \leq -10:\\
\;\;\;\;\frac{\left(y - x\right) \cdot z}{t}\\
\mathbf{elif}\;\frac{z}{t} \leq 5 \cdot 10^{-5}:\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{y - x}{\frac{t}{z}}\\
\end{array}
\end{array}
if (/.f64 z t) < -10Initial program 93.7%
Taylor expanded in z around inf 86.5%
Taylor expanded in t around inf 91.3%
if -10 < (/.f64 z t) < 5.00000000000000024e-5Initial program 98.3%
Taylor expanded in y around inf 95.1%
associate-*r/97.4%
Simplified97.4%
if 5.00000000000000024e-5 < (/.f64 z t) Initial program 97.2%
Taylor expanded in z around inf 90.1%
sub-div91.6%
associate-/r/96.2%
Applied egg-rr96.2%
Final simplification95.6%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ z t) -5e-29) (not (<= (/ z t) 4e-23))) (* y (/ z t)) x))
double code(double x, double y, double z, double t) {
double tmp;
if (((z / t) <= -5e-29) || !((z / t) <= 4e-23)) {
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) <= (-5d-29)) .or. (.not. ((z / t) <= 4d-23))) 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) <= -5e-29) || !((z / t) <= 4e-23)) {
tmp = y * (z / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((z / t) <= -5e-29) or not ((z / t) <= 4e-23): tmp = y * (z / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(z / t) <= -5e-29) || !(Float64(z / t) <= 4e-23)) 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) <= -5e-29) || ~(((z / t) <= 4e-23))) tmp = y * (z / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(z / t), $MachinePrecision], -5e-29], N[Not[LessEqual[N[(z / t), $MachinePrecision], 4e-23]], $MachinePrecision]], N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{z}{t} \leq -5 \cdot 10^{-29} \lor \neg \left(\frac{z}{t} \leq 4 \cdot 10^{-23}\right):\\
\;\;\;\;y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if (/.f64 z t) < -4.99999999999999986e-29 or 3.99999999999999984e-23 < (/.f64 z t) Initial program 95.8%
Taylor expanded in z around inf 85.7%
Taylor expanded in y around inf 46.3%
associate-*l/47.3%
associate-/l*53.4%
Applied egg-rr53.4%
clear-num53.3%
associate-/r/53.3%
clear-num53.4%
Applied egg-rr53.4%
if -4.99999999999999986e-29 < (/.f64 z t) < 3.99999999999999984e-23Initial program 98.2%
Taylor expanded in z around 0 78.5%
Final simplification64.7%
(FPCore (x y z t) :precision binary64 (if (<= (/ z t) -5e-29) (* y (/ z t)) (if (<= (/ z t) 4e-23) x (/ y (/ t z)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z / t) <= -5e-29) {
tmp = y * (z / t);
} else if ((z / t) <= 4e-23) {
tmp = x;
} else {
tmp = y / (t / z);
}
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-29)) then
tmp = y * (z / t)
else if ((z / t) <= 4d-23) then
tmp = x
else
tmp = y / (t / z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z / t) <= -5e-29) {
tmp = y * (z / t);
} else if ((z / t) <= 4e-23) {
tmp = x;
} else {
tmp = y / (t / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z / t) <= -5e-29: tmp = y * (z / t) elif (z / t) <= 4e-23: tmp = x else: tmp = y / (t / z) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(z / t) <= -5e-29) tmp = Float64(y * Float64(z / t)); elseif (Float64(z / t) <= 4e-23) tmp = x; else tmp = Float64(y / Float64(t / z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z / t) <= -5e-29) tmp = y * (z / t); elseif ((z / t) <= 4e-23) tmp = x; else tmp = y / (t / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(z / t), $MachinePrecision], -5e-29], N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z / t), $MachinePrecision], 4e-23], x, N[(y / N[(t / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{z}{t} \leq -5 \cdot 10^{-29}:\\
\;\;\;\;y \cdot \frac{z}{t}\\
\mathbf{elif}\;\frac{z}{t} \leq 4 \cdot 10^{-23}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{\frac{t}{z}}\\
\end{array}
\end{array}
if (/.f64 z t) < -4.99999999999999986e-29Initial program 94.0%
Taylor expanded in z around inf 85.7%
Taylor expanded in y around inf 53.7%
associate-*l/51.4%
associate-/l*59.0%
Applied egg-rr59.0%
clear-num58.9%
associate-/r/59.0%
clear-num59.1%
Applied egg-rr59.1%
if -4.99999999999999986e-29 < (/.f64 z t) < 3.99999999999999984e-23Initial program 98.2%
Taylor expanded in z around 0 78.5%
if 3.99999999999999984e-23 < (/.f64 z t) Initial program 97.3%
Taylor expanded in z around inf 85.7%
Taylor expanded in y around inf 40.4%
associate-*l/43.9%
associate-/l*48.8%
Applied egg-rr48.8%
Final simplification64.7%
(FPCore (x y z t) :precision binary64 (if (or (<= y -5.2e+74) (not (<= y 1.44e+85))) (/ y (/ t z)) (* x (- 1.0 (/ z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -5.2e+74) || !(y <= 1.44e+85)) {
tmp = y / (t / z);
} 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 <= (-5.2d+74)) .or. (.not. (y <= 1.44d+85))) then
tmp = y / (t / z)
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 <= -5.2e+74) || !(y <= 1.44e+85)) {
tmp = y / (t / z);
} else {
tmp = x * (1.0 - (z / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -5.2e+74) or not (y <= 1.44e+85): tmp = y / (t / z) else: tmp = x * (1.0 - (z / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -5.2e+74) || !(y <= 1.44e+85)) tmp = Float64(y / Float64(t / z)); 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 <= -5.2e+74) || ~((y <= 1.44e+85))) tmp = y / (t / z); else tmp = x * (1.0 - (z / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -5.2e+74], N[Not[LessEqual[y, 1.44e+85]], $MachinePrecision]], N[(y / N[(t / z), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 - N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.2 \cdot 10^{+74} \lor \neg \left(y \leq 1.44 \cdot 10^{+85}\right):\\
\;\;\;\;\frac{y}{\frac{t}{z}}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - \frac{z}{t}\right)\\
\end{array}
\end{array}
if y < -5.2000000000000001e74 or 1.44e85 < y Initial program 97.6%
Taylor expanded in z around inf 70.9%
Taylor expanded in y around inf 67.5%
associate-*l/67.8%
associate-/l*73.0%
Applied egg-rr73.0%
if -5.2000000000000001e74 < y < 1.44e85Initial program 96.5%
Taylor expanded in z around -inf 95.3%
Taylor expanded in x around inf 78.8%
*-commutative78.8%
mul-1-neg78.8%
unsub-neg78.8%
Simplified78.8%
Final simplification76.7%
(FPCore (x y z t) :precision binary64 (if (or (<= y -2.3e+65) (not (<= y 3.3e-27))) (* z (/ y t)) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -2.3e+65) || !(y <= 3.3e-27)) {
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 ((y <= (-2.3d+65)) .or. (.not. (y <= 3.3d-27))) 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 ((y <= -2.3e+65) || !(y <= 3.3e-27)) {
tmp = z * (y / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -2.3e+65) or not (y <= 3.3e-27): tmp = z * (y / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -2.3e+65) || !(y <= 3.3e-27)) 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 ((y <= -2.3e+65) || ~((y <= 3.3e-27))) tmp = z * (y / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -2.3e+65], N[Not[LessEqual[y, 3.3e-27]], $MachinePrecision]], N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.3 \cdot 10^{+65} \lor \neg \left(y \leq 3.3 \cdot 10^{-27}\right):\\
\;\;\;\;z \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -2.3e65 or 3.29999999999999998e-27 < y Initial program 98.0%
Taylor expanded in z around inf 69.5%
Taylor expanded in y around inf 62.7%
if -2.3e65 < y < 3.29999999999999998e-27Initial program 96.1%
Taylor expanded in z around 0 48.5%
Final simplification54.6%
(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 96.9%
clear-num96.9%
un-div-inv97.2%
Applied egg-rr97.2%
Final simplification97.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 96.9%
Taylor expanded in z around 0 37.4%
Final simplification37.4%
(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 2023176
(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))))