
(FPCore (x y z t) :precision binary64 (+ (* (/ x y) (- z t)) t))
double code(double x, double y, double z, double t) {
return ((x / y) * (z - t)) + 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)) + t
end function
public static double code(double x, double y, double z, double t) {
return ((x / y) * (z - t)) + t;
}
def code(x, y, z, t): return ((x / y) * (z - t)) + t
function code(x, y, z, t) return Float64(Float64(Float64(x / y) * Float64(z - t)) + t) end
function tmp = code(x, y, z, t) tmp = ((x / y) * (z - t)) + t; end
code[x_, y_, z_, t_] := N[(N[(N[(x / y), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision] + t), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{y} \cdot \left(z - t\right) + t
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (+ (* (/ x y) (- z t)) t))
double code(double x, double y, double z, double t) {
return ((x / y) * (z - t)) + 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)) + t
end function
public static double code(double x, double y, double z, double t) {
return ((x / y) * (z - t)) + t;
}
def code(x, y, z, t): return ((x / y) * (z - t)) + t
function code(x, y, z, t) return Float64(Float64(Float64(x / y) * Float64(z - t)) + t) end
function tmp = code(x, y, z, t) tmp = ((x / y) * (z - t)) + t; end
code[x_, y_, z_, t_] := N[(N[(N[(x / y), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision] + t), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{y} \cdot \left(z - t\right) + t
\end{array}
(FPCore (x y z t) :precision binary64 (+ t (* (/ x y) (- z t))))
double code(double x, double y, double z, double t) {
return t + ((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 = t + ((x / y) * (z - t))
end function
public static double code(double x, double y, double z, double t) {
return t + ((x / y) * (z - t));
}
def code(x, y, z, t): return t + ((x / y) * (z - t))
function code(x, y, z, t) return Float64(t + Float64(Float64(x / y) * Float64(z - t))) end
function tmp = code(x, y, z, t) tmp = t + ((x / y) * (z - t)); end
code[x_, y_, z_, t_] := N[(t + N[(N[(x / y), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
t + \frac{x}{y} \cdot \left(z - t\right)
\end{array}
Initial program 98.1%
Final simplification98.1%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -5e+45) (not (<= (/ x y) 2.0))) (* x (/ t (- y))) t))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -5e+45) || !((x / y) <= 2.0)) {
tmp = x * (t / -y);
} else {
tmp = 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 / y) <= (-5d+45)) .or. (.not. ((x / y) <= 2.0d0))) then
tmp = x * (t / -y)
else
tmp = t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -5e+45) || !((x / y) <= 2.0)) {
tmp = x * (t / -y);
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x / y) <= -5e+45) or not ((x / y) <= 2.0): tmp = x * (t / -y) else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(x / y) <= -5e+45) || !(Float64(x / y) <= 2.0)) tmp = Float64(x * Float64(t / Float64(-y))); else tmp = t; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((x / y) <= -5e+45) || ~(((x / y) <= 2.0))) tmp = x * (t / -y); else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(x / y), $MachinePrecision], -5e+45], N[Not[LessEqual[N[(x / y), $MachinePrecision], 2.0]], $MachinePrecision]], N[(x * N[(t / (-y)), $MachinePrecision]), $MachinePrecision], t]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -5 \cdot 10^{+45} \lor \neg \left(\frac{x}{y} \leq 2\right):\\
\;\;\;\;x \cdot \frac{t}{-y}\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if (/.f64 x y) < -5e45 or 2 < (/.f64 x y) Initial program 97.1%
*-commutative97.1%
clear-num97.0%
un-div-inv97.6%
Applied egg-rr97.6%
Taylor expanded in z around 0 63.3%
mul-1-neg63.3%
associate-*r/64.2%
sub-neg64.2%
Simplified64.2%
Taylor expanded in x around inf 62.5%
mul-1-neg62.5%
*-commutative62.5%
distribute-frac-neg262.5%
associate-/l*63.4%
Simplified63.4%
if -5e45 < (/.f64 x y) < 2Initial program 98.7%
Taylor expanded in x around 0 72.3%
Final simplification68.8%
(FPCore (x y z t) :precision binary64 (if (<= (/ x y) -200.0) (/ (* x (- t)) y) (if (<= (/ x y) 2.0) t (* (/ x y) (- t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -200.0) {
tmp = (x * -t) / y;
} else if ((x / y) <= 2.0) {
tmp = t;
} else {
tmp = (x / 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 / y) <= (-200.0d0)) then
tmp = (x * -t) / y
else if ((x / y) <= 2.0d0) then
tmp = t
else
tmp = (x / y) * -t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -200.0) {
tmp = (x * -t) / y;
} else if ((x / y) <= 2.0) {
tmp = t;
} else {
tmp = (x / y) * -t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x / y) <= -200.0: tmp = (x * -t) / y elif (x / y) <= 2.0: tmp = t else: tmp = (x / y) * -t return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x / y) <= -200.0) tmp = Float64(Float64(x * Float64(-t)) / y); elseif (Float64(x / y) <= 2.0) tmp = t; else tmp = Float64(Float64(x / y) * Float64(-t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x / y) <= -200.0) tmp = (x * -t) / y; elseif ((x / y) <= 2.0) tmp = t; else tmp = (x / y) * -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x / y), $MachinePrecision], -200.0], N[(N[(x * (-t)), $MachinePrecision] / y), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 2.0], t, N[(N[(x / y), $MachinePrecision] * (-t)), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -200:\\
\;\;\;\;\frac{x \cdot \left(-t\right)}{y}\\
\mathbf{elif}\;\frac{x}{y} \leq 2:\\
\;\;\;\;t\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} \cdot \left(-t\right)\\
\end{array}
\end{array}
if (/.f64 x y) < -200Initial program 98.2%
Taylor expanded in z around 0 60.3%
mul-1-neg60.3%
*-commutative60.3%
associate-/l*58.6%
distribute-rgt-neg-in58.6%
distribute-neg-frac258.6%
Simplified58.6%
Taylor expanded in y around 0 60.3%
+-commutative60.3%
neg-mul-160.3%
distribute-rgt-neg-in60.3%
distribute-lft-out60.3%
Simplified60.3%
Taylor expanded in y around 0 59.1%
mul-1-neg59.1%
distribute-lft-neg-out59.1%
*-commutative59.1%
Simplified59.1%
if -200 < (/.f64 x y) < 2Initial program 98.7%
Taylor expanded in x around 0 74.5%
if 2 < (/.f64 x y) Initial program 96.0%
*-commutative96.0%
clear-num95.9%
un-div-inv97.1%
Applied egg-rr97.1%
Taylor expanded in z around 0 62.7%
mul-1-neg62.7%
associate-*r/66.8%
sub-neg66.8%
Simplified66.8%
Taylor expanded in x around inf 61.0%
mul-1-neg61.0%
associate-*r/65.1%
*-commutative65.1%
distribute-rgt-neg-in65.1%
Simplified65.1%
(FPCore (x y z t) :precision binary64 (if (<= (/ x y) -5e+45) (* x (/ t (- y))) (if (<= (/ x y) 2.0) t (* (/ x y) (- t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -5e+45) {
tmp = x * (t / -y);
} else if ((x / y) <= 2.0) {
tmp = t;
} else {
tmp = (x / 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 / y) <= (-5d+45)) then
tmp = x * (t / -y)
else if ((x / y) <= 2.0d0) then
tmp = t
else
tmp = (x / y) * -t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -5e+45) {
tmp = x * (t / -y);
} else if ((x / y) <= 2.0) {
tmp = t;
} else {
tmp = (x / y) * -t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x / y) <= -5e+45: tmp = x * (t / -y) elif (x / y) <= 2.0: tmp = t else: tmp = (x / y) * -t return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x / y) <= -5e+45) tmp = Float64(x * Float64(t / Float64(-y))); elseif (Float64(x / y) <= 2.0) tmp = t; else tmp = Float64(Float64(x / y) * Float64(-t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x / y) <= -5e+45) tmp = x * (t / -y); elseif ((x / y) <= 2.0) tmp = t; else tmp = (x / y) * -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x / y), $MachinePrecision], -5e+45], N[(x * N[(t / (-y)), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 2.0], t, N[(N[(x / y), $MachinePrecision] * (-t)), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -5 \cdot 10^{+45}:\\
\;\;\;\;x \cdot \frac{t}{-y}\\
\mathbf{elif}\;\frac{x}{y} \leq 2:\\
\;\;\;\;t\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} \cdot \left(-t\right)\\
\end{array}
\end{array}
if (/.f64 x y) < -5e45Initial program 98.1%
*-commutative98.1%
clear-num98.0%
un-div-inv98.1%
Applied egg-rr98.1%
Taylor expanded in z around 0 63.7%
mul-1-neg63.7%
associate-*r/62.0%
sub-neg62.0%
Simplified62.0%
Taylor expanded in x around inf 63.7%
mul-1-neg63.7%
*-commutative63.7%
distribute-frac-neg263.7%
associate-/l*63.7%
Simplified63.7%
if -5e45 < (/.f64 x y) < 2Initial program 98.7%
Taylor expanded in x around 0 72.3%
if 2 < (/.f64 x y) Initial program 96.0%
*-commutative96.0%
clear-num95.9%
un-div-inv97.1%
Applied egg-rr97.1%
Taylor expanded in z around 0 62.7%
mul-1-neg62.7%
associate-*r/66.8%
sub-neg66.8%
Simplified66.8%
Taylor expanded in x around inf 61.0%
mul-1-neg61.0%
associate-*r/65.1%
*-commutative65.1%
distribute-rgt-neg-in65.1%
Simplified65.1%
(FPCore (x y z t) :precision binary64 (if (or (<= z -2.15e-32) (not (<= z 1.4e-80))) (+ t (* (/ x y) z)) (* t (- 1.0 (/ x y)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -2.15e-32) || !(z <= 1.4e-80)) {
tmp = t + ((x / y) * z);
} else {
tmp = t * (1.0 - (x / y));
}
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 <= (-2.15d-32)) .or. (.not. (z <= 1.4d-80))) then
tmp = t + ((x / y) * z)
else
tmp = t * (1.0d0 - (x / y))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -2.15e-32) || !(z <= 1.4e-80)) {
tmp = t + ((x / y) * z);
} else {
tmp = t * (1.0 - (x / y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -2.15e-32) or not (z <= 1.4e-80): tmp = t + ((x / y) * z) else: tmp = t * (1.0 - (x / y)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -2.15e-32) || !(z <= 1.4e-80)) tmp = Float64(t + Float64(Float64(x / y) * z)); else tmp = Float64(t * Float64(1.0 - Float64(x / y))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -2.15e-32) || ~((z <= 1.4e-80))) tmp = t + ((x / y) * z); else tmp = t * (1.0 - (x / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -2.15e-32], N[Not[LessEqual[z, 1.4e-80]], $MachinePrecision]], N[(t + N[(N[(x / y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], N[(t * N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.15 \cdot 10^{-32} \lor \neg \left(z \leq 1.4 \cdot 10^{-80}\right):\\
\;\;\;\;t + \frac{x}{y} \cdot z\\
\mathbf{else}:\\
\;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\
\end{array}
\end{array}
if z < -2.14999999999999995e-32 or 1.39999999999999995e-80 < z Initial program 98.0%
Taylor expanded in z around inf 85.4%
associate-/l*84.8%
Simplified84.8%
*-commutative84.8%
associate-/r/88.9%
Applied egg-rr88.9%
clear-num88.9%
associate-/r/88.5%
clear-num89.4%
Applied egg-rr89.4%
if -2.14999999999999995e-32 < z < 1.39999999999999995e-80Initial program 98.2%
Taylor expanded in z around 0 88.8%
mul-1-neg88.8%
unsub-neg88.8%
*-rgt-identity88.8%
associate-/l*90.5%
distribute-lft-out--90.5%
Simplified90.5%
Final simplification89.9%
(FPCore (x y z t) :precision binary64 (if (or (<= z -9e-32) (not (<= z 5.5e-79))) (+ t (* x (/ z y))) (* t (- 1.0 (/ x y)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -9e-32) || !(z <= 5.5e-79)) {
tmp = t + (x * (z / y));
} else {
tmp = t * (1.0 - (x / y));
}
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 <= (-9d-32)) .or. (.not. (z <= 5.5d-79))) then
tmp = t + (x * (z / y))
else
tmp = t * (1.0d0 - (x / y))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -9e-32) || !(z <= 5.5e-79)) {
tmp = t + (x * (z / y));
} else {
tmp = t * (1.0 - (x / y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -9e-32) or not (z <= 5.5e-79): tmp = t + (x * (z / y)) else: tmp = t * (1.0 - (x / y)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -9e-32) || !(z <= 5.5e-79)) tmp = Float64(t + Float64(x * Float64(z / y))); else tmp = Float64(t * Float64(1.0 - Float64(x / y))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -9e-32) || ~((z <= 5.5e-79))) tmp = t + (x * (z / y)); else tmp = t * (1.0 - (x / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -9e-32], N[Not[LessEqual[z, 5.5e-79]], $MachinePrecision]], N[(t + N[(x * N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t * N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -9 \cdot 10^{-32} \lor \neg \left(z \leq 5.5 \cdot 10^{-79}\right):\\
\;\;\;\;t + x \cdot \frac{z}{y}\\
\mathbf{else}:\\
\;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\
\end{array}
\end{array}
if z < -9.00000000000000009e-32 or 5.4999999999999997e-79 < z Initial program 98.0%
Taylor expanded in z around inf 85.4%
associate-/l*84.8%
Simplified84.8%
if -9.00000000000000009e-32 < z < 5.4999999999999997e-79Initial program 98.2%
Taylor expanded in z around 0 88.8%
mul-1-neg88.8%
unsub-neg88.8%
*-rgt-identity88.8%
associate-/l*90.5%
distribute-lft-out--90.5%
Simplified90.5%
Final simplification87.3%
(FPCore (x y z t) :precision binary64 (if (<= z -7e-32) (+ t (* (/ x y) z)) (if (<= z 2.5e-80) (- t (* (/ x y) t)) (+ t (/ z (/ y x))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -7e-32) {
tmp = t + ((x / y) * z);
} else if (z <= 2.5e-80) {
tmp = t - ((x / y) * t);
} else {
tmp = t + (z / (y / 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 <= (-7d-32)) then
tmp = t + ((x / y) * z)
else if (z <= 2.5d-80) then
tmp = t - ((x / y) * t)
else
tmp = t + (z / (y / x))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -7e-32) {
tmp = t + ((x / y) * z);
} else if (z <= 2.5e-80) {
tmp = t - ((x / y) * t);
} else {
tmp = t + (z / (y / x));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -7e-32: tmp = t + ((x / y) * z) elif z <= 2.5e-80: tmp = t - ((x / y) * t) else: tmp = t + (z / (y / x)) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -7e-32) tmp = Float64(t + Float64(Float64(x / y) * z)); elseif (z <= 2.5e-80) tmp = Float64(t - Float64(Float64(x / y) * t)); else tmp = Float64(t + Float64(z / Float64(y / x))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -7e-32) tmp = t + ((x / y) * z); elseif (z <= 2.5e-80) tmp = t - ((x / y) * t); else tmp = t + (z / (y / x)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -7e-32], N[(t + N[(N[(x / y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.5e-80], N[(t - N[(N[(x / y), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision], N[(t + N[(z / N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7 \cdot 10^{-32}:\\
\;\;\;\;t + \frac{x}{y} \cdot z\\
\mathbf{elif}\;z \leq 2.5 \cdot 10^{-80}:\\
\;\;\;\;t - \frac{x}{y} \cdot t\\
\mathbf{else}:\\
\;\;\;\;t + \frac{z}{\frac{y}{x}}\\
\end{array}
\end{array}
if z < -6.9999999999999997e-32Initial program 99.6%
Taylor expanded in z around inf 84.3%
associate-/l*84.4%
Simplified84.4%
*-commutative84.4%
associate-/r/89.1%
Applied egg-rr89.1%
clear-num88.9%
associate-/r/89.0%
clear-num90.3%
Applied egg-rr90.3%
if -6.9999999999999997e-32 < z < 2.5e-80Initial program 98.2%
*-commutative98.2%
clear-num98.2%
un-div-inv98.2%
Applied egg-rr98.2%
Taylor expanded in z around 0 88.8%
mul-1-neg88.8%
associate-*r/90.5%
sub-neg90.5%
Simplified90.5%
if 2.5e-80 < z Initial program 96.8%
Taylor expanded in z around inf 86.2%
associate-/l*85.2%
Simplified85.2%
*-commutative85.2%
associate-/r/88.8%
Applied egg-rr88.8%
Final simplification89.9%
(FPCore (x y z t) :precision binary64 (if (<= z -5.6e-32) (+ t (* (/ x y) z)) (if (<= z 1.32e-79) (* t (- 1.0 (/ x y))) (+ t (/ z (/ y x))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -5.6e-32) {
tmp = t + ((x / y) * z);
} else if (z <= 1.32e-79) {
tmp = t * (1.0 - (x / y));
} else {
tmp = t + (z / (y / 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.6d-32)) then
tmp = t + ((x / y) * z)
else if (z <= 1.32d-79) then
tmp = t * (1.0d0 - (x / y))
else
tmp = t + (z / (y / x))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -5.6e-32) {
tmp = t + ((x / y) * z);
} else if (z <= 1.32e-79) {
tmp = t * (1.0 - (x / y));
} else {
tmp = t + (z / (y / x));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -5.6e-32: tmp = t + ((x / y) * z) elif z <= 1.32e-79: tmp = t * (1.0 - (x / y)) else: tmp = t + (z / (y / x)) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -5.6e-32) tmp = Float64(t + Float64(Float64(x / y) * z)); elseif (z <= 1.32e-79) tmp = Float64(t * Float64(1.0 - Float64(x / y))); else tmp = Float64(t + Float64(z / Float64(y / x))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -5.6e-32) tmp = t + ((x / y) * z); elseif (z <= 1.32e-79) tmp = t * (1.0 - (x / y)); else tmp = t + (z / (y / x)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -5.6e-32], N[(t + N[(N[(x / y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.32e-79], N[(t * N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t + N[(z / N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.6 \cdot 10^{-32}:\\
\;\;\;\;t + \frac{x}{y} \cdot z\\
\mathbf{elif}\;z \leq 1.32 \cdot 10^{-79}:\\
\;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;t + \frac{z}{\frac{y}{x}}\\
\end{array}
\end{array}
if z < -5.5999999999999998e-32Initial program 99.6%
Taylor expanded in z around inf 84.3%
associate-/l*84.4%
Simplified84.4%
*-commutative84.4%
associate-/r/89.1%
Applied egg-rr89.1%
clear-num88.9%
associate-/r/89.0%
clear-num90.3%
Applied egg-rr90.3%
if -5.5999999999999998e-32 < z < 1.32e-79Initial program 98.2%
Taylor expanded in z around 0 88.8%
mul-1-neg88.8%
unsub-neg88.8%
*-rgt-identity88.8%
associate-/l*90.5%
distribute-lft-out--90.5%
Simplified90.5%
if 1.32e-79 < z Initial program 96.8%
Taylor expanded in z around inf 86.2%
associate-/l*85.2%
Simplified85.2%
*-commutative85.2%
associate-/r/88.8%
Applied egg-rr88.8%
Final simplification89.9%
(FPCore (x y z t) :precision binary64 (if (<= (/ x y) -5e+219) (* y (/ t y)) t))
double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -5e+219) {
tmp = y * (t / y);
} else {
tmp = 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 / y) <= (-5d+219)) then
tmp = y * (t / y)
else
tmp = t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -5e+219) {
tmp = y * (t / y);
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x / y) <= -5e+219: tmp = y * (t / y) else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x / y) <= -5e+219) tmp = Float64(y * Float64(t / y)); else tmp = t; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x / y) <= -5e+219) tmp = y * (t / y); else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x / y), $MachinePrecision], -5e+219], N[(y * N[(t / y), $MachinePrecision]), $MachinePrecision], t]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -5 \cdot 10^{+219}:\\
\;\;\;\;y \cdot \frac{t}{y}\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if (/.f64 x y) < -5e219Initial program 96.7%
Taylor expanded in z around 0 75.4%
mul-1-neg75.4%
*-commutative75.4%
associate-/l*75.3%
distribute-rgt-neg-in75.3%
distribute-neg-frac275.3%
Simplified75.3%
Taylor expanded in y around 0 75.4%
+-commutative75.4%
neg-mul-175.4%
distribute-rgt-neg-in75.4%
distribute-lft-out75.4%
Simplified75.4%
Taylor expanded in y around inf 3.8%
*-commutative3.8%
Simplified3.8%
associate-/l*20.5%
*-commutative20.5%
Applied egg-rr20.5%
if -5e219 < (/.f64 x y) Initial program 98.3%
Taylor expanded in x around 0 49.8%
Final simplification46.6%
(FPCore (x y z t) :precision binary64 (* t (- 1.0 (/ x y))))
double code(double x, double y, double z, double t) {
return t * (1.0 - (x / y));
}
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 = t * (1.0d0 - (x / y))
end function
public static double code(double x, double y, double z, double t) {
return t * (1.0 - (x / y));
}
def code(x, y, z, t): return t * (1.0 - (x / y))
function code(x, y, z, t) return Float64(t * Float64(1.0 - Float64(x / y))) end
function tmp = code(x, y, z, t) tmp = t * (1.0 - (x / y)); end
code[x_, y_, z_, t_] := N[(t * N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
t \cdot \left(1 - \frac{x}{y}\right)
\end{array}
Initial program 98.1%
Taylor expanded in z around 0 67.1%
mul-1-neg67.1%
unsub-neg67.1%
*-rgt-identity67.1%
associate-/l*69.7%
distribute-lft-out--69.7%
Simplified69.7%
(FPCore (x y z t) :precision binary64 t)
double code(double x, double y, double z, double t) {
return 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 = t
end function
public static double code(double x, double y, double z, double t) {
return t;
}
def code(x, y, z, t): return t
function code(x, y, z, t) return t end
function tmp = code(x, y, z, t) tmp = t; end
code[x_, y_, z_, t_] := t
\begin{array}{l}
\\
t
\end{array}
Initial program 98.1%
Taylor expanded in x around 0 44.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (+ (* (/ x y) (- z t)) t)))
(if (< z 2.759456554562692e-282)
t_1
(if (< z 2.326994450874436e-110) (+ (* x (/ (- z t) y)) t) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = ((x / y) * (z - t)) + t;
double tmp;
if (z < 2.759456554562692e-282) {
tmp = t_1;
} else if (z < 2.326994450874436e-110) {
tmp = (x * ((z - t) / y)) + 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 / y) * (z - t)) + t
if (z < 2.759456554562692d-282) then
tmp = t_1
else if (z < 2.326994450874436d-110) then
tmp = (x * ((z - t) / y)) + 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 / y) * (z - t)) + t;
double tmp;
if (z < 2.759456554562692e-282) {
tmp = t_1;
} else if (z < 2.326994450874436e-110) {
tmp = (x * ((z - t) / y)) + t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = ((x / y) * (z - t)) + t tmp = 0 if z < 2.759456554562692e-282: tmp = t_1 elif z < 2.326994450874436e-110: tmp = (x * ((z - t) / y)) + t else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(Float64(x / y) * Float64(z - t)) + t) tmp = 0.0 if (z < 2.759456554562692e-282) tmp = t_1; elseif (z < 2.326994450874436e-110) tmp = Float64(Float64(x * Float64(Float64(z - t) / y)) + t); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = ((x / y) * (z - t)) + t; tmp = 0.0; if (z < 2.759456554562692e-282) tmp = t_1; elseif (z < 2.326994450874436e-110) tmp = (x * ((z - t) / y)) + t; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(N[(x / y), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision] + t), $MachinePrecision]}, If[Less[z, 2.759456554562692e-282], t$95$1, If[Less[z, 2.326994450874436e-110], N[(N[(x * N[(N[(z - t), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision] + t), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{y} \cdot \left(z - t\right) + t\\
\mathbf{if}\;z < 2.759456554562692 \cdot 10^{-282}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z < 2.326994450874436 \cdot 10^{-110}:\\
\;\;\;\;x \cdot \frac{z - t}{y} + t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
herbie shell --seed 2024103
(FPCore (x y z t)
:name "Numeric.Signal.Multichannel:$cget from hsignal-0.2.7.1"
:precision binary64
:alt
(if (< z 2.759456554562692e-282) (+ (* (/ x y) (- z t)) t) (if (< z 2.326994450874436e-110) (+ (* x (/ (- z t) y)) t) (+ (* (/ x y) (- z t)) t)))
(+ (* (/ x y) (- z t)) t))