
(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 (if (<= (/ z t) 5e+134) (fma (- y x) (/ z t) x) (* z (/ (- y x) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z / t) <= 5e+134) {
tmp = fma((y - x), (z / t), x);
} else {
tmp = z * ((y - x) / t);
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (Float64(z / t) <= 5e+134) tmp = fma(Float64(y - x), Float64(z / t), x); else tmp = Float64(z * Float64(Float64(y - x) / t)); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[N[(z / t), $MachinePrecision], 5e+134], N[(N[(y - x), $MachinePrecision] * N[(z / t), $MachinePrecision] + x), $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^{+134}:\\
\;\;\;\;\mathsf{fma}\left(y - x, \frac{z}{t}, x\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \frac{y - x}{t}\\
\end{array}
\end{array}
if (/.f64 z t) < 4.99999999999999981e134Initial program 99.0%
+-commutative99.0%
fma-def99.0%
Simplified99.0%
if 4.99999999999999981e134 < (/.f64 z t) Initial program 87.4%
Taylor expanded in z around -inf 97.9%
Taylor expanded in t around 0 97.9%
associate-/l*87.4%
associate-/r/99.9%
Applied egg-rr99.9%
Final simplification99.1%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (/ z t) y)))
(if (<= (/ z t) -1e-70)
t_1
(if (<= (/ z t) 2e-17)
x
(if (<= (/ z t) 5e+59)
t_1
(if (or (<= (/ z t) 5e+135) (not (<= (/ z t) 5e+184)))
(* (/ z t) (- x))
(* z (/ y t))))))))
double code(double x, double y, double z, double t) {
double t_1 = (z / t) * y;
double tmp;
if ((z / t) <= -1e-70) {
tmp = t_1;
} else if ((z / t) <= 2e-17) {
tmp = x;
} else if ((z / t) <= 5e+59) {
tmp = t_1;
} else if (((z / t) <= 5e+135) || !((z / t) <= 5e+184)) {
tmp = (z / t) * -x;
} else {
tmp = z * (y / 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 = (z / t) * y
if ((z / t) <= (-1d-70)) then
tmp = t_1
else if ((z / t) <= 2d-17) then
tmp = x
else if ((z / t) <= 5d+59) then
tmp = t_1
else if (((z / t) <= 5d+135) .or. (.not. ((z / t) <= 5d+184))) then
tmp = (z / t) * -x
else
tmp = z * (y / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (z / t) * y;
double tmp;
if ((z / t) <= -1e-70) {
tmp = t_1;
} else if ((z / t) <= 2e-17) {
tmp = x;
} else if ((z / t) <= 5e+59) {
tmp = t_1;
} else if (((z / t) <= 5e+135) || !((z / t) <= 5e+184)) {
tmp = (z / t) * -x;
} else {
tmp = z * (y / t);
}
return tmp;
}
def code(x, y, z, t): t_1 = (z / t) * y tmp = 0 if (z / t) <= -1e-70: tmp = t_1 elif (z / t) <= 2e-17: tmp = x elif (z / t) <= 5e+59: tmp = t_1 elif ((z / t) <= 5e+135) or not ((z / t) <= 5e+184): tmp = (z / t) * -x else: tmp = z * (y / t) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(z / t) * y) tmp = 0.0 if (Float64(z / t) <= -1e-70) tmp = t_1; elseif (Float64(z / t) <= 2e-17) tmp = x; elseif (Float64(z / t) <= 5e+59) tmp = t_1; elseif ((Float64(z / t) <= 5e+135) || !(Float64(z / t) <= 5e+184)) tmp = Float64(Float64(z / t) * Float64(-x)); else tmp = Float64(z * Float64(y / t)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (z / t) * y; tmp = 0.0; if ((z / t) <= -1e-70) tmp = t_1; elseif ((z / t) <= 2e-17) tmp = x; elseif ((z / t) <= 5e+59) tmp = t_1; elseif (((z / t) <= 5e+135) || ~(((z / t) <= 5e+184))) tmp = (z / t) * -x; else tmp = z * (y / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(z / t), $MachinePrecision] * y), $MachinePrecision]}, If[LessEqual[N[(z / t), $MachinePrecision], -1e-70], t$95$1, If[LessEqual[N[(z / t), $MachinePrecision], 2e-17], x, If[LessEqual[N[(z / t), $MachinePrecision], 5e+59], t$95$1, If[Or[LessEqual[N[(z / t), $MachinePrecision], 5e+135], N[Not[LessEqual[N[(z / t), $MachinePrecision], 5e+184]], $MachinePrecision]], N[(N[(z / t), $MachinePrecision] * (-x)), $MachinePrecision], N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z}{t} \cdot y\\
\mathbf{if}\;\frac{z}{t} \leq -1 \cdot 10^{-70}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\frac{z}{t} \leq 2 \cdot 10^{-17}:\\
\;\;\;\;x\\
\mathbf{elif}\;\frac{z}{t} \leq 5 \cdot 10^{+59}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\frac{z}{t} \leq 5 \cdot 10^{+135} \lor \neg \left(\frac{z}{t} \leq 5 \cdot 10^{+184}\right):\\
\;\;\;\;\frac{z}{t} \cdot \left(-x\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \frac{y}{t}\\
\end{array}
\end{array}
if (/.f64 z t) < -9.99999999999999996e-71 or 2.00000000000000014e-17 < (/.f64 z t) < 4.9999999999999997e59Initial program 98.7%
+-commutative98.7%
*-commutative98.7%
div-inv97.4%
associate-*l*87.2%
fma-def87.3%
Applied egg-rr87.3%
Taylor expanded in y around inf 59.6%
associate-*r/66.2%
Simplified66.2%
if -9.99999999999999996e-71 < (/.f64 z t) < 2.00000000000000014e-17Initial program 99.1%
Taylor expanded in z around 0 80.2%
if 4.9999999999999997e59 < (/.f64 z t) < 5.00000000000000029e135 or 4.9999999999999999e184 < (/.f64 z t) Initial program 89.6%
Taylor expanded in x around inf 67.3%
*-commutative67.3%
mul-1-neg67.3%
unsub-neg67.3%
distribute-lft-out--67.3%
*-rgt-identity67.3%
Simplified67.3%
Taylor expanded in x around 0 67.3%
Taylor expanded in z around inf 63.7%
associate-*l/67.3%
associate-*r*67.3%
mul-1-neg67.3%
distribute-frac-neg67.3%
*-commutative67.3%
Simplified67.3%
if 5.00000000000000029e135 < (/.f64 z t) < 4.9999999999999999e184Initial program 99.5%
Taylor expanded in z around -inf 85.2%
Taylor expanded in t around 0 85.2%
associate-/l*99.7%
associate-/r/100.0%
Applied egg-rr100.0%
Taylor expanded in y around inf 100.0%
Final simplification73.4%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (/ z t) y)))
(if (<= (/ z t) -1e-70)
t_1
(if (<= (/ z t) 2e-17)
x
(if (<= (/ z t) 5e+59)
t_1
(if (<= (/ z t) 5e+135)
(* (/ z t) (- x))
(if (<= (/ z t) 5e+184) (* z (/ y t)) (* (- z) (/ x t)))))))))
double code(double x, double y, double z, double t) {
double t_1 = (z / t) * y;
double tmp;
if ((z / t) <= -1e-70) {
tmp = t_1;
} else if ((z / t) <= 2e-17) {
tmp = x;
} else if ((z / t) <= 5e+59) {
tmp = t_1;
} else if ((z / t) <= 5e+135) {
tmp = (z / t) * -x;
} else if ((z / t) <= 5e+184) {
tmp = z * (y / t);
} else {
tmp = -z * (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) :: t_1
real(8) :: tmp
t_1 = (z / t) * y
if ((z / t) <= (-1d-70)) then
tmp = t_1
else if ((z / t) <= 2d-17) then
tmp = x
else if ((z / t) <= 5d+59) then
tmp = t_1
else if ((z / t) <= 5d+135) then
tmp = (z / t) * -x
else if ((z / t) <= 5d+184) then
tmp = z * (y / t)
else
tmp = -z * (x / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (z / t) * y;
double tmp;
if ((z / t) <= -1e-70) {
tmp = t_1;
} else if ((z / t) <= 2e-17) {
tmp = x;
} else if ((z / t) <= 5e+59) {
tmp = t_1;
} else if ((z / t) <= 5e+135) {
tmp = (z / t) * -x;
} else if ((z / t) <= 5e+184) {
tmp = z * (y / t);
} else {
tmp = -z * (x / t);
}
return tmp;
}
def code(x, y, z, t): t_1 = (z / t) * y tmp = 0 if (z / t) <= -1e-70: tmp = t_1 elif (z / t) <= 2e-17: tmp = x elif (z / t) <= 5e+59: tmp = t_1 elif (z / t) <= 5e+135: tmp = (z / t) * -x elif (z / t) <= 5e+184: tmp = z * (y / t) else: tmp = -z * (x / t) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(z / t) * y) tmp = 0.0 if (Float64(z / t) <= -1e-70) tmp = t_1; elseif (Float64(z / t) <= 2e-17) tmp = x; elseif (Float64(z / t) <= 5e+59) tmp = t_1; elseif (Float64(z / t) <= 5e+135) tmp = Float64(Float64(z / t) * Float64(-x)); elseif (Float64(z / t) <= 5e+184) tmp = Float64(z * Float64(y / t)); else tmp = Float64(Float64(-z) * Float64(x / t)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (z / t) * y; tmp = 0.0; if ((z / t) <= -1e-70) tmp = t_1; elseif ((z / t) <= 2e-17) tmp = x; elseif ((z / t) <= 5e+59) tmp = t_1; elseif ((z / t) <= 5e+135) tmp = (z / t) * -x; elseif ((z / t) <= 5e+184) tmp = z * (y / t); else tmp = -z * (x / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(z / t), $MachinePrecision] * y), $MachinePrecision]}, If[LessEqual[N[(z / t), $MachinePrecision], -1e-70], t$95$1, If[LessEqual[N[(z / t), $MachinePrecision], 2e-17], x, If[LessEqual[N[(z / t), $MachinePrecision], 5e+59], t$95$1, If[LessEqual[N[(z / t), $MachinePrecision], 5e+135], N[(N[(z / t), $MachinePrecision] * (-x)), $MachinePrecision], If[LessEqual[N[(z / t), $MachinePrecision], 5e+184], N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision], N[((-z) * N[(x / t), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z}{t} \cdot y\\
\mathbf{if}\;\frac{z}{t} \leq -1 \cdot 10^{-70}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\frac{z}{t} \leq 2 \cdot 10^{-17}:\\
\;\;\;\;x\\
\mathbf{elif}\;\frac{z}{t} \leq 5 \cdot 10^{+59}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\frac{z}{t} \leq 5 \cdot 10^{+135}:\\
\;\;\;\;\frac{z}{t} \cdot \left(-x\right)\\
\mathbf{elif}\;\frac{z}{t} \leq 5 \cdot 10^{+184}:\\
\;\;\;\;z \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;\left(-z\right) \cdot \frac{x}{t}\\
\end{array}
\end{array}
if (/.f64 z t) < -9.99999999999999996e-71 or 2.00000000000000014e-17 < (/.f64 z t) < 4.9999999999999997e59Initial program 98.7%
+-commutative98.7%
*-commutative98.7%
div-inv97.4%
associate-*l*87.2%
fma-def87.3%
Applied egg-rr87.3%
Taylor expanded in y around inf 59.6%
associate-*r/66.2%
Simplified66.2%
if -9.99999999999999996e-71 < (/.f64 z t) < 2.00000000000000014e-17Initial program 99.1%
Taylor expanded in z around 0 80.2%
if 4.9999999999999997e59 < (/.f64 z t) < 5.00000000000000029e135Initial program 99.8%
Taylor expanded in x around inf 63.1%
*-commutative63.1%
mul-1-neg63.1%
unsub-neg63.1%
distribute-lft-out--63.1%
*-rgt-identity63.1%
Simplified63.1%
Taylor expanded in x around 0 63.1%
Taylor expanded in z around inf 46.0%
associate-*l/63.1%
associate-*r*63.1%
mul-1-neg63.1%
distribute-frac-neg63.1%
*-commutative63.1%
Simplified63.1%
if 5.00000000000000029e135 < (/.f64 z t) < 4.9999999999999999e184Initial program 99.5%
Taylor expanded in z around -inf 85.2%
Taylor expanded in t around 0 85.2%
associate-/l*99.7%
associate-/r/100.0%
Applied egg-rr100.0%
Taylor expanded in y around inf 100.0%
if 4.9999999999999999e184 < (/.f64 z t) Initial program 85.1%
Taylor expanded in x around inf 69.1%
*-commutative69.1%
mul-1-neg69.1%
unsub-neg69.1%
distribute-lft-out--69.1%
*-rgt-identity69.1%
Simplified69.1%
Taylor expanded in x around 0 69.1%
Taylor expanded in z around inf 71.3%
associate-*r/71.3%
neg-mul-171.3%
distribute-lft-neg-in71.3%
*-commutative71.3%
Simplified71.3%
Final simplification73.7%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ z t) -1e-70) (not (<= (/ z t) 2e-17))) (* (/ z t) (- y x)) x))
double code(double x, double y, double z, double t) {
double tmp;
if (((z / t) <= -1e-70) || !((z / t) <= 2e-17)) {
tmp = (z / t) * (y - x);
} 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-70)) .or. (.not. ((z / t) <= 2d-17))) then
tmp = (z / t) * (y - x)
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-70) || !((z / t) <= 2e-17)) {
tmp = (z / t) * (y - x);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((z / t) <= -1e-70) or not ((z / t) <= 2e-17): tmp = (z / t) * (y - x) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(z / t) <= -1e-70) || !(Float64(z / t) <= 2e-17)) tmp = Float64(Float64(z / t) * Float64(y - x)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((z / t) <= -1e-70) || ~(((z / t) <= 2e-17))) tmp = (z / t) * (y - x); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(z / t), $MachinePrecision], -1e-70], N[Not[LessEqual[N[(z / t), $MachinePrecision], 2e-17]], $MachinePrecision]], N[(N[(z / t), $MachinePrecision] * N[(y - x), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{z}{t} \leq -1 \cdot 10^{-70} \lor \neg \left(\frac{z}{t} \leq 2 \cdot 10^{-17}\right):\\
\;\;\;\;\frac{z}{t} \cdot \left(y - x\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if (/.f64 z t) < -9.99999999999999996e-71 or 2.00000000000000014e-17 < (/.f64 z t) Initial program 95.4%
Taylor expanded in z around -inf 91.4%
Taylor expanded in t around 0 87.9%
div-inv87.8%
*-commutative87.8%
associate-*r*89.4%
*-commutative89.4%
associate-*r*91.7%
div-inv91.8%
Applied egg-rr91.8%
if -9.99999999999999996e-71 < (/.f64 z t) < 2.00000000000000014e-17Initial program 99.1%
Taylor expanded in z around 0 80.2%
Final simplification86.7%
(FPCore (x y z t) :precision binary64 (if (<= (/ z t) -1e-70) (* (/ z t) (- y x)) (if (<= (/ z t) 1000000.0) (* x (- 1.0 (/ z t))) (* z (/ (- y x) t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z / t) <= -1e-70) {
tmp = (z / t) * (y - x);
} else if ((z / t) <= 1000000.0) {
tmp = x * (1.0 - (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) <= (-1d-70)) then
tmp = (z / t) * (y - x)
else if ((z / t) <= 1000000.0d0) then
tmp = x * (1.0d0 - (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) <= -1e-70) {
tmp = (z / t) * (y - x);
} else if ((z / t) <= 1000000.0) {
tmp = x * (1.0 - (z / t));
} else {
tmp = z * ((y - x) / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z / t) <= -1e-70: tmp = (z / t) * (y - x) elif (z / t) <= 1000000.0: tmp = x * (1.0 - (z / t)) else: tmp = z * ((y - x) / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(z / t) <= -1e-70) tmp = Float64(Float64(z / t) * Float64(y - x)); elseif (Float64(z / t) <= 1000000.0) tmp = Float64(x * Float64(1.0 - 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) <= -1e-70) tmp = (z / t) * (y - x); elseif ((z / t) <= 1000000.0) tmp = x * (1.0 - (z / t)); else tmp = z * ((y - x) / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(z / t), $MachinePrecision], -1e-70], N[(N[(z / t), $MachinePrecision] * N[(y - x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z / t), $MachinePrecision], 1000000.0], N[(x * N[(1.0 - 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 -1 \cdot 10^{-70}:\\
\;\;\;\;\frac{z}{t} \cdot \left(y - x\right)\\
\mathbf{elif}\;\frac{z}{t} \leq 1000000:\\
\;\;\;\;x \cdot \left(1 - \frac{z}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \frac{y - x}{t}\\
\end{array}
\end{array}
if (/.f64 z t) < -9.99999999999999996e-71Initial program 98.4%
Taylor expanded in z around -inf 91.3%
Taylor expanded in t around 0 85.7%
div-inv85.5%
*-commutative85.5%
associate-*r*85.4%
*-commutative85.4%
associate-*r*92.7%
div-inv92.8%
Applied egg-rr92.8%
if -9.99999999999999996e-71 < (/.f64 z t) < 1e6Initial program 99.1%
Taylor expanded in x around inf 79.3%
*-commutative79.3%
mul-1-neg79.3%
unsub-neg79.3%
distribute-lft-out--79.3%
*-rgt-identity79.3%
Simplified79.3%
Taylor expanded in x around 0 79.3%
if 1e6 < (/.f64 z t) Initial program 92.5%
Taylor expanded in z around -inf 91.2%
Taylor expanded in t around 0 91.2%
associate-/l*92.5%
associate-/r/95.7%
Applied egg-rr95.7%
Final simplification87.5%
(FPCore (x y z t) :precision binary64 (if (<= (/ z t) -4e+24) (* (/ z t) (- y x)) (if (<= (/ z t) 1.0) (+ x (* (/ z t) y)) (* z (/ (- y x) t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z / t) <= -4e+24) {
tmp = (z / t) * (y - x);
} else if ((z / t) <= 1.0) {
tmp = x + ((z / t) * y);
} 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) <= (-4d+24)) then
tmp = (z / t) * (y - x)
else if ((z / t) <= 1.0d0) then
tmp = x + ((z / t) * y)
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) <= -4e+24) {
tmp = (z / t) * (y - x);
} else if ((z / t) <= 1.0) {
tmp = x + ((z / t) * y);
} else {
tmp = z * ((y - x) / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z / t) <= -4e+24: tmp = (z / t) * (y - x) elif (z / t) <= 1.0: tmp = x + ((z / t) * y) else: tmp = z * ((y - x) / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(z / t) <= -4e+24) tmp = Float64(Float64(z / t) * Float64(y - x)); elseif (Float64(z / t) <= 1.0) tmp = Float64(x + Float64(Float64(z / t) * y)); 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) <= -4e+24) tmp = (z / t) * (y - x); elseif ((z / t) <= 1.0) tmp = x + ((z / t) * y); else tmp = z * ((y - x) / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(z / t), $MachinePrecision], -4e+24], N[(N[(z / t), $MachinePrecision] * N[(y - x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z / t), $MachinePrecision], 1.0], N[(x + N[(N[(z / t), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision], N[(z * N[(N[(y - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{z}{t} \leq -4 \cdot 10^{+24}:\\
\;\;\;\;\frac{z}{t} \cdot \left(y - x\right)\\
\mathbf{elif}\;\frac{z}{t} \leq 1:\\
\;\;\;\;x + \frac{z}{t} \cdot y\\
\mathbf{else}:\\
\;\;\;\;z \cdot \frac{y - x}{t}\\
\end{array}
\end{array}
if (/.f64 z t) < -3.9999999999999999e24Initial program 98.0%
Taylor expanded in z around -inf 94.4%
Taylor expanded in t around 0 94.4%
div-inv94.3%
*-commutative94.3%
associate-*r*94.1%
*-commutative94.1%
associate-*r*97.9%
div-inv98.0%
Applied egg-rr98.0%
if -3.9999999999999999e24 < (/.f64 z t) < 1Initial program 99.2%
Taylor expanded in y around inf 93.9%
associate-*r/98.4%
Simplified98.4%
if 1 < (/.f64 z t) Initial program 92.6%
Taylor expanded in z around -inf 91.3%
Taylor expanded in t around 0 90.6%
associate-/l*91.9%
associate-/r/95.1%
Applied egg-rr95.1%
Final simplification97.4%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ z t) -1e-70) (not (<= (/ z t) 2e-17))) (* (/ z t) y) x))
double code(double x, double y, double z, double t) {
double tmp;
if (((z / t) <= -1e-70) || !((z / t) <= 2e-17)) {
tmp = (z / t) * y;
} 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-70)) .or. (.not. ((z / t) <= 2d-17))) then
tmp = (z / t) * y
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-70) || !((z / t) <= 2e-17)) {
tmp = (z / t) * y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((z / t) <= -1e-70) or not ((z / t) <= 2e-17): tmp = (z / t) * y else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(z / t) <= -1e-70) || !(Float64(z / t) <= 2e-17)) tmp = Float64(Float64(z / t) * y); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((z / t) <= -1e-70) || ~(((z / t) <= 2e-17))) tmp = (z / t) * y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(z / t), $MachinePrecision], -1e-70], N[Not[LessEqual[N[(z / t), $MachinePrecision], 2e-17]], $MachinePrecision]], N[(N[(z / t), $MachinePrecision] * y), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{z}{t} \leq -1 \cdot 10^{-70} \lor \neg \left(\frac{z}{t} \leq 2 \cdot 10^{-17}\right):\\
\;\;\;\;\frac{z}{t} \cdot y\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if (/.f64 z t) < -9.99999999999999996e-71 or 2.00000000000000014e-17 < (/.f64 z t) Initial program 95.4%
+-commutative95.4%
*-commutative95.4%
div-inv94.5%
associate-*l*91.7%
fma-def91.7%
Applied egg-rr91.7%
Taylor expanded in y around inf 55.7%
associate-*r/60.3%
Simplified60.3%
if -9.99999999999999996e-71 < (/.f64 z t) < 2.00000000000000014e-17Initial program 99.1%
Taylor expanded in z around 0 80.2%
Final simplification69.0%
(FPCore (x y z t) :precision binary64 (if (<= (/ z t) 5e+134) (+ x (* (/ z t) (- y x))) (* z (/ (- y x) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z / t) <= 5e+134) {
tmp = x + ((z / t) * (y - x));
} 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+134) then
tmp = x + ((z / t) * (y - x))
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+134) {
tmp = x + ((z / t) * (y - x));
} else {
tmp = z * ((y - x) / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z / t) <= 5e+134: tmp = x + ((z / t) * (y - x)) else: tmp = z * ((y - x) / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(z / t) <= 5e+134) tmp = Float64(x + Float64(Float64(z / t) * Float64(y - x))); 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+134) tmp = x + ((z / t) * (y - x)); else tmp = z * ((y - x) / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(z / t), $MachinePrecision], 5e+134], N[(x + N[(N[(z / t), $MachinePrecision] * N[(y - x), $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^{+134}:\\
\;\;\;\;x + \frac{z}{t} \cdot \left(y - x\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \frac{y - x}{t}\\
\end{array}
\end{array}
if (/.f64 z t) < 4.99999999999999981e134Initial program 99.0%
if 4.99999999999999981e134 < (/.f64 z t) Initial program 87.4%
Taylor expanded in z around -inf 97.9%
Taylor expanded in t around 0 97.9%
associate-/l*87.4%
associate-/r/99.9%
Applied egg-rr99.9%
Final simplification99.1%
(FPCore (x y z t) :precision binary64 (if (or (<= y -2.6e-16) (not (<= y 1.9e-19))) (* (/ z t) y) (* x (- 1.0 (/ z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -2.6e-16) || !(y <= 1.9e-19)) {
tmp = (z / t) * y;
} 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 <= (-2.6d-16)) .or. (.not. (y <= 1.9d-19))) then
tmp = (z / t) * y
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 <= -2.6e-16) || !(y <= 1.9e-19)) {
tmp = (z / t) * y;
} else {
tmp = x * (1.0 - (z / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -2.6e-16) or not (y <= 1.9e-19): tmp = (z / t) * y else: tmp = x * (1.0 - (z / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -2.6e-16) || !(y <= 1.9e-19)) tmp = Float64(Float64(z / t) * y); 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 <= -2.6e-16) || ~((y <= 1.9e-19))) tmp = (z / t) * y; else tmp = x * (1.0 - (z / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -2.6e-16], N[Not[LessEqual[y, 1.9e-19]], $MachinePrecision]], N[(N[(z / t), $MachinePrecision] * y), $MachinePrecision], N[(x * N[(1.0 - N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.6 \cdot 10^{-16} \lor \neg \left(y \leq 1.9 \cdot 10^{-19}\right):\\
\;\;\;\;\frac{z}{t} \cdot y\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - \frac{z}{t}\right)\\
\end{array}
\end{array}
if y < -2.5999999999999998e-16 or 1.9e-19 < y Initial program 99.1%
+-commutative99.1%
*-commutative99.1%
div-inv99.0%
associate-*l*91.4%
fma-def91.4%
Applied egg-rr91.4%
Taylor expanded in y around inf 61.9%
associate-*r/68.5%
Simplified68.5%
if -2.5999999999999998e-16 < y < 1.9e-19Initial program 94.9%
Taylor expanded in x around inf 85.3%
*-commutative85.3%
mul-1-neg85.3%
unsub-neg85.3%
distribute-lft-out--85.3%
*-rgt-identity85.3%
Simplified85.3%
Taylor expanded in x around 0 85.3%
Final simplification77.0%
(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.0%
Taylor expanded in z around 0 38.0%
Final simplification38.0%
(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 2023230
(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))))