
(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 10 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) (/ 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.6%
Final simplification97.6%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (/ (- z) t))) (t_2 (* y (/ z t))))
(if (<= (/ z t) -5e+153)
(/ (* y z) t)
(if (<= (/ z t) -5e+80)
t_1
(if (<= (/ z t) -1000000000.0)
t_2
(if (<= (/ z t) 5e-26) x (if (<= (/ z t) 5e+159) t_2 t_1)))))))
double code(double x, double y, double z, double t) {
double t_1 = x * (-z / t);
double t_2 = y * (z / t);
double tmp;
if ((z / t) <= -5e+153) {
tmp = (y * z) / t;
} else if ((z / t) <= -5e+80) {
tmp = t_1;
} else if ((z / t) <= -1000000000.0) {
tmp = t_2;
} else if ((z / t) <= 5e-26) {
tmp = x;
} else if ((z / t) <= 5e+159) {
tmp = t_2;
} 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) :: t_2
real(8) :: tmp
t_1 = x * (-z / t)
t_2 = y * (z / t)
if ((z / t) <= (-5d+153)) then
tmp = (y * z) / t
else if ((z / t) <= (-5d+80)) then
tmp = t_1
else if ((z / t) <= (-1000000000.0d0)) then
tmp = t_2
else if ((z / t) <= 5d-26) then
tmp = x
else if ((z / t) <= 5d+159) then
tmp = t_2
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 t_2 = y * (z / t);
double tmp;
if ((z / t) <= -5e+153) {
tmp = (y * z) / t;
} else if ((z / t) <= -5e+80) {
tmp = t_1;
} else if ((z / t) <= -1000000000.0) {
tmp = t_2;
} else if ((z / t) <= 5e-26) {
tmp = x;
} else if ((z / t) <= 5e+159) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (-z / t) t_2 = y * (z / t) tmp = 0 if (z / t) <= -5e+153: tmp = (y * z) / t elif (z / t) <= -5e+80: tmp = t_1 elif (z / t) <= -1000000000.0: tmp = t_2 elif (z / t) <= 5e-26: tmp = x elif (z / t) <= 5e+159: tmp = t_2 else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(Float64(-z) / t)) t_2 = Float64(y * Float64(z / t)) tmp = 0.0 if (Float64(z / t) <= -5e+153) tmp = Float64(Float64(y * z) / t); elseif (Float64(z / t) <= -5e+80) tmp = t_1; elseif (Float64(z / t) <= -1000000000.0) tmp = t_2; elseif (Float64(z / t) <= 5e-26) tmp = x; elseif (Float64(z / t) <= 5e+159) tmp = t_2; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (-z / t); t_2 = y * (z / t); tmp = 0.0; if ((z / t) <= -5e+153) tmp = (y * z) / t; elseif ((z / t) <= -5e+80) tmp = t_1; elseif ((z / t) <= -1000000000.0) tmp = t_2; elseif ((z / t) <= 5e-26) tmp = x; elseif ((z / t) <= 5e+159) tmp = t_2; 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]}, Block[{t$95$2 = N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(z / t), $MachinePrecision], -5e+153], N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[N[(z / t), $MachinePrecision], -5e+80], t$95$1, If[LessEqual[N[(z / t), $MachinePrecision], -1000000000.0], t$95$2, If[LessEqual[N[(z / t), $MachinePrecision], 5e-26], x, If[LessEqual[N[(z / t), $MachinePrecision], 5e+159], t$95$2, t$95$1]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \frac{-z}{t}\\
t_2 := y \cdot \frac{z}{t}\\
\mathbf{if}\;\frac{z}{t} \leq -5 \cdot 10^{+153}:\\
\;\;\;\;\frac{y \cdot z}{t}\\
\mathbf{elif}\;\frac{z}{t} \leq -5 \cdot 10^{+80}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\frac{z}{t} \leq -1000000000:\\
\;\;\;\;t_2\\
\mathbf{elif}\;\frac{z}{t} \leq 5 \cdot 10^{-26}:\\
\;\;\;\;x\\
\mathbf{elif}\;\frac{z}{t} \leq 5 \cdot 10^{+159}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if (/.f64 z t) < -5.00000000000000018e153Initial program 95.5%
Taylor expanded in z around inf 93.1%
sub-div95.5%
associate-/r/95.5%
Applied egg-rr95.5%
Taylor expanded in y around inf 76.6%
if -5.00000000000000018e153 < (/.f64 z t) < -4.99999999999999961e80 or 5.00000000000000003e159 < (/.f64 z t) Initial program 93.5%
Taylor expanded in z around inf 93.2%
sub-div93.2%
associate-/r/93.5%
Applied egg-rr93.5%
Taylor expanded in y around 0 71.7%
mul-1-neg71.7%
*-commutative71.7%
associate-*r/76.8%
distribute-rgt-neg-in76.8%
distribute-neg-frac76.8%
Simplified76.8%
if -4.99999999999999961e80 < (/.f64 z t) < -1e9 or 5.00000000000000019e-26 < (/.f64 z t) < 5.00000000000000003e159Initial program 99.7%
Taylor expanded in z around inf 78.4%
sub-div80.8%
associate-/r/90.9%
Applied egg-rr90.9%
Taylor expanded in y around inf 46.7%
/-rgt-identity46.7%
associate-/l/46.7%
*-commutative46.7%
times-frac62.3%
/-rgt-identity62.3%
Simplified62.3%
if -1e9 < (/.f64 z t) < 5.00000000000000019e-26Initial program 98.8%
Taylor expanded in z around 0 79.4%
Final simplification75.3%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* y (/ z t))))
(if (<= (/ z t) -5e+153)
(/ (* y z) t)
(if (<= (/ z t) -1e+84)
(/ (* x z) (- t))
(if (<= (/ z t) -1000000000.0)
t_1
(if (<= (/ z t) 5e-26)
x
(if (<= (/ z t) 5e+159) t_1 (* x (/ (- z) t)))))))))
double code(double x, double y, double z, double t) {
double t_1 = y * (z / t);
double tmp;
if ((z / t) <= -5e+153) {
tmp = (y * z) / t;
} else if ((z / t) <= -1e+84) {
tmp = (x * z) / -t;
} else if ((z / t) <= -1000000000.0) {
tmp = t_1;
} else if ((z / t) <= 5e-26) {
tmp = x;
} else if ((z / t) <= 5e+159) {
tmp = t_1;
} else {
tmp = 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 = y * (z / t)
if ((z / t) <= (-5d+153)) then
tmp = (y * z) / t
else if ((z / t) <= (-1d+84)) then
tmp = (x * z) / -t
else if ((z / t) <= (-1000000000.0d0)) then
tmp = t_1
else if ((z / t) <= 5d-26) then
tmp = x
else if ((z / t) <= 5d+159) then
tmp = t_1
else
tmp = x * (-z / t)
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+153) {
tmp = (y * z) / t;
} else if ((z / t) <= -1e+84) {
tmp = (x * z) / -t;
} else if ((z / t) <= -1000000000.0) {
tmp = t_1;
} else if ((z / t) <= 5e-26) {
tmp = x;
} else if ((z / t) <= 5e+159) {
tmp = t_1;
} else {
tmp = x * (-z / t);
}
return tmp;
}
def code(x, y, z, t): t_1 = y * (z / t) tmp = 0 if (z / t) <= -5e+153: tmp = (y * z) / t elif (z / t) <= -1e+84: tmp = (x * z) / -t elif (z / t) <= -1000000000.0: tmp = t_1 elif (z / t) <= 5e-26: tmp = x elif (z / t) <= 5e+159: tmp = t_1 else: tmp = x * (-z / t) return tmp
function code(x, y, z, t) t_1 = Float64(y * Float64(z / t)) tmp = 0.0 if (Float64(z / t) <= -5e+153) tmp = Float64(Float64(y * z) / t); elseif (Float64(z / t) <= -1e+84) tmp = Float64(Float64(x * z) / Float64(-t)); elseif (Float64(z / t) <= -1000000000.0) tmp = t_1; elseif (Float64(z / t) <= 5e-26) tmp = x; elseif (Float64(z / t) <= 5e+159) tmp = t_1; else tmp = Float64(x * Float64(Float64(-z) / t)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = y * (z / t); tmp = 0.0; if ((z / t) <= -5e+153) tmp = (y * z) / t; elseif ((z / t) <= -1e+84) tmp = (x * z) / -t; elseif ((z / t) <= -1000000000.0) tmp = t_1; elseif ((z / t) <= 5e-26) tmp = x; elseif ((z / t) <= 5e+159) tmp = t_1; else tmp = x * (-z / t); 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+153], N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[N[(z / t), $MachinePrecision], -1e+84], N[(N[(x * z), $MachinePrecision] / (-t)), $MachinePrecision], If[LessEqual[N[(z / t), $MachinePrecision], -1000000000.0], t$95$1, If[LessEqual[N[(z / t), $MachinePrecision], 5e-26], x, If[LessEqual[N[(z / t), $MachinePrecision], 5e+159], t$95$1, N[(x * N[((-z) / t), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \frac{z}{t}\\
\mathbf{if}\;\frac{z}{t} \leq -5 \cdot 10^{+153}:\\
\;\;\;\;\frac{y \cdot z}{t}\\
\mathbf{elif}\;\frac{z}{t} \leq -1 \cdot 10^{+84}:\\
\;\;\;\;\frac{x \cdot z}{-t}\\
\mathbf{elif}\;\frac{z}{t} \leq -1000000000:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\frac{z}{t} \leq 5 \cdot 10^{-26}:\\
\;\;\;\;x\\
\mathbf{elif}\;\frac{z}{t} \leq 5 \cdot 10^{+159}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{-z}{t}\\
\end{array}
\end{array}
if (/.f64 z t) < -5.00000000000000018e153Initial program 95.5%
Taylor expanded in z around inf 93.1%
sub-div95.5%
associate-/r/95.5%
Applied egg-rr95.5%
Taylor expanded in y around inf 76.6%
if -5.00000000000000018e153 < (/.f64 z t) < -1.00000000000000006e84Initial program 99.7%
Taylor expanded in z around inf 80.8%
Taylor expanded in y around 0 80.8%
mul-1-neg80.8%
distribute-frac-neg80.8%
Simplified80.8%
*-commutative80.8%
frac-2neg80.8%
remove-double-neg80.8%
associate-*r/100.0%
Applied egg-rr100.0%
if -1.00000000000000006e84 < (/.f64 z t) < -1e9 or 5.00000000000000019e-26 < (/.f64 z t) < 5.00000000000000003e159Initial program 99.8%
Taylor expanded in z around inf 77.4%
sub-div79.7%
associate-/r/91.2%
Applied egg-rr91.2%
Taylor expanded in y around inf 46.9%
/-rgt-identity46.9%
associate-/l/46.9%
*-commutative46.9%
times-frac61.9%
/-rgt-identity61.9%
Simplified61.9%
if -1e9 < (/.f64 z t) < 5.00000000000000019e-26Initial program 98.8%
Taylor expanded in z around 0 79.4%
if 5.00000000000000003e159 < (/.f64 z t) Initial program 92.3%
Taylor expanded in z around inf 97.3%
sub-div97.3%
associate-/r/92.3%
Applied egg-rr92.3%
Taylor expanded in y around 0 71.5%
mul-1-neg71.5%
*-commutative71.5%
associate-*r/74.8%
distribute-rgt-neg-in74.8%
distribute-neg-frac74.8%
Simplified74.8%
Final simplification75.3%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ z t) -1000000000.0) (not (<= (/ z t) 5e-26))) (* z (/ (- y x) t)) x))
double code(double x, double y, double z, double t) {
double tmp;
if (((z / t) <= -1000000000.0) || !((z / t) <= 5e-26)) {
tmp = z * ((y - x) / 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) <= (-1000000000.0d0)) .or. (.not. ((z / t) <= 5d-26))) then
tmp = z * ((y - x) / 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) <= -1000000000.0) || !((z / t) <= 5e-26)) {
tmp = z * ((y - x) / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((z / t) <= -1000000000.0) or not ((z / t) <= 5e-26): tmp = z * ((y - x) / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(z / t) <= -1000000000.0) || !(Float64(z / t) <= 5e-26)) tmp = Float64(z * Float64(Float64(y - x) / t)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((z / t) <= -1000000000.0) || ~(((z / t) <= 5e-26))) tmp = z * ((y - x) / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(z / t), $MachinePrecision], -1000000000.0], N[Not[LessEqual[N[(z / t), $MachinePrecision], 5e-26]], $MachinePrecision]], N[(z * N[(N[(y - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{z}{t} \leq -1000000000 \lor \neg \left(\frac{z}{t} \leq 5 \cdot 10^{-26}\right):\\
\;\;\;\;z \cdot \frac{y - x}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if (/.f64 z t) < -1e9 or 5.00000000000000019e-26 < (/.f64 z t) Initial program 96.4%
Taylor expanded in z around inf 87.7%
Taylor expanded in y around 0 87.7%
mul-1-neg87.7%
distribute-frac-neg87.7%
+-commutative87.7%
distribute-frac-neg87.7%
sub-neg87.7%
div-sub89.4%
Simplified89.4%
if -1e9 < (/.f64 z t) < 5.00000000000000019e-26Initial program 98.8%
Taylor expanded in z around 0 79.4%
Final simplification84.5%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ z t) -5e+56) (not (<= (/ z t) 1e+20))) (* z (/ (- y x) t)) (+ x (* y (/ z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (((z / t) <= -5e+56) || !((z / t) <= 1e+20)) {
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) <= (-5d+56)) .or. (.not. ((z / t) <= 1d+20))) 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) <= -5e+56) || !((z / t) <= 1e+20)) {
tmp = z * ((y - x) / t);
} else {
tmp = x + (y * (z / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((z / t) <= -5e+56) or not ((z / t) <= 1e+20): 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) <= -5e+56) || !(Float64(z / t) <= 1e+20)) 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) <= -5e+56) || ~(((z / t) <= 1e+20))) 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], -5e+56], N[Not[LessEqual[N[(z / t), $MachinePrecision], 1e+20]], $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 -5 \cdot 10^{+56} \lor \neg \left(\frac{z}{t} \leq 10^{+20}\right):\\
\;\;\;\;z \cdot \frac{y - x}{t}\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\end{array}
\end{array}
if (/.f64 z t) < -5.00000000000000024e56 or 1e20 < (/.f64 z t) Initial program 95.9%
Taylor expanded in z around inf 93.9%
Taylor expanded in y around 0 93.9%
mul-1-neg93.9%
distribute-frac-neg93.9%
+-commutative93.9%
distribute-frac-neg93.9%
sub-neg93.9%
div-sub95.7%
Simplified95.7%
if -5.00000000000000024e56 < (/.f64 z t) < 1e20Initial program 98.9%
Taylor expanded in y around inf 86.8%
associate-*r/94.3%
Simplified94.3%
Final simplification94.9%
(FPCore (x y z t) :precision binary64 (if (<= (/ z t) -5e+80) (/ (* (- y x) z) t) (if (<= (/ z t) 1e+20) (+ x (* y (/ z t))) (* z (/ (- y x) t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z / t) <= -5e+80) {
tmp = ((y - x) * z) / t;
} else if ((z / t) <= 1e+20) {
tmp = x + (y * (z / t));
} else {
tmp = z * ((y - x) / 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+80)) then
tmp = ((y - x) * z) / t
else if ((z / t) <= 1d+20) then
tmp = x + (y * (z / t))
else
tmp = z * ((y - x) / 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+80) {
tmp = ((y - x) * z) / t;
} else if ((z / t) <= 1e+20) {
tmp = x + (y * (z / t));
} else {
tmp = z * ((y - x) / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z / t) <= -5e+80: tmp = ((y - x) * z) / t elif (z / t) <= 1e+20: tmp = x + (y * (z / t)) else: tmp = z * ((y - x) / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(z / t) <= -5e+80) tmp = Float64(Float64(Float64(y - x) * z) / t); elseif (Float64(z / t) <= 1e+20) tmp = Float64(x + Float64(y * Float64(z / t))); else tmp = Float64(z * Float64(Float64(y - x) / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z / t) <= -5e+80) tmp = ((y - x) * z) / t; elseif ((z / t) <= 1e+20) tmp = x + (y * (z / t)); else tmp = z * ((y - x) / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(z / t), $MachinePrecision], -5e+80], N[(N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[N[(z / t), $MachinePrecision], 1e+20], N[(x + N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(z * N[(N[(y - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{z}{t} \leq -5 \cdot 10^{+80}:\\
\;\;\;\;\frac{\left(y - x\right) \cdot z}{t}\\
\mathbf{elif}\;\frac{z}{t} \leq 10^{+20}:\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;z \cdot \frac{y - x}{t}\\
\end{array}
\end{array}
if (/.f64 z t) < -4.99999999999999961e80Initial program 96.1%
Taylor expanded in z around inf 90.2%
Taylor expanded in t around inf 98.0%
if -4.99999999999999961e80 < (/.f64 z t) < 1e20Initial program 99.0%
Taylor expanded in y around inf 85.8%
associate-*r/93.8%
Simplified93.8%
if 1e20 < (/.f64 z t) Initial program 95.5%
Taylor expanded in z around inf 96.7%
Taylor expanded in y around 0 96.7%
mul-1-neg96.7%
distribute-frac-neg96.7%
+-commutative96.7%
distribute-frac-neg96.7%
sub-neg96.7%
div-sub98.3%
Simplified98.3%
Final simplification95.7%
(FPCore (x y z t) :precision binary64 (if (<= (/ z t) -10000000000.0) (/ (- y x) (/ t z)) (if (<= (/ z t) 1e+20) (+ x (* y (/ z t))) (* z (/ (- y x) t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z / t) <= -10000000000.0) {
tmp = (y - x) / (t / z);
} else if ((z / t) <= 1e+20) {
tmp = x + (y * (z / t));
} else {
tmp = z * ((y - x) / 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) <= (-10000000000.0d0)) then
tmp = (y - x) / (t / z)
else if ((z / t) <= 1d+20) then
tmp = x + (y * (z / t))
else
tmp = z * ((y - x) / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z / t) <= -10000000000.0) {
tmp = (y - x) / (t / z);
} else if ((z / t) <= 1e+20) {
tmp = x + (y * (z / t));
} else {
tmp = z * ((y - x) / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z / t) <= -10000000000.0: tmp = (y - x) / (t / z) elif (z / t) <= 1e+20: tmp = x + (y * (z / t)) else: tmp = z * ((y - x) / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(z / t) <= -10000000000.0) tmp = Float64(Float64(y - x) / Float64(t / z)); elseif (Float64(z / t) <= 1e+20) tmp = Float64(x + Float64(y * Float64(z / t))); else tmp = Float64(z * Float64(Float64(y - x) / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z / t) <= -10000000000.0) tmp = (y - x) / (t / z); elseif ((z / t) <= 1e+20) tmp = x + (y * (z / t)); else tmp = z * ((y - x) / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(z / t), $MachinePrecision], -10000000000.0], N[(N[(y - x), $MachinePrecision] / N[(t / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z / t), $MachinePrecision], 1e+20], N[(x + N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(z * N[(N[(y - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{z}{t} \leq -10000000000:\\
\;\;\;\;\frac{y - x}{\frac{t}{z}}\\
\mathbf{elif}\;\frac{z}{t} \leq 10^{+20}:\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;z \cdot \frac{y - x}{t}\\
\end{array}
\end{array}
if (/.f64 z t) < -1e10Initial program 96.8%
Taylor expanded in z around inf 87.2%
sub-div89.0%
associate-/r/96.2%
Applied egg-rr96.2%
if -1e10 < (/.f64 z t) < 1e20Initial program 98.9%
Taylor expanded in y around inf 89.4%
associate-*r/96.0%
Simplified96.0%
if 1e20 < (/.f64 z t) Initial program 95.5%
Taylor expanded in z around inf 96.7%
Taylor expanded in y around 0 96.7%
mul-1-neg96.7%
distribute-frac-neg96.7%
+-commutative96.7%
distribute-frac-neg96.7%
sub-neg96.7%
div-sub98.3%
Simplified98.3%
Final simplification96.6%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ z t) -1000000000.0) (not (<= (/ z t) 5e-26))) (* y (/ z t)) x))
double code(double x, double y, double z, double t) {
double tmp;
if (((z / t) <= -1000000000.0) || !((z / t) <= 5e-26)) {
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) <= (-1000000000.0d0)) .or. (.not. ((z / t) <= 5d-26))) 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) <= -1000000000.0) || !((z / t) <= 5e-26)) {
tmp = y * (z / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((z / t) <= -1000000000.0) or not ((z / t) <= 5e-26): tmp = y * (z / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(z / t) <= -1000000000.0) || !(Float64(z / t) <= 5e-26)) 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) <= -1000000000.0) || ~(((z / t) <= 5e-26))) tmp = y * (z / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(z / t), $MachinePrecision], -1000000000.0], N[Not[LessEqual[N[(z / t), $MachinePrecision], 5e-26]], $MachinePrecision]], N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{z}{t} \leq -1000000000 \lor \neg \left(\frac{z}{t} \leq 5 \cdot 10^{-26}\right):\\
\;\;\;\;y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if (/.f64 z t) < -1e9 or 5.00000000000000019e-26 < (/.f64 z t) Initial program 96.4%
Taylor expanded in z around inf 87.7%
sub-div89.4%
associate-/r/93.2%
Applied egg-rr93.2%
Taylor expanded in y around inf 54.4%
/-rgt-identity54.4%
associate-/l/54.4%
*-commutative54.4%
times-frac60.9%
/-rgt-identity60.9%
Simplified60.9%
if -1e9 < (/.f64 z t) < 5.00000000000000019e-26Initial program 98.8%
Taylor expanded in z around 0 79.4%
Final simplification69.9%
(FPCore (x y z t) :precision binary64 (if (<= t -2.2e+48) x (if (<= t 1.35e+27) (* z (/ y t)) x)))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -2.2e+48) {
tmp = x;
} else if (t <= 1.35e+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 (t <= (-2.2d+48)) then
tmp = x
else if (t <= 1.35d+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 (t <= -2.2e+48) {
tmp = x;
} else if (t <= 1.35e+27) {
tmp = z * (y / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -2.2e+48: tmp = x elif t <= 1.35e+27: tmp = z * (y / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -2.2e+48) tmp = x; elseif (t <= 1.35e+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 (t <= -2.2e+48) tmp = x; elseif (t <= 1.35e+27) tmp = z * (y / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -2.2e+48], x, If[LessEqual[t, 1.35e+27], N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.2 \cdot 10^{+48}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq 1.35 \cdot 10^{+27}:\\
\;\;\;\;z \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if t < -2.1999999999999999e48 or 1.3499999999999999e27 < t Initial program 99.6%
Taylor expanded in z around 0 68.5%
if -2.1999999999999999e48 < t < 1.3499999999999999e27Initial program 96.1%
Taylor expanded in z around inf 73.6%
Taylor expanded in y around inf 51.2%
Final simplification58.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.6%
Taylor expanded in z around 0 40.4%
Final simplification40.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 2023200
(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))))