
(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(Float64(y - x) * 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[(N[(y - x), $MachinePrecision] * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{\left(y - x\right) \cdot 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(Float64(y - x) * 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[(N[(y - x), $MachinePrecision] * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{\left(y - x\right) \cdot 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 92.7%
+-commutative92.7%
associate-/l*99.2%
fma-define99.2%
Simplified99.2%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* y (/ z t))))
(if (<= z -1.85e+50)
t_1
(if (<= z 1.05e+52) x (if (<= z 2.75e+196) 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 <= -1.85e+50) {
tmp = t_1;
} else if (z <= 1.05e+52) {
tmp = x;
} else if (z <= 2.75e+196) {
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 <= (-1.85d+50)) then
tmp = t_1
else if (z <= 1.05d+52) then
tmp = x
else if (z <= 2.75d+196) 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 <= -1.85e+50) {
tmp = t_1;
} else if (z <= 1.05e+52) {
tmp = x;
} else if (z <= 2.75e+196) {
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 <= -1.85e+50: tmp = t_1 elif z <= 1.05e+52: tmp = x elif z <= 2.75e+196: 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 (z <= -1.85e+50) tmp = t_1; elseif (z <= 1.05e+52) tmp = x; elseif (z <= 2.75e+196) tmp = t_1; else tmp = Float64(x * Float64(z / Float64(-t))); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = y * (z / t); tmp = 0.0; if (z <= -1.85e+50) tmp = t_1; elseif (z <= 1.05e+52) tmp = x; elseif (z <= 2.75e+196) 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[z, -1.85e+50], t$95$1, If[LessEqual[z, 1.05e+52], x, If[LessEqual[z, 2.75e+196], 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}\;z \leq -1.85 \cdot 10^{+50}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.05 \cdot 10^{+52}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 2.75 \cdot 10^{+196}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{z}{-t}\\
\end{array}
\end{array}
if z < -1.85e50 or 1.05e52 < z < 2.74999999999999987e196Initial program 82.6%
+-commutative82.6%
associate-/l*98.8%
fma-define98.8%
Simplified98.8%
Taylor expanded in z around inf 85.7%
Taylor expanded in y around inf 60.0%
associate-*r/52.1%
*-commutative52.1%
associate-/l*63.5%
Applied egg-rr63.5%
if -1.85e50 < z < 1.05e52Initial program 97.8%
+-commutative97.8%
associate-/l*99.3%
fma-define99.3%
Simplified99.3%
Taylor expanded in z around 0 65.3%
if 2.74999999999999987e196 < z Initial program 95.7%
+-commutative95.7%
associate-/l*99.8%
fma-define99.8%
Simplified99.8%
Taylor expanded in z around inf 99.9%
Taylor expanded in y around 0 72.0%
mul-1-neg72.0%
distribute-frac-neg272.0%
Simplified72.0%
*-commutative72.0%
associate-/r/76.3%
frac-2neg76.3%
div-inv80.6%
distribute-neg-frac80.6%
add-sqr-sqrt32.8%
sqrt-unprod33.5%
sqr-neg33.5%
sqrt-unprod0.7%
add-sqr-sqrt0.8%
clear-num0.8%
add-sqr-sqrt0.1%
sqrt-unprod43.4%
sqr-neg43.4%
sqrt-unprod47.7%
add-sqr-sqrt80.6%
Applied egg-rr80.6%
Final simplification66.1%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* y (/ z t))))
(if (<= z -1.9e+46)
t_1
(if (<= z 3.2e+53) x (if (<= z 2.25e+199) t_1 (* z (/ x (- t))))))))
double code(double x, double y, double z, double t) {
double t_1 = y * (z / t);
double tmp;
if (z <= -1.9e+46) {
tmp = t_1;
} else if (z <= 3.2e+53) {
tmp = x;
} else if (z <= 2.25e+199) {
tmp = t_1;
} 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 = y * (z / t)
if (z <= (-1.9d+46)) then
tmp = t_1
else if (z <= 3.2d+53) then
tmp = x
else if (z <= 2.25d+199) then
tmp = t_1
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 = y * (z / t);
double tmp;
if (z <= -1.9e+46) {
tmp = t_1;
} else if (z <= 3.2e+53) {
tmp = x;
} else if (z <= 2.25e+199) {
tmp = t_1;
} else {
tmp = z * (x / -t);
}
return tmp;
}
def code(x, y, z, t): t_1 = y * (z / t) tmp = 0 if z <= -1.9e+46: tmp = t_1 elif z <= 3.2e+53: tmp = x elif z <= 2.25e+199: tmp = t_1 else: tmp = z * (x / -t) return tmp
function code(x, y, z, t) t_1 = Float64(y * Float64(z / t)) tmp = 0.0 if (z <= -1.9e+46) tmp = t_1; elseif (z <= 3.2e+53) tmp = x; elseif (z <= 2.25e+199) tmp = t_1; else tmp = Float64(z * Float64(x / Float64(-t))); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = y * (z / t); tmp = 0.0; if (z <= -1.9e+46) tmp = t_1; elseif (z <= 3.2e+53) tmp = x; elseif (z <= 2.25e+199) tmp = t_1; else tmp = z * (x / -t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.9e+46], t$95$1, If[LessEqual[z, 3.2e+53], x, If[LessEqual[z, 2.25e+199], t$95$1, N[(z * N[(x / (-t)), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \frac{z}{t}\\
\mathbf{if}\;z \leq -1.9 \cdot 10^{+46}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 3.2 \cdot 10^{+53}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 2.25 \cdot 10^{+199}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;z \cdot \frac{x}{-t}\\
\end{array}
\end{array}
if z < -1.9e46 or 3.2e53 < z < 2.2499999999999998e199Initial program 82.6%
+-commutative82.6%
associate-/l*98.8%
fma-define98.8%
Simplified98.8%
Taylor expanded in z around inf 85.7%
Taylor expanded in y around inf 60.0%
associate-*r/52.1%
*-commutative52.1%
associate-/l*63.5%
Applied egg-rr63.5%
if -1.9e46 < z < 3.2e53Initial program 97.8%
+-commutative97.8%
associate-/l*99.3%
fma-define99.3%
Simplified99.3%
Taylor expanded in z around 0 65.3%
if 2.2499999999999998e199 < z Initial program 95.7%
+-commutative95.7%
associate-/l*99.8%
fma-define99.8%
Simplified99.8%
Taylor expanded in z around inf 99.9%
Taylor expanded in y around 0 72.0%
mul-1-neg72.0%
distribute-frac-neg272.0%
Simplified72.0%
(FPCore (x y z t) :precision binary64 (if (or (<= x -1.65e+27) (not (<= x 4e+67))) (* x (- 1.0 (/ z t))) (+ x (* y (/ z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.65e+27) || !(x <= 4e+67)) {
tmp = x * (1.0 - (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 <= (-1.65d+27)) .or. (.not. (x <= 4d+67))) then
tmp = x * (1.0d0 - (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 <= -1.65e+27) || !(x <= 4e+67)) {
tmp = x * (1.0 - (z / t));
} else {
tmp = x + (y * (z / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -1.65e+27) or not (x <= 4e+67): tmp = x * (1.0 - (z / t)) else: tmp = x + (y * (z / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -1.65e+27) || !(x <= 4e+67)) tmp = Float64(x * Float64(1.0 - Float64(z / t))); else tmp = Float64(x + Float64(y * Float64(z / t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -1.65e+27) || ~((x <= 4e+67))) tmp = x * (1.0 - (z / t)); else tmp = x + (y * (z / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -1.65e+27], N[Not[LessEqual[x, 4e+67]], $MachinePrecision]], N[(x * N[(1.0 - N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.65 \cdot 10^{+27} \lor \neg \left(x \leq 4 \cdot 10^{+67}\right):\\
\;\;\;\;x \cdot \left(1 - \frac{z}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\end{array}
\end{array}
if x < -1.6499999999999999e27 or 3.99999999999999993e67 < x Initial program 92.2%
+-commutative92.2%
associate-/l*100.0%
fma-define100.0%
Simplified100.0%
Taylor expanded in y around 0 85.4%
*-rgt-identity85.4%
mul-1-neg85.4%
associate-/l*93.0%
distribute-rgt-neg-in93.0%
mul-1-neg93.0%
distribute-lft-in93.0%
mul-1-neg93.0%
unsub-neg93.0%
Simplified93.0%
if -1.6499999999999999e27 < x < 3.99999999999999993e67Initial program 93.1%
Taylor expanded in y around inf 83.8%
*-commutative83.8%
associate-/l*89.0%
Simplified89.0%
+-commutative89.0%
associate-*r/83.8%
div-inv83.8%
*-commutative83.8%
associate-*l*89.1%
div-inv89.1%
Applied egg-rr89.1%
Final simplification90.9%
(FPCore (x y z t) :precision binary64 (if (or (<= x -4.8e+27) (not (<= x 9.5e+62))) (* x (- 1.0 (/ z t))) (+ x (* z (/ y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -4.8e+27) || !(x <= 9.5e+62)) {
tmp = x * (1.0 - (z / t));
} else {
tmp = x + (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) :: tmp
if ((x <= (-4.8d+27)) .or. (.not. (x <= 9.5d+62))) then
tmp = x * (1.0d0 - (z / t))
else
tmp = x + (z * (y / 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+27) || !(x <= 9.5e+62)) {
tmp = x * (1.0 - (z / t));
} else {
tmp = x + (z * (y / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -4.8e+27) or not (x <= 9.5e+62): tmp = x * (1.0 - (z / t)) else: tmp = x + (z * (y / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -4.8e+27) || !(x <= 9.5e+62)) tmp = Float64(x * Float64(1.0 - Float64(z / t))); else tmp = Float64(x + Float64(z * Float64(y / t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -4.8e+27) || ~((x <= 9.5e+62))) tmp = x * (1.0 - (z / t)); else tmp = x + (z * (y / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -4.8e+27], N[Not[LessEqual[x, 9.5e+62]], $MachinePrecision]], N[(x * N[(1.0 - N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.8 \cdot 10^{+27} \lor \neg \left(x \leq 9.5 \cdot 10^{+62}\right):\\
\;\;\;\;x \cdot \left(1 - \frac{z}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \frac{y}{t}\\
\end{array}
\end{array}
if x < -4.79999999999999995e27 or 9.5000000000000003e62 < x Initial program 92.2%
+-commutative92.2%
associate-/l*100.0%
fma-define100.0%
Simplified100.0%
Taylor expanded in y around 0 85.4%
*-rgt-identity85.4%
mul-1-neg85.4%
associate-/l*93.0%
distribute-rgt-neg-in93.0%
mul-1-neg93.0%
distribute-lft-in93.0%
mul-1-neg93.0%
unsub-neg93.0%
Simplified93.0%
if -4.79999999999999995e27 < x < 9.5000000000000003e62Initial program 93.1%
Taylor expanded in y around inf 83.8%
*-commutative83.8%
associate-/l*89.0%
Simplified89.0%
Final simplification90.8%
(FPCore (x y z t) :precision binary64 (if (or (<= z -8e+23) (not (<= z 1.55e+71))) (* z (/ (- y x) t)) (* x (- 1.0 (/ z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -8e+23) || !(z <= 1.55e+71)) {
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 <= (-8d+23)) .or. (.not. (z <= 1.55d+71))) 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 <= -8e+23) || !(z <= 1.55e+71)) {
tmp = z * ((y - x) / t);
} else {
tmp = x * (1.0 - (z / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -8e+23) or not (z <= 1.55e+71): tmp = z * ((y - x) / t) else: tmp = x * (1.0 - (z / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -8e+23) || !(z <= 1.55e+71)) 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 <= -8e+23) || ~((z <= 1.55e+71))) 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[z, -8e+23], N[Not[LessEqual[z, 1.55e+71]], $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}\;z \leq -8 \cdot 10^{+23} \lor \neg \left(z \leq 1.55 \cdot 10^{+71}\right):\\
\;\;\;\;z \cdot \frac{y - x}{t}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - \frac{z}{t}\right)\\
\end{array}
\end{array}
if z < -7.9999999999999993e23 or 1.55000000000000009e71 < z Initial program 85.4%
+-commutative85.4%
associate-/l*99.0%
fma-define99.0%
Simplified99.0%
Taylor expanded in z around inf 86.8%
Taylor expanded in t around 0 88.7%
if -7.9999999999999993e23 < z < 1.55000000000000009e71Initial program 97.8%
+-commutative97.8%
associate-/l*99.3%
fma-define99.3%
Simplified99.3%
Taylor expanded in y around 0 75.1%
*-rgt-identity75.1%
mul-1-neg75.1%
associate-/l*76.5%
distribute-rgt-neg-in76.5%
mul-1-neg76.5%
distribute-lft-in76.5%
mul-1-neg76.5%
unsub-neg76.5%
Simplified76.5%
Final simplification81.5%
(FPCore (x y z t) :precision binary64 (if (<= y -9.5e+134) (* y (/ z t)) (if (<= y 1.48e+68) (* x (- 1.0 (/ z t))) (* z (/ y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -9.5e+134) {
tmp = y * (z / t);
} else if (y <= 1.48e+68) {
tmp = x * (1.0 - (z / t));
} 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) :: tmp
if (y <= (-9.5d+134)) then
tmp = y * (z / t)
else if (y <= 1.48d+68) then
tmp = x * (1.0d0 - (z / t))
else
tmp = z * (y / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -9.5e+134) {
tmp = y * (z / t);
} else if (y <= 1.48e+68) {
tmp = x * (1.0 - (z / t));
} else {
tmp = z * (y / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -9.5e+134: tmp = y * (z / t) elif y <= 1.48e+68: tmp = x * (1.0 - (z / t)) else: tmp = z * (y / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -9.5e+134) tmp = Float64(y * Float64(z / t)); elseif (y <= 1.48e+68) tmp = Float64(x * Float64(1.0 - Float64(z / t))); else tmp = Float64(z * Float64(y / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -9.5e+134) tmp = y * (z / t); elseif (y <= 1.48e+68) tmp = x * (1.0 - (z / t)); else tmp = z * (y / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -9.5e+134], N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.48e+68], N[(x * N[(1.0 - N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -9.5 \cdot 10^{+134}:\\
\;\;\;\;y \cdot \frac{z}{t}\\
\mathbf{elif}\;y \leq 1.48 \cdot 10^{+68}:\\
\;\;\;\;x \cdot \left(1 - \frac{z}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \frac{y}{t}\\
\end{array}
\end{array}
if y < -9.5000000000000004e134Initial program 81.5%
+-commutative81.5%
associate-/l*99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in z around inf 71.6%
Taylor expanded in y around inf 70.4%
associate-*r/62.6%
*-commutative62.6%
associate-/l*75.7%
Applied egg-rr75.7%
if -9.5000000000000004e134 < y < 1.4799999999999999e68Initial program 95.7%
+-commutative95.7%
associate-/l*99.4%
fma-define99.4%
Simplified99.4%
Taylor expanded in y around 0 79.0%
*-rgt-identity79.0%
mul-1-neg79.0%
associate-/l*83.3%
distribute-rgt-neg-in83.3%
mul-1-neg83.3%
distribute-lft-in83.3%
mul-1-neg83.3%
unsub-neg83.3%
Simplified83.3%
if 1.4799999999999999e68 < y Initial program 90.8%
+-commutative90.8%
associate-/l*98.1%
fma-define98.1%
Simplified98.1%
Taylor expanded in z around inf 71.2%
Taylor expanded in y around inf 67.4%
(FPCore (x y z t) :precision binary64 (if (or (<= z -3.2e+48) (not (<= z 9.6e+53))) (* y (/ z t)) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -3.2e+48) || !(z <= 9.6e+53)) {
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 <= (-3.2d+48)) .or. (.not. (z <= 9.6d+53))) 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 <= -3.2e+48) || !(z <= 9.6e+53)) {
tmp = y * (z / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -3.2e+48) or not (z <= 9.6e+53): tmp = y * (z / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -3.2e+48) || !(z <= 9.6e+53)) 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 <= -3.2e+48) || ~((z <= 9.6e+53))) tmp = y * (z / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -3.2e+48], N[Not[LessEqual[z, 9.6e+53]], $MachinePrecision]], N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.2 \cdot 10^{+48} \lor \neg \left(z \leq 9.6 \cdot 10^{+53}\right):\\
\;\;\;\;y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -3.2000000000000001e48 or 9.5999999999999999e53 < z Initial program 85.3%
+-commutative85.3%
associate-/l*99.0%
fma-define99.0%
Simplified99.0%
Taylor expanded in z around inf 88.7%
Taylor expanded in y around inf 53.4%
associate-*r/46.4%
*-commutative46.4%
associate-/l*56.2%
Applied egg-rr56.2%
if -3.2000000000000001e48 < z < 9.5999999999999999e53Initial program 97.8%
+-commutative97.8%
associate-/l*99.3%
fma-define99.3%
Simplified99.3%
Taylor expanded in z around 0 65.3%
Final simplification61.6%
(FPCore (x y z t) :precision binary64 (if (<= t -9.5e+116) (+ x (* y (/ z t))) (+ x (/ (* (- y x) z) t))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -9.5e+116) {
tmp = x + (y * (z / t));
} else {
tmp = x + (((y - 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 (t <= (-9.5d+116)) then
tmp = x + (y * (z / t))
else
tmp = x + (((y - x) * z) / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= -9.5e+116) {
tmp = x + (y * (z / t));
} else {
tmp = x + (((y - x) * z) / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -9.5e+116: tmp = x + (y * (z / t)) else: tmp = x + (((y - x) * z) / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -9.5e+116) tmp = Float64(x + Float64(y * Float64(z / t))); else tmp = Float64(x + Float64(Float64(Float64(y - x) * z) / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -9.5e+116) tmp = x + (y * (z / t)); else tmp = x + (((y - x) * z) / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -9.5e+116], N[(x + N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -9.5 \cdot 10^{+116}:\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{\left(y - x\right) \cdot z}{t}\\
\end{array}
\end{array}
if t < -9.5000000000000004e116Initial program 77.1%
Taylor expanded in y around inf 79.2%
*-commutative79.2%
associate-/l*95.7%
Simplified95.7%
+-commutative95.7%
associate-*r/79.2%
div-inv79.2%
*-commutative79.2%
associate-*l*97.7%
div-inv97.7%
Applied egg-rr97.7%
if -9.5000000000000004e116 < t Initial program 96.1%
Final simplification96.4%
(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 92.7%
+-commutative92.7%
associate-/l*99.2%
fma-define99.2%
Simplified99.2%
fma-undefine99.2%
Applied egg-rr99.2%
Final simplification99.2%
(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 92.7%
associate-/l*99.2%
clear-num99.1%
un-div-inv99.1%
Applied egg-rr99.1%
(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 92.7%
+-commutative92.7%
associate-/l*99.2%
fma-define99.2%
Simplified99.2%
Taylor expanded in z around 0 43.0%
(FPCore (x y z t)
:precision binary64
(if (< x -9.025511195533005e-135)
(- x (* (/ z t) (- x y)))
(if (< x 4.275032163700715e-250)
(+ x (* (/ (- y x) t) z))
(+ x (/ (- y x) (/ t z))))))
double code(double x, double y, double z, double t) {
double tmp;
if (x < -9.025511195533005e-135) {
tmp = x - ((z / t) * (x - y));
} else if (x < 4.275032163700715e-250) {
tmp = x + (((y - x) / t) * z);
} else {
tmp = x + ((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 (x < (-9.025511195533005d-135)) then
tmp = x - ((z / t) * (x - y))
else if (x < 4.275032163700715d-250) then
tmp = x + (((y - x) / t) * z)
else
tmp = x + ((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 (x < -9.025511195533005e-135) {
tmp = x - ((z / t) * (x - y));
} else if (x < 4.275032163700715e-250) {
tmp = x + (((y - x) / t) * z);
} else {
tmp = x + ((y - x) / (t / z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x < -9.025511195533005e-135: tmp = x - ((z / t) * (x - y)) elif x < 4.275032163700715e-250: tmp = x + (((y - x) / t) * z) else: tmp = x + ((y - x) / (t / z)) return tmp
function code(x, y, z, t) tmp = 0.0 if (x < -9.025511195533005e-135) tmp = Float64(x - Float64(Float64(z / t) * Float64(x - y))); elseif (x < 4.275032163700715e-250) tmp = Float64(x + Float64(Float64(Float64(y - x) / t) * z)); else tmp = Float64(x + Float64(Float64(y - x) / Float64(t / z))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x < -9.025511195533005e-135) tmp = x - ((z / t) * (x - y)); elseif (x < 4.275032163700715e-250) tmp = x + (((y - x) / t) * z); else tmp = x + ((y - x) / (t / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Less[x, -9.025511195533005e-135], N[(x - N[(N[(z / t), $MachinePrecision] * N[(x - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Less[x, 4.275032163700715e-250], N[(x + N[(N[(N[(y - x), $MachinePrecision] / t), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y - x), $MachinePrecision] / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x < -9.025511195533005 \cdot 10^{-135}:\\
\;\;\;\;x - \frac{z}{t} \cdot \left(x - y\right)\\
\mathbf{elif}\;x < 4.275032163700715 \cdot 10^{-250}:\\
\;\;\;\;x + \frac{y - x}{t} \cdot z\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y - x}{\frac{t}{z}}\\
\end{array}
\end{array}
herbie shell --seed 2024096
(FPCore (x y z t)
:name "Numeric.Histogram:binBounds from Chart-1.5.3"
:precision binary64
:alt
(if (< x -9.025511195533005e-135) (- x (* (/ z t) (- x y))) (if (< x 4.275032163700715e-250) (+ x (* (/ (- y x) t) z)) (+ x (/ (- y x) (/ t z)))))
(+ x (/ (* (- y x) z) t)))