
(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 89.8%
+-commutative89.8%
associate-/l*98.4%
fma-define98.4%
Simplified98.4%
Final simplification98.4%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (- 1.0 (/ z t)))))
(if (<= x -3.2e-45)
t_1
(if (<= x -1.9e-93)
(/ (* y z) t)
(if (or (<= x -8.8e-178)
(not
(or (<= x 1.55e-174)
(and (not (<= x 1.05e-106)) (<= x 236.0)))))
t_1
(* y (/ z t)))))))
double code(double x, double y, double z, double t) {
double t_1 = x * (1.0 - (z / t));
double tmp;
if (x <= -3.2e-45) {
tmp = t_1;
} else if (x <= -1.9e-93) {
tmp = (y * z) / t;
} else if ((x <= -8.8e-178) || !((x <= 1.55e-174) || (!(x <= 1.05e-106) && (x <= 236.0)))) {
tmp = t_1;
} else {
tmp = 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) :: t_1
real(8) :: tmp
t_1 = x * (1.0d0 - (z / t))
if (x <= (-3.2d-45)) then
tmp = t_1
else if (x <= (-1.9d-93)) then
tmp = (y * z) / t
else if ((x <= (-8.8d-178)) .or. (.not. (x <= 1.55d-174) .or. (.not. (x <= 1.05d-106)) .and. (x <= 236.0d0))) then
tmp = t_1
else
tmp = y * (z / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x * (1.0 - (z / t));
double tmp;
if (x <= -3.2e-45) {
tmp = t_1;
} else if (x <= -1.9e-93) {
tmp = (y * z) / t;
} else if ((x <= -8.8e-178) || !((x <= 1.55e-174) || (!(x <= 1.05e-106) && (x <= 236.0)))) {
tmp = t_1;
} else {
tmp = y * (z / t);
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (1.0 - (z / t)) tmp = 0 if x <= -3.2e-45: tmp = t_1 elif x <= -1.9e-93: tmp = (y * z) / t elif (x <= -8.8e-178) or not ((x <= 1.55e-174) or (not (x <= 1.05e-106) and (x <= 236.0))): tmp = t_1 else: tmp = y * (z / t) return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(1.0 - Float64(z / t))) tmp = 0.0 if (x <= -3.2e-45) tmp = t_1; elseif (x <= -1.9e-93) tmp = Float64(Float64(y * z) / t); elseif ((x <= -8.8e-178) || !((x <= 1.55e-174) || (!(x <= 1.05e-106) && (x <= 236.0)))) tmp = t_1; else tmp = Float64(y * Float64(z / t)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (1.0 - (z / t)); tmp = 0.0; if (x <= -3.2e-45) tmp = t_1; elseif (x <= -1.9e-93) tmp = (y * z) / t; elseif ((x <= -8.8e-178) || ~(((x <= 1.55e-174) || (~((x <= 1.05e-106)) && (x <= 236.0))))) tmp = t_1; else tmp = y * (z / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(1.0 - N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -3.2e-45], t$95$1, If[LessEqual[x, -1.9e-93], N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision], If[Or[LessEqual[x, -8.8e-178], N[Not[Or[LessEqual[x, 1.55e-174], And[N[Not[LessEqual[x, 1.05e-106]], $MachinePrecision], LessEqual[x, 236.0]]]], $MachinePrecision]], t$95$1, N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(1 - \frac{z}{t}\right)\\
\mathbf{if}\;x \leq -3.2 \cdot 10^{-45}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq -1.9 \cdot 10^{-93}:\\
\;\;\;\;\frac{y \cdot z}{t}\\
\mathbf{elif}\;x \leq -8.8 \cdot 10^{-178} \lor \neg \left(x \leq 1.55 \cdot 10^{-174} \lor \neg \left(x \leq 1.05 \cdot 10^{-106}\right) \land x \leq 236\right):\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{z}{t}\\
\end{array}
\end{array}
if x < -3.20000000000000007e-45 or -1.8999999999999999e-93 < x < -8.8000000000000005e-178 or 1.5499999999999999e-174 < x < 1.05000000000000002e-106 or 236 < x Initial program 90.5%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in x around inf 87.0%
mul-1-neg87.0%
unsub-neg87.0%
Simplified87.0%
if -3.20000000000000007e-45 < x < -1.8999999999999999e-93Initial program 99.6%
associate-/l*99.4%
Simplified99.4%
Taylor expanded in z around inf 75.7%
*-commutative75.7%
sub-div75.7%
associate-/r/87.6%
Applied egg-rr87.6%
Taylor expanded in y around inf 76.9%
if -8.8000000000000005e-178 < x < 1.5499999999999999e-174 or 1.05000000000000002e-106 < x < 236Initial program 87.3%
associate-/l*94.9%
Simplified94.9%
Taylor expanded in z around inf 76.1%
Taylor expanded in y around inf 67.8%
clear-num67.6%
un-div-inv68.4%
Applied egg-rr68.4%
associate-/r/72.4%
Applied egg-rr72.4%
Final simplification82.3%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (- 1.0 (/ z t)))))
(if (<= x -3.2e-45)
t_1
(if (<= x -3.5e-92)
(/ (* y z) t)
(if (<= x -8.2e-178)
(* x (/ (- t z) t))
(if (or (<= x 1.55e-174) (and (not (<= x 4e-110)) (<= x 220.0)))
(* y (/ z t))
t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = x * (1.0 - (z / t));
double tmp;
if (x <= -3.2e-45) {
tmp = t_1;
} else if (x <= -3.5e-92) {
tmp = (y * z) / t;
} else if (x <= -8.2e-178) {
tmp = x * ((t - z) / t);
} else if ((x <= 1.55e-174) || (!(x <= 4e-110) && (x <= 220.0))) {
tmp = y * (z / t);
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = x * (1.0d0 - (z / t))
if (x <= (-3.2d-45)) then
tmp = t_1
else if (x <= (-3.5d-92)) then
tmp = (y * z) / t
else if (x <= (-8.2d-178)) then
tmp = x * ((t - z) / t)
else if ((x <= 1.55d-174) .or. (.not. (x <= 4d-110)) .and. (x <= 220.0d0)) then
tmp = y * (z / t)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x * (1.0 - (z / t));
double tmp;
if (x <= -3.2e-45) {
tmp = t_1;
} else if (x <= -3.5e-92) {
tmp = (y * z) / t;
} else if (x <= -8.2e-178) {
tmp = x * ((t - z) / t);
} else if ((x <= 1.55e-174) || (!(x <= 4e-110) && (x <= 220.0))) {
tmp = y * (z / t);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (1.0 - (z / t)) tmp = 0 if x <= -3.2e-45: tmp = t_1 elif x <= -3.5e-92: tmp = (y * z) / t elif x <= -8.2e-178: tmp = x * ((t - z) / t) elif (x <= 1.55e-174) or (not (x <= 4e-110) and (x <= 220.0)): tmp = y * (z / t) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(1.0 - Float64(z / t))) tmp = 0.0 if (x <= -3.2e-45) tmp = t_1; elseif (x <= -3.5e-92) tmp = Float64(Float64(y * z) / t); elseif (x <= -8.2e-178) tmp = Float64(x * Float64(Float64(t - z) / t)); elseif ((x <= 1.55e-174) || (!(x <= 4e-110) && (x <= 220.0))) tmp = Float64(y * Float64(z / t)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (1.0 - (z / t)); tmp = 0.0; if (x <= -3.2e-45) tmp = t_1; elseif (x <= -3.5e-92) tmp = (y * z) / t; elseif (x <= -8.2e-178) tmp = x * ((t - z) / t); elseif ((x <= 1.55e-174) || (~((x <= 4e-110)) && (x <= 220.0))) tmp = y * (z / t); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(1.0 - N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -3.2e-45], t$95$1, If[LessEqual[x, -3.5e-92], N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[x, -8.2e-178], N[(x * N[(N[(t - z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[x, 1.55e-174], And[N[Not[LessEqual[x, 4e-110]], $MachinePrecision], LessEqual[x, 220.0]]], N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(1 - \frac{z}{t}\right)\\
\mathbf{if}\;x \leq -3.2 \cdot 10^{-45}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq -3.5 \cdot 10^{-92}:\\
\;\;\;\;\frac{y \cdot z}{t}\\
\mathbf{elif}\;x \leq -8.2 \cdot 10^{-178}:\\
\;\;\;\;x \cdot \frac{t - z}{t}\\
\mathbf{elif}\;x \leq 1.55 \cdot 10^{-174} \lor \neg \left(x \leq 4 \cdot 10^{-110}\right) \land x \leq 220:\\
\;\;\;\;y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -3.20000000000000007e-45 or 1.5499999999999999e-174 < x < 4.0000000000000002e-110 or 220 < x Initial program 90.3%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in x around inf 87.7%
mul-1-neg87.7%
unsub-neg87.7%
Simplified87.7%
if -3.20000000000000007e-45 < x < -3.5e-92Initial program 99.6%
associate-/l*99.4%
Simplified99.4%
Taylor expanded in z around inf 75.7%
*-commutative75.7%
sub-div75.7%
associate-/r/87.6%
Applied egg-rr87.6%
Taylor expanded in y around inf 76.9%
if -3.5e-92 < x < -8.1999999999999998e-178Initial program 93.1%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in x around inf 78.8%
mul-1-neg78.8%
unsub-neg78.8%
Simplified78.8%
Taylor expanded in t around 0 78.9%
if -8.1999999999999998e-178 < x < 1.5499999999999999e-174 or 4.0000000000000002e-110 < x < 220Initial program 87.3%
associate-/l*94.9%
Simplified94.9%
Taylor expanded in z around inf 76.1%
Taylor expanded in y around inf 67.8%
clear-num67.6%
un-div-inv68.4%
Applied egg-rr68.4%
associate-/r/72.4%
Applied egg-rr72.4%
Final simplification82.3%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* y (/ z t))))
(if (<= z -1.6e+137)
(* z (/ x (- t)))
(if (<= z -4.5e+60)
t_1
(if (<= z 3.8e-139)
x
(if (<= z 6.2e-70) (* z (/ y t)) (if (<= z 1750000.0) x t_1)))))))
double code(double x, double y, double z, double t) {
double t_1 = y * (z / t);
double tmp;
if (z <= -1.6e+137) {
tmp = z * (x / -t);
} else if (z <= -4.5e+60) {
tmp = t_1;
} else if (z <= 3.8e-139) {
tmp = x;
} else if (z <= 6.2e-70) {
tmp = z * (y / t);
} else if (z <= 1750000.0) {
tmp = x;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = y * (z / t)
if (z <= (-1.6d+137)) then
tmp = z * (x / -t)
else if (z <= (-4.5d+60)) then
tmp = t_1
else if (z <= 3.8d-139) then
tmp = x
else if (z <= 6.2d-70) then
tmp = z * (y / t)
else if (z <= 1750000.0d0) then
tmp = x
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = y * (z / t);
double tmp;
if (z <= -1.6e+137) {
tmp = z * (x / -t);
} else if (z <= -4.5e+60) {
tmp = t_1;
} else if (z <= 3.8e-139) {
tmp = x;
} else if (z <= 6.2e-70) {
tmp = z * (y / t);
} else if (z <= 1750000.0) {
tmp = x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = y * (z / t) tmp = 0 if z <= -1.6e+137: tmp = z * (x / -t) elif z <= -4.5e+60: tmp = t_1 elif z <= 3.8e-139: tmp = x elif z <= 6.2e-70: tmp = z * (y / t) elif z <= 1750000.0: tmp = x else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(y * Float64(z / t)) tmp = 0.0 if (z <= -1.6e+137) tmp = Float64(z * Float64(x / Float64(-t))); elseif (z <= -4.5e+60) tmp = t_1; elseif (z <= 3.8e-139) tmp = x; elseif (z <= 6.2e-70) tmp = Float64(z * Float64(y / t)); elseif (z <= 1750000.0) tmp = x; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = y * (z / t); tmp = 0.0; if (z <= -1.6e+137) tmp = z * (x / -t); elseif (z <= -4.5e+60) tmp = t_1; elseif (z <= 3.8e-139) tmp = x; elseif (z <= 6.2e-70) tmp = z * (y / t); elseif (z <= 1750000.0) tmp = x; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.6e+137], N[(z * N[(x / (-t)), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -4.5e+60], t$95$1, If[LessEqual[z, 3.8e-139], x, If[LessEqual[z, 6.2e-70], N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1750000.0], x, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \frac{z}{t}\\
\mathbf{if}\;z \leq -1.6 \cdot 10^{+137}:\\
\;\;\;\;z \cdot \frac{x}{-t}\\
\mathbf{elif}\;z \leq -4.5 \cdot 10^{+60}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 3.8 \cdot 10^{-139}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 6.2 \cdot 10^{-70}:\\
\;\;\;\;z \cdot \frac{y}{t}\\
\mathbf{elif}\;z \leq 1750000:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.60000000000000009e137Initial program 89.9%
associate-/l*93.4%
Simplified93.4%
Taylor expanded in z around inf 87.0%
Taylor expanded in y around 0 58.0%
mul-1-neg58.0%
distribute-frac-neg258.0%
Simplified58.0%
if -1.60000000000000009e137 < z < -4.50000000000000013e60 or 1.75e6 < z Initial program 79.7%
associate-/l*97.6%
Simplified97.6%
Taylor expanded in z around inf 86.2%
Taylor expanded in y around inf 61.7%
clear-num61.6%
un-div-inv61.7%
Applied egg-rr61.7%
associate-/r/64.6%
Applied egg-rr64.6%
if -4.50000000000000013e60 < z < 3.80000000000000008e-139 or 6.2e-70 < z < 1.75e6Initial program 95.4%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in z around 0 61.4%
if 3.80000000000000008e-139 < z < 6.2e-70Initial program 99.4%
associate-/l*99.4%
Simplified99.4%
Taylor expanded in z around inf 80.6%
Taylor expanded in y around inf 61.4%
Final simplification62.1%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* z (/ (- y x) t))))
(if (<= z -3.2e+57)
t_1
(if (<= z 3.8e-139)
(* x (/ (- t z) t))
(if (or (<= z 2.05e-70) (not (<= z 38000.0)))
t_1
(* x (- 1.0 (/ z t))))))))
double code(double x, double y, double z, double t) {
double t_1 = z * ((y - x) / t);
double tmp;
if (z <= -3.2e+57) {
tmp = t_1;
} else if (z <= 3.8e-139) {
tmp = x * ((t - z) / t);
} else if ((z <= 2.05e-70) || !(z <= 38000.0)) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_1 = z * ((y - x) / t)
if (z <= (-3.2d+57)) then
tmp = t_1
else if (z <= 3.8d-139) then
tmp = x * ((t - z) / t)
else if ((z <= 2.05d-70) .or. (.not. (z <= 38000.0d0))) then
tmp = t_1
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 t_1 = z * ((y - x) / t);
double tmp;
if (z <= -3.2e+57) {
tmp = t_1;
} else if (z <= 3.8e-139) {
tmp = x * ((t - z) / t);
} else if ((z <= 2.05e-70) || !(z <= 38000.0)) {
tmp = t_1;
} else {
tmp = x * (1.0 - (z / t));
}
return tmp;
}
def code(x, y, z, t): t_1 = z * ((y - x) / t) tmp = 0 if z <= -3.2e+57: tmp = t_1 elif z <= 3.8e-139: tmp = x * ((t - z) / t) elif (z <= 2.05e-70) or not (z <= 38000.0): tmp = t_1 else: tmp = x * (1.0 - (z / t)) return tmp
function code(x, y, z, t) t_1 = Float64(z * Float64(Float64(y - x) / t)) tmp = 0.0 if (z <= -3.2e+57) tmp = t_1; elseif (z <= 3.8e-139) tmp = Float64(x * Float64(Float64(t - z) / t)); elseif ((z <= 2.05e-70) || !(z <= 38000.0)) tmp = t_1; else tmp = Float64(x * Float64(1.0 - Float64(z / t))); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = z * ((y - x) / t); tmp = 0.0; if (z <= -3.2e+57) tmp = t_1; elseif (z <= 3.8e-139) tmp = x * ((t - z) / t); elseif ((z <= 2.05e-70) || ~((z <= 38000.0))) tmp = t_1; else tmp = x * (1.0 - (z / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(z * N[(N[(y - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -3.2e+57], t$95$1, If[LessEqual[z, 3.8e-139], N[(x * N[(N[(t - z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[z, 2.05e-70], N[Not[LessEqual[z, 38000.0]], $MachinePrecision]], t$95$1, N[(x * N[(1.0 - N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \frac{y - x}{t}\\
\mathbf{if}\;z \leq -3.2 \cdot 10^{+57}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 3.8 \cdot 10^{-139}:\\
\;\;\;\;x \cdot \frac{t - z}{t}\\
\mathbf{elif}\;z \leq 2.05 \cdot 10^{-70} \lor \neg \left(z \leq 38000\right):\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - \frac{z}{t}\right)\\
\end{array}
\end{array}
if z < -3.20000000000000029e57 or 3.80000000000000008e-139 < z < 2.04999999999999989e-70 or 38000 < z Initial program 84.0%
associate-/l*96.8%
Simplified96.8%
Taylor expanded in z around inf 86.0%
Taylor expanded in t around 0 86.8%
if -3.20000000000000029e57 < z < 3.80000000000000008e-139Initial program 94.6%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in x around inf 81.7%
mul-1-neg81.7%
unsub-neg81.7%
Simplified81.7%
Taylor expanded in t around 0 81.7%
if 2.04999999999999989e-70 < z < 38000Initial program 99.9%
associate-/l*100.0%
Simplified100.0%
Taylor expanded in x around inf 79.6%
mul-1-neg79.6%
unsub-neg79.6%
Simplified79.6%
Final simplification84.0%
(FPCore (x y z t)
:precision binary64
(if (<= t -1.5e-93)
x
(if (<= t 3.95e-125)
(* x (/ z (- t)))
(if (<= t 2.65e+32) (* z (/ y t)) x))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1.5e-93) {
tmp = x;
} else if (t <= 3.95e-125) {
tmp = x * (z / -t);
} else if (t <= 2.65e+32) {
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 <= (-1.5d-93)) then
tmp = x
else if (t <= 3.95d-125) then
tmp = x * (z / -t)
else if (t <= 2.65d+32) 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 <= -1.5e-93) {
tmp = x;
} else if (t <= 3.95e-125) {
tmp = x * (z / -t);
} else if (t <= 2.65e+32) {
tmp = z * (y / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -1.5e-93: tmp = x elif t <= 3.95e-125: tmp = x * (z / -t) elif t <= 2.65e+32: tmp = z * (y / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -1.5e-93) tmp = x; elseif (t <= 3.95e-125) tmp = Float64(x * Float64(z / Float64(-t))); elseif (t <= 2.65e+32) 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 <= -1.5e-93) tmp = x; elseif (t <= 3.95e-125) tmp = x * (z / -t); elseif (t <= 2.65e+32) tmp = z * (y / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -1.5e-93], x, If[LessEqual[t, 3.95e-125], N[(x * N[(z / (-t)), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 2.65e+32], N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision], x]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.5 \cdot 10^{-93}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq 3.95 \cdot 10^{-125}:\\
\;\;\;\;x \cdot \frac{z}{-t}\\
\mathbf{elif}\;t \leq 2.65 \cdot 10^{+32}:\\
\;\;\;\;z \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if t < -1.5000000000000001e-93 or 2.65e32 < t Initial program 82.5%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in z around 0 61.6%
if -1.5000000000000001e-93 < t < 3.94999999999999994e-125Initial program 97.8%
associate-/l*95.9%
Simplified95.9%
Taylor expanded in x around inf 66.4%
mul-1-neg66.4%
unsub-neg66.4%
Simplified66.4%
Taylor expanded in z around inf 53.4%
mul-1-neg53.4%
*-commutative53.4%
associate-*l/57.7%
distribute-rgt-neg-out57.7%
Simplified57.7%
if 3.94999999999999994e-125 < t < 2.65e32Initial program 96.6%
associate-/l*99.7%
Simplified99.7%
Taylor expanded in z around inf 84.7%
Taylor expanded in y around inf 61.4%
Final simplification60.1%
(FPCore (x y z t) :precision binary64 (if (or (<= y -2.75e-13) (not (<= y 9.2e+20))) (+ x (* y (/ z t))) (* x (- 1.0 (/ z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -2.75e-13) || !(y <= 9.2e+20)) {
tmp = x + (y * (z / 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 ((y <= (-2.75d-13)) .or. (.not. (y <= 9.2d+20))) then
tmp = x + (y * (z / 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 ((y <= -2.75e-13) || !(y <= 9.2e+20)) {
tmp = x + (y * (z / t));
} else {
tmp = x * (1.0 - (z / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -2.75e-13) or not (y <= 9.2e+20): tmp = x + (y * (z / t)) else: tmp = x * (1.0 - (z / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -2.75e-13) || !(y <= 9.2e+20)) tmp = Float64(x + Float64(y * Float64(z / 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 ((y <= -2.75e-13) || ~((y <= 9.2e+20))) tmp = x + (y * (z / t)); else tmp = x * (1.0 - (z / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -2.75e-13], N[Not[LessEqual[y, 9.2e+20]], $MachinePrecision]], N[(x + N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 - N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.75 \cdot 10^{-13} \lor \neg \left(y \leq 9.2 \cdot 10^{+20}\right):\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - \frac{z}{t}\right)\\
\end{array}
\end{array}
if y < -2.74999999999999989e-13 or 9.2e20 < y Initial program 87.1%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in y around inf 79.7%
associate-*r/91.0%
Simplified91.0%
if -2.74999999999999989e-13 < y < 9.2e20Initial program 92.8%
associate-/l*96.8%
Simplified96.8%
Taylor expanded in x around inf 86.8%
mul-1-neg86.8%
unsub-neg86.8%
Simplified86.8%
Final simplification89.0%
(FPCore (x y z t) :precision binary64 (if (or (<= z -5.8e+60) (not (<= z 3.8e-139))) (* z (/ y t)) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -5.8e+60) || !(z <= 3.8e-139)) {
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 <= (-5.8d+60)) .or. (.not. (z <= 3.8d-139))) 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 <= -5.8e+60) || !(z <= 3.8e-139)) {
tmp = z * (y / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -5.8e+60) or not (z <= 3.8e-139): tmp = z * (y / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -5.8e+60) || !(z <= 3.8e-139)) 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 <= -5.8e+60) || ~((z <= 3.8e-139))) tmp = z * (y / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -5.8e+60], N[Not[LessEqual[z, 3.8e-139]], $MachinePrecision]], N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.8 \cdot 10^{+60} \lor \neg \left(z \leq 3.8 \cdot 10^{-139}\right):\\
\;\;\;\;z \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -5.79999999999999999e60 or 3.80000000000000008e-139 < z Initial program 86.0%
associate-/l*97.2%
Simplified97.2%
Taylor expanded in z around inf 80.2%
Taylor expanded in y around inf 53.5%
if -5.79999999999999999e60 < z < 3.80000000000000008e-139Initial program 94.7%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in z around 0 62.6%
Final simplification57.5%
(FPCore (x y z t) :precision binary64 (if (or (<= z -4.8e+60) (not (<= z 3.5e-139))) (* y (/ z t)) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -4.8e+60) || !(z <= 3.5e-139)) {
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 <= (-4.8d+60)) .or. (.not. (z <= 3.5d-139))) 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 <= -4.8e+60) || !(z <= 3.5e-139)) {
tmp = y * (z / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -4.8e+60) or not (z <= 3.5e-139): tmp = y * (z / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -4.8e+60) || !(z <= 3.5e-139)) 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 <= -4.8e+60) || ~((z <= 3.5e-139))) tmp = y * (z / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -4.8e+60], N[Not[LessEqual[z, 3.5e-139]], $MachinePrecision]], N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.8 \cdot 10^{+60} \lor \neg \left(z \leq 3.5 \cdot 10^{-139}\right):\\
\;\;\;\;y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -4.8e60 or 3.50000000000000001e-139 < z Initial program 86.0%
associate-/l*97.2%
Simplified97.2%
Taylor expanded in z around inf 80.2%
Taylor expanded in y around inf 53.5%
clear-num53.4%
un-div-inv53.5%
Applied egg-rr53.5%
associate-/r/55.3%
Applied egg-rr55.3%
if -4.8e60 < z < 3.50000000000000001e-139Initial program 94.7%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in z around 0 62.6%
Final simplification58.5%
(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 89.8%
associate-/l*98.4%
Simplified98.4%
Final simplification98.4%
(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 89.8%
associate-/l*98.4%
Simplified98.4%
clear-num98.3%
un-div-inv98.4%
Applied egg-rr98.4%
Final simplification98.4%
(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 89.8%
associate-/l*98.4%
Simplified98.4%
Taylor expanded in z around 0 37.0%
Final simplification37.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 2024095
(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)))