
(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 (fma (- y x) (/ z t) x))
double code(double x, double y, double z, double t) {
return fma((y - x), (z / t), x);
}
function code(x, y, z, t) return fma(Float64(y - x), Float64(z / t), x) end
code[x_, y_, z_, t_] := N[(N[(y - x), $MachinePrecision] * N[(z / t), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(y - x, \frac{z}{t}, x\right)
\end{array}
Initial program 97.1%
+-commutative97.1%
fma-def97.1%
Simplified97.1%
Final simplification97.1%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ (* y z) t)))
(if (<= (/ z t) -5e+120)
t_1
(if (<= (/ z t) -4e+28)
(/ (* x (- z)) t)
(if (<= (/ z t) -1e-27)
t_1
(if (<= (/ z t) 1e-9)
x
(if (<= (/ z t) 50000000.0)
t_1
(if (<= (/ z t) 5e+238) (* (/ z t) (- x)) (* z (/ y t))))))))))
double code(double x, double y, double z, double t) {
double t_1 = (y * z) / t;
double tmp;
if ((z / t) <= -5e+120) {
tmp = t_1;
} else if ((z / t) <= -4e+28) {
tmp = (x * -z) / t;
} else if ((z / t) <= -1e-27) {
tmp = t_1;
} else if ((z / t) <= 1e-9) {
tmp = x;
} else if ((z / t) <= 50000000.0) {
tmp = t_1;
} else if ((z / t) <= 5e+238) {
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 = (y * z) / t
if ((z / t) <= (-5d+120)) then
tmp = t_1
else if ((z / t) <= (-4d+28)) then
tmp = (x * -z) / t
else if ((z / t) <= (-1d-27)) then
tmp = t_1
else if ((z / t) <= 1d-9) then
tmp = x
else if ((z / t) <= 50000000.0d0) then
tmp = t_1
else if ((z / t) <= 5d+238) 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 = (y * z) / t;
double tmp;
if ((z / t) <= -5e+120) {
tmp = t_1;
} else if ((z / t) <= -4e+28) {
tmp = (x * -z) / t;
} else if ((z / t) <= -1e-27) {
tmp = t_1;
} else if ((z / t) <= 1e-9) {
tmp = x;
} else if ((z / t) <= 50000000.0) {
tmp = t_1;
} else if ((z / t) <= 5e+238) {
tmp = (z / t) * -x;
} else {
tmp = z * (y / t);
}
return tmp;
}
def code(x, y, z, t): t_1 = (y * z) / t tmp = 0 if (z / t) <= -5e+120: tmp = t_1 elif (z / t) <= -4e+28: tmp = (x * -z) / t elif (z / t) <= -1e-27: tmp = t_1 elif (z / t) <= 1e-9: tmp = x elif (z / t) <= 50000000.0: tmp = t_1 elif (z / t) <= 5e+238: tmp = (z / t) * -x else: tmp = z * (y / t) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(y * z) / t) tmp = 0.0 if (Float64(z / t) <= -5e+120) tmp = t_1; elseif (Float64(z / t) <= -4e+28) tmp = Float64(Float64(x * Float64(-z)) / t); elseif (Float64(z / t) <= -1e-27) tmp = t_1; elseif (Float64(z / t) <= 1e-9) tmp = x; elseif (Float64(z / t) <= 50000000.0) tmp = t_1; elseif (Float64(z / t) <= 5e+238) 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 = (y * z) / t; tmp = 0.0; if ((z / t) <= -5e+120) tmp = t_1; elseif ((z / t) <= -4e+28) tmp = (x * -z) / t; elseif ((z / t) <= -1e-27) tmp = t_1; elseif ((z / t) <= 1e-9) tmp = x; elseif ((z / t) <= 50000000.0) tmp = t_1; elseif ((z / t) <= 5e+238) 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[(y * z), $MachinePrecision] / t), $MachinePrecision]}, If[LessEqual[N[(z / t), $MachinePrecision], -5e+120], t$95$1, If[LessEqual[N[(z / t), $MachinePrecision], -4e+28], N[(N[(x * (-z)), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[N[(z / t), $MachinePrecision], -1e-27], t$95$1, If[LessEqual[N[(z / t), $MachinePrecision], 1e-9], x, If[LessEqual[N[(z / t), $MachinePrecision], 50000000.0], t$95$1, If[LessEqual[N[(z / t), $MachinePrecision], 5e+238], N[(N[(z / t), $MachinePrecision] * (-x)), $MachinePrecision], N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y \cdot z}{t}\\
\mathbf{if}\;\frac{z}{t} \leq -5 \cdot 10^{+120}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\frac{z}{t} \leq -4 \cdot 10^{+28}:\\
\;\;\;\;\frac{x \cdot \left(-z\right)}{t}\\
\mathbf{elif}\;\frac{z}{t} \leq -1 \cdot 10^{-27}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\frac{z}{t} \leq 10^{-9}:\\
\;\;\;\;x\\
\mathbf{elif}\;\frac{z}{t} \leq 50000000:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\frac{z}{t} \leq 5 \cdot 10^{+238}:\\
\;\;\;\;\frac{z}{t} \cdot \left(-x\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \frac{y}{t}\\
\end{array}
\end{array}
if (/.f64 z t) < -5.00000000000000019e120 or -3.99999999999999983e28 < (/.f64 z t) < -1e-27 or 1.00000000000000006e-9 < (/.f64 z t) < 5e7Initial program 93.6%
clear-num93.5%
un-div-inv93.6%
Applied egg-rr93.6%
Taylor expanded in t around 0 98.2%
Taylor expanded in t around 0 87.6%
Taylor expanded in y around inf 63.2%
*-commutative63.2%
Simplified63.2%
if -5.00000000000000019e120 < (/.f64 z t) < -3.99999999999999983e28Initial program 99.6%
clear-num99.4%
un-div-inv99.7%
Applied egg-rr99.7%
Taylor expanded in t around 0 99.8%
Taylor expanded in t around 0 99.8%
Taylor expanded in y around 0 66.0%
mul-1-neg66.0%
distribute-rgt-neg-in66.0%
Simplified66.0%
if -1e-27 < (/.f64 z t) < 1.00000000000000006e-9Initial program 98.6%
Taylor expanded in z around 0 79.6%
if 5e7 < (/.f64 z t) < 4.99999999999999995e238Initial program 99.6%
clear-num99.5%
un-div-inv99.5%
Applied egg-rr99.5%
Taylor expanded in t around 0 92.5%
Taylor expanded in t around 0 92.5%
Taylor expanded in y around 0 55.2%
associate-*l/59.7%
associate-*r*59.7%
mul-1-neg59.7%
Simplified59.7%
if 4.99999999999999995e238 < (/.f64 z t) Initial program 92.1%
clear-num92.0%
un-div-inv92.2%
Applied egg-rr92.2%
Taylor expanded in t around 0 99.7%
Taylor expanded in t around 0 99.7%
Taylor expanded in y around inf 70.4%
associate-*l/70.6%
*-commutative70.6%
Simplified70.6%
Final simplification71.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ (* y z) t)))
(if (<= (/ z t) -1e-27)
t_1
(if (<= (/ z t) 1e-9)
x
(if (<= (/ z t) 50000000.0)
t_1
(if (<= (/ z t) 5e+238) (* (/ z t) (- x)) (* z (/ y t))))))))
double code(double x, double y, double z, double t) {
double t_1 = (y * z) / t;
double tmp;
if ((z / t) <= -1e-27) {
tmp = t_1;
} else if ((z / t) <= 1e-9) {
tmp = x;
} else if ((z / t) <= 50000000.0) {
tmp = t_1;
} else if ((z / t) <= 5e+238) {
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 = (y * z) / t
if ((z / t) <= (-1d-27)) then
tmp = t_1
else if ((z / t) <= 1d-9) then
tmp = x
else if ((z / t) <= 50000000.0d0) then
tmp = t_1
else if ((z / t) <= 5d+238) 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 = (y * z) / t;
double tmp;
if ((z / t) <= -1e-27) {
tmp = t_1;
} else if ((z / t) <= 1e-9) {
tmp = x;
} else if ((z / t) <= 50000000.0) {
tmp = t_1;
} else if ((z / t) <= 5e+238) {
tmp = (z / t) * -x;
} else {
tmp = z * (y / t);
}
return tmp;
}
def code(x, y, z, t): t_1 = (y * z) / t tmp = 0 if (z / t) <= -1e-27: tmp = t_1 elif (z / t) <= 1e-9: tmp = x elif (z / t) <= 50000000.0: tmp = t_1 elif (z / t) <= 5e+238: tmp = (z / t) * -x else: tmp = z * (y / t) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(y * z) / t) tmp = 0.0 if (Float64(z / t) <= -1e-27) tmp = t_1; elseif (Float64(z / t) <= 1e-9) tmp = x; elseif (Float64(z / t) <= 50000000.0) tmp = t_1; elseif (Float64(z / t) <= 5e+238) 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 = (y * z) / t; tmp = 0.0; if ((z / t) <= -1e-27) tmp = t_1; elseif ((z / t) <= 1e-9) tmp = x; elseif ((z / t) <= 50000000.0) tmp = t_1; elseif ((z / t) <= 5e+238) 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[(y * z), $MachinePrecision] / t), $MachinePrecision]}, If[LessEqual[N[(z / t), $MachinePrecision], -1e-27], t$95$1, If[LessEqual[N[(z / t), $MachinePrecision], 1e-9], x, If[LessEqual[N[(z / t), $MachinePrecision], 50000000.0], t$95$1, If[LessEqual[N[(z / t), $MachinePrecision], 5e+238], N[(N[(z / t), $MachinePrecision] * (-x)), $MachinePrecision], N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y \cdot z}{t}\\
\mathbf{if}\;\frac{z}{t} \leq -1 \cdot 10^{-27}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\frac{z}{t} \leq 10^{-9}:\\
\;\;\;\;x\\
\mathbf{elif}\;\frac{z}{t} \leq 50000000:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\frac{z}{t} \leq 5 \cdot 10^{+238}:\\
\;\;\;\;\frac{z}{t} \cdot \left(-x\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \frac{y}{t}\\
\end{array}
\end{array}
if (/.f64 z t) < -1e-27 or 1.00000000000000006e-9 < (/.f64 z t) < 5e7Initial program 94.9%
clear-num94.8%
un-div-inv94.9%
Applied egg-rr94.9%
Taylor expanded in t around 0 98.6%
Taylor expanded in t around 0 90.3%
Taylor expanded in y around inf 57.3%
*-commutative57.3%
Simplified57.3%
if -1e-27 < (/.f64 z t) < 1.00000000000000006e-9Initial program 98.6%
Taylor expanded in z around 0 79.6%
if 5e7 < (/.f64 z t) < 4.99999999999999995e238Initial program 99.6%
clear-num99.5%
un-div-inv99.5%
Applied egg-rr99.5%
Taylor expanded in t around 0 92.5%
Taylor expanded in t around 0 92.5%
Taylor expanded in y around 0 55.2%
associate-*l/59.7%
associate-*r*59.7%
mul-1-neg59.7%
Simplified59.7%
if 4.99999999999999995e238 < (/.f64 z t) Initial program 92.1%
clear-num92.0%
un-div-inv92.2%
Applied egg-rr92.2%
Taylor expanded in t around 0 99.7%
Taylor expanded in t around 0 99.7%
Taylor expanded in y around inf 70.4%
associate-*l/70.6%
*-commutative70.6%
Simplified70.6%
Final simplification69.1%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ z t) -4e+28) (not (<= (/ z t) 0.0005))) (/ (* (- y x) z) t) (+ x (* y (/ z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (((z / t) <= -4e+28) || !((z / t) <= 0.0005)) {
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) <= (-4d+28)) .or. (.not. ((z / t) <= 0.0005d0))) 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) <= -4e+28) || !((z / t) <= 0.0005)) {
tmp = ((y - x) * z) / t;
} else {
tmp = x + (y * (z / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((z / t) <= -4e+28) or not ((z / t) <= 0.0005): 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) <= -4e+28) || !(Float64(z / t) <= 0.0005)) 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) <= -4e+28) || ~(((z / t) <= 0.0005))) 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], -4e+28], N[Not[LessEqual[N[(z / t), $MachinePrecision], 0.0005]], $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 -4 \cdot 10^{+28} \lor \neg \left(\frac{z}{t} \leq 0.0005\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) < -3.99999999999999983e28 or 5.0000000000000001e-4 < (/.f64 z t) Initial program 95.3%
clear-num95.1%
un-div-inv95.2%
Applied egg-rr95.2%
Taylor expanded in t around 0 97.5%
Taylor expanded in t around 0 97.2%
if -3.99999999999999983e28 < (/.f64 z t) < 5.0000000000000001e-4Initial program 98.7%
Taylor expanded in y around inf 91.7%
associate-*r/95.5%
Simplified95.5%
Final simplification96.3%
(FPCore (x y z t) :precision binary64 (if (<= z -1.5e+223) (* z (/ (- x) t)) (if (or (<= z -2.8e+66) (not (<= z 9e-24))) (* z (/ y t)) x)))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.5e+223) {
tmp = z * (-x / t);
} else if ((z <= -2.8e+66) || !(z <= 9e-24)) {
tmp = z * (y / t);
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= (-1.5d+223)) then
tmp = z * (-x / t)
else if ((z <= (-2.8d+66)) .or. (.not. (z <= 9d-24))) then
tmp = z * (y / t)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.5e+223) {
tmp = z * (-x / t);
} else if ((z <= -2.8e+66) || !(z <= 9e-24)) {
tmp = z * (y / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.5e+223: tmp = z * (-x / t) elif (z <= -2.8e+66) or not (z <= 9e-24): tmp = z * (y / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.5e+223) tmp = Float64(z * Float64(Float64(-x) / t)); elseif ((z <= -2.8e+66) || !(z <= 9e-24)) tmp = Float64(z * Float64(y / t)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -1.5e+223) tmp = z * (-x / t); elseif ((z <= -2.8e+66) || ~((z <= 9e-24))) tmp = z * (y / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.5e+223], N[(z * N[((-x) / t), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[z, -2.8e+66], N[Not[LessEqual[z, 9e-24]], $MachinePrecision]], N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.5 \cdot 10^{+223}:\\
\;\;\;\;z \cdot \frac{-x}{t}\\
\mathbf{elif}\;z \leq -2.8 \cdot 10^{+66} \lor \neg \left(z \leq 9 \cdot 10^{-24}\right):\\
\;\;\;\;z \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -1.50000000000000001e223Initial program 99.9%
clear-num99.6%
un-div-inv99.6%
Applied egg-rr99.6%
Taylor expanded in t around 0 84.1%
Taylor expanded in t around 0 84.1%
Taylor expanded in y around 0 67.7%
mul-1-neg67.7%
associate-*r/82.4%
distribute-rgt-neg-in82.4%
distribute-neg-frac82.4%
Simplified82.4%
if -1.50000000000000001e223 < z < -2.8000000000000001e66 or 8.9999999999999995e-24 < z Initial program 94.0%
clear-num93.9%
un-div-inv93.9%
Applied egg-rr93.9%
Taylor expanded in t around 0 91.0%
Taylor expanded in t around 0 84.5%
Taylor expanded in y around inf 59.4%
associate-*l/62.4%
*-commutative62.4%
Simplified62.4%
if -2.8000000000000001e66 < z < 8.9999999999999995e-24Initial program 98.8%
Taylor expanded in z around 0 59.8%
Final simplification61.8%
(FPCore (x y z t) :precision binary64 (if (or (<= x -4.1e-40) (not (<= x 4.8e-57))) (- x (* x (/ z t))) (+ x (/ (* y z) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -4.1e-40) || !(x <= 4.8e-57)) {
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 <= (-4.1d-40)) .or. (.not. (x <= 4.8d-57))) 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 <= -4.1e-40) || !(x <= 4.8e-57)) {
tmp = x - (x * (z / t));
} else {
tmp = x + ((y * z) / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -4.1e-40) or not (x <= 4.8e-57): tmp = x - (x * (z / t)) else: tmp = x + ((y * z) / t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -4.1e-40) || !(x <= 4.8e-57)) tmp = Float64(x - Float64(x * Float64(z / t))); else tmp = Float64(x + Float64(Float64(y * z) / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -4.1e-40) || ~((x <= 4.8e-57))) 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, -4.1e-40], N[Not[LessEqual[x, 4.8e-57]], $MachinePrecision]], N[(x - N[(x * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.1 \cdot 10^{-40} \lor \neg \left(x \leq 4.8 \cdot 10^{-57}\right):\\
\;\;\;\;x - x \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y \cdot z}{t}\\
\end{array}
\end{array}
if x < -4.09999999999999963e-40 or 4.80000000000000012e-57 < x Initial program 99.9%
Taylor expanded in x around inf 87.5%
*-commutative87.5%
mul-1-neg87.5%
unsub-neg87.5%
distribute-lft-out--87.5%
*-rgt-identity87.5%
Simplified87.5%
if -4.09999999999999963e-40 < x < 4.80000000000000012e-57Initial program 93.6%
Taylor expanded in y around inf 91.5%
Final simplification89.3%
(FPCore (x y z t) :precision binary64 (if (<= x -4.8e-40) (- x (/ x (/ t z))) (if (<= x 2.2e-55) (+ x (/ (* y z) t)) (- x (* x (/ z t))))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -4.8e-40) {
tmp = x - (x / (t / z));
} else if (x <= 2.2e-55) {
tmp = x + ((y * z) / t);
} else {
tmp = x - (x * (z / t));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (x <= (-4.8d-40)) then
tmp = x - (x / (t / z))
else if (x <= 2.2d-55) then
tmp = x + ((y * z) / t)
else
tmp = x - (x * (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-40) {
tmp = x - (x / (t / z));
} else if (x <= 2.2e-55) {
tmp = x + ((y * z) / t);
} else {
tmp = x - (x * (z / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -4.8e-40: tmp = x - (x / (t / z)) elif x <= 2.2e-55: tmp = x + ((y * z) / t) else: tmp = x - (x * (z / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -4.8e-40) tmp = Float64(x - Float64(x / Float64(t / z))); elseif (x <= 2.2e-55) tmp = Float64(x + Float64(Float64(y * z) / t)); else tmp = Float64(x - Float64(x * Float64(z / t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -4.8e-40) tmp = x - (x / (t / z)); elseif (x <= 2.2e-55) tmp = x + ((y * z) / t); else tmp = x - (x * (z / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -4.8e-40], N[(x - N[(x / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2.2e-55], N[(x + N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], N[(x - N[(x * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.8 \cdot 10^{-40}:\\
\;\;\;\;x - \frac{x}{\frac{t}{z}}\\
\mathbf{elif}\;x \leq 2.2 \cdot 10^{-55}:\\
\;\;\;\;x + \frac{y \cdot z}{t}\\
\mathbf{else}:\\
\;\;\;\;x - x \cdot \frac{z}{t}\\
\end{array}
\end{array}
if x < -4.79999999999999982e-40Initial program 99.8%
Taylor expanded in x around inf 85.9%
*-commutative85.9%
mul-1-neg85.9%
unsub-neg85.9%
distribute-lft-out--85.9%
*-rgt-identity85.9%
Simplified85.9%
clear-num85.9%
div-inv85.9%
Applied egg-rr85.9%
if -4.79999999999999982e-40 < x < 2.2e-55Initial program 93.6%
Taylor expanded in y around inf 91.5%
if 2.2e-55 < x Initial program 99.9%
Taylor expanded in x around inf 89.5%
*-commutative89.5%
mul-1-neg89.5%
unsub-neg89.5%
distribute-lft-out--89.5%
*-rgt-identity89.5%
Simplified89.5%
Final simplification89.3%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.75e+65) (not (<= z 4.5e-20))) (* z (/ y t)) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.75e+65) || !(z <= 4.5e-20)) {
tmp = z * (y / t);
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((z <= (-1.75d+65)) .or. (.not. (z <= 4.5d-20))) then
tmp = z * (y / t)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.75e+65) || !(z <= 4.5e-20)) {
tmp = z * (y / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.75e+65) or not (z <= 4.5e-20): tmp = z * (y / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.75e+65) || !(z <= 4.5e-20)) tmp = Float64(z * Float64(y / t)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -1.75e+65) || ~((z <= 4.5e-20))) tmp = z * (y / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.75e+65], N[Not[LessEqual[z, 4.5e-20]], $MachinePrecision]], N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.75 \cdot 10^{+65} \lor \neg \left(z \leq 4.5 \cdot 10^{-20}\right):\\
\;\;\;\;z \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -1.75e65 or 4.5000000000000001e-20 < z Initial program 94.6%
clear-num94.5%
un-div-inv94.6%
Applied egg-rr94.6%
Taylor expanded in t around 0 90.2%
Taylor expanded in t around 0 84.5%
Taylor expanded in y around inf 54.9%
associate-*l/57.5%
*-commutative57.5%
Simplified57.5%
if -1.75e65 < z < 4.5000000000000001e-20Initial program 98.8%
Taylor expanded in z around 0 59.8%
Final simplification58.9%
(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.1%
Final simplification97.1%
(FPCore (x y z t) :precision binary64 (+ x (* y (/ z t))))
double code(double x, double y, double z, double t) {
return x + (y * (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 * (z / t))
end function
public static double code(double x, double y, double z, double t) {
return x + (y * (z / t));
}
def code(x, y, z, t): return x + (y * (z / t))
function code(x, y, z, t) return Float64(x + Float64(y * Float64(z / t))) end
function tmp = code(x, y, z, t) tmp = x + (y * (z / t)); end
code[x_, y_, z_, t_] := N[(x + N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + y \cdot \frac{z}{t}
\end{array}
Initial program 97.1%
Taylor expanded in y around inf 74.9%
associate-*r/76.3%
Simplified76.3%
Final simplification76.3%
(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.1%
Taylor expanded in z around 0 39.0%
Final simplification39.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 2023268
(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))))