
(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 10 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 (if (or (<= (/ x y) -50000000.0) (not (<= (/ x y) 5e-17))) (* (- z t) (/ x y)) (+ t (* x (/ z y)))))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -50000000.0) || !((x / y) <= 5e-17)) {
tmp = (z - t) * (x / y);
} else {
tmp = t + (x * (z / 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 (((x / y) <= (-50000000.0d0)) .or. (.not. ((x / y) <= 5d-17))) then
tmp = (z - t) * (x / y)
else
tmp = t + (x * (z / y))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -50000000.0) || !((x / y) <= 5e-17)) {
tmp = (z - t) * (x / y);
} else {
tmp = t + (x * (z / y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x / y) <= -50000000.0) or not ((x / y) <= 5e-17): tmp = (z - t) * (x / y) else: tmp = t + (x * (z / y)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(x / y) <= -50000000.0) || !(Float64(x / y) <= 5e-17)) tmp = Float64(Float64(z - t) * Float64(x / y)); else tmp = Float64(t + Float64(x * Float64(z / y))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((x / y) <= -50000000.0) || ~(((x / y) <= 5e-17))) tmp = (z - t) * (x / y); else tmp = t + (x * (z / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(x / y), $MachinePrecision], -50000000.0], N[Not[LessEqual[N[(x / y), $MachinePrecision], 5e-17]], $MachinePrecision]], N[(N[(z - t), $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision], N[(t + N[(x * N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -50000000 \lor \neg \left(\frac{x}{y} \leq 5 \cdot 10^{-17}\right):\\
\;\;\;\;\left(z - t\right) \cdot \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;t + x \cdot \frac{z}{y}\\
\end{array}
\end{array}
if (/.f64 x y) < -5e7 or 4.9999999999999999e-17 < (/.f64 x y) Initial program 98.4%
Taylor expanded in x around 0 91.2%
associate-*r/94.0%
*-commutative94.0%
associate-/r/98.4%
Simplified98.4%
Taylor expanded in y around 0 91.2%
Taylor expanded in x around -inf 90.9%
*-commutative90.9%
associate-/l*97.9%
Applied egg-rr97.9%
if -5e7 < (/.f64 x y) < 4.9999999999999999e-17Initial program 97.6%
Taylor expanded in z around inf 93.1%
associate-/l*98.5%
Simplified98.5%
Final simplification98.2%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (/ z y))))
(if (<= x -2.8e+144)
(* t (/ x (- y)))
(if (<= x -1.05e-79)
t_1
(if (<= x 3e-106) t (if (<= x 1.75e+170) t_1 (* x (/ t (- y)))))))))
double code(double x, double y, double z, double t) {
double t_1 = x * (z / y);
double tmp;
if (x <= -2.8e+144) {
tmp = t * (x / -y);
} else if (x <= -1.05e-79) {
tmp = t_1;
} else if (x <= 3e-106) {
tmp = t;
} else if (x <= 1.75e+170) {
tmp = t_1;
} else {
tmp = x * (t / -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) :: t_1
real(8) :: tmp
t_1 = x * (z / y)
if (x <= (-2.8d+144)) then
tmp = t * (x / -y)
else if (x <= (-1.05d-79)) then
tmp = t_1
else if (x <= 3d-106) then
tmp = t
else if (x <= 1.75d+170) then
tmp = t_1
else
tmp = x * (t / -y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x * (z / y);
double tmp;
if (x <= -2.8e+144) {
tmp = t * (x / -y);
} else if (x <= -1.05e-79) {
tmp = t_1;
} else if (x <= 3e-106) {
tmp = t;
} else if (x <= 1.75e+170) {
tmp = t_1;
} else {
tmp = x * (t / -y);
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (z / y) tmp = 0 if x <= -2.8e+144: tmp = t * (x / -y) elif x <= -1.05e-79: tmp = t_1 elif x <= 3e-106: tmp = t elif x <= 1.75e+170: tmp = t_1 else: tmp = x * (t / -y) return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(z / y)) tmp = 0.0 if (x <= -2.8e+144) tmp = Float64(t * Float64(x / Float64(-y))); elseif (x <= -1.05e-79) tmp = t_1; elseif (x <= 3e-106) tmp = t; elseif (x <= 1.75e+170) tmp = t_1; else tmp = Float64(x * Float64(t / Float64(-y))); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (z / y); tmp = 0.0; if (x <= -2.8e+144) tmp = t * (x / -y); elseif (x <= -1.05e-79) tmp = t_1; elseif (x <= 3e-106) tmp = t; elseif (x <= 1.75e+170) tmp = t_1; else tmp = x * (t / -y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(z / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -2.8e+144], N[(t * N[(x / (-y)), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -1.05e-79], t$95$1, If[LessEqual[x, 3e-106], t, If[LessEqual[x, 1.75e+170], t$95$1, N[(x * N[(t / (-y)), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \frac{z}{y}\\
\mathbf{if}\;x \leq -2.8 \cdot 10^{+144}:\\
\;\;\;\;t \cdot \frac{x}{-y}\\
\mathbf{elif}\;x \leq -1.05 \cdot 10^{-79}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 3 \cdot 10^{-106}:\\
\;\;\;\;t\\
\mathbf{elif}\;x \leq 1.75 \cdot 10^{+170}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{t}{-y}\\
\end{array}
\end{array}
if x < -2.80000000000000007e144Initial program 96.7%
Taylor expanded in x around 0 75.0%
associate-*r/96.2%
*-commutative96.2%
associate-/r/96.5%
Simplified96.5%
Taylor expanded in y around 0 75.0%
Taylor expanded in x around -inf 68.8%
Taylor expanded in z around 0 46.0%
associate-*r/61.8%
*-commutative61.8%
associate-*r*61.8%
*-commutative61.8%
associate-*r/61.8%
mul-1-neg61.8%
Simplified61.8%
if -2.80000000000000007e144 < x < -1.05e-79 or 3.00000000000000019e-106 < x < 1.75000000000000003e170Initial program 98.8%
Taylor expanded in x around 0 90.4%
associate-*r/99.8%
*-commutative99.8%
associate-/r/98.9%
Simplified98.9%
Taylor expanded in y around 0 90.4%
Taylor expanded in x around -inf 69.3%
Taylor expanded in z around inf 51.0%
associate-*r/55.6%
Simplified55.6%
if -1.05e-79 < x < 3.00000000000000019e-106Initial program 97.8%
Taylor expanded in x around 0 72.1%
if 1.75000000000000003e170 < x Initial program 96.7%
Taylor expanded in x around 0 86.3%
associate-*r/94.3%
*-commutative94.3%
associate-/r/96.8%
Simplified96.8%
Taylor expanded in z around 0 55.6%
mul-1-neg55.6%
associate-*r/62.7%
rem-square-sqrt36.7%
distribute-lft-neg-in36.7%
cancel-sign-sub-inv36.7%
rem-square-sqrt62.7%
Simplified62.7%
clear-num62.6%
un-div-inv62.7%
Applied egg-rr62.7%
Taylor expanded in y around 0 55.6%
mul-1-neg55.6%
associate-*l/65.9%
distribute-lft-neg-in65.9%
*-commutative65.9%
distribute-frac-neg265.9%
Simplified65.9%
Final simplification63.7%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (/ z y))) (t_2 (* t (/ x (- y)))))
(if (<= x -1.6e+140)
t_2
(if (<= x -6e-80)
t_1
(if (<= x 1.2e-105) t (if (<= x 7e+208) t_1 t_2))))))
double code(double x, double y, double z, double t) {
double t_1 = x * (z / y);
double t_2 = t * (x / -y);
double tmp;
if (x <= -1.6e+140) {
tmp = t_2;
} else if (x <= -6e-80) {
tmp = t_1;
} else if (x <= 1.2e-105) {
tmp = t;
} else if (x <= 7e+208) {
tmp = t_1;
} 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 = x * (z / y)
t_2 = t * (x / -y)
if (x <= (-1.6d+140)) then
tmp = t_2
else if (x <= (-6d-80)) then
tmp = t_1
else if (x <= 1.2d-105) then
tmp = t
else if (x <= 7d+208) then
tmp = t_1
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 = x * (z / y);
double t_2 = t * (x / -y);
double tmp;
if (x <= -1.6e+140) {
tmp = t_2;
} else if (x <= -6e-80) {
tmp = t_1;
} else if (x <= 1.2e-105) {
tmp = t;
} else if (x <= 7e+208) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (z / y) t_2 = t * (x / -y) tmp = 0 if x <= -1.6e+140: tmp = t_2 elif x <= -6e-80: tmp = t_1 elif x <= 1.2e-105: tmp = t elif x <= 7e+208: tmp = t_1 else: tmp = t_2 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(z / y)) t_2 = Float64(t * Float64(x / Float64(-y))) tmp = 0.0 if (x <= -1.6e+140) tmp = t_2; elseif (x <= -6e-80) tmp = t_1; elseif (x <= 1.2e-105) tmp = t; elseif (x <= 7e+208) tmp = t_1; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (z / y); t_2 = t * (x / -y); tmp = 0.0; if (x <= -1.6e+140) tmp = t_2; elseif (x <= -6e-80) tmp = t_1; elseif (x <= 1.2e-105) tmp = t; elseif (x <= 7e+208) tmp = t_1; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(z / y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t * N[(x / (-y)), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.6e+140], t$95$2, If[LessEqual[x, -6e-80], t$95$1, If[LessEqual[x, 1.2e-105], t, If[LessEqual[x, 7e+208], t$95$1, t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \frac{z}{y}\\
t_2 := t \cdot \frac{x}{-y}\\
\mathbf{if}\;x \leq -1.6 \cdot 10^{+140}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;x \leq -6 \cdot 10^{-80}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 1.2 \cdot 10^{-105}:\\
\;\;\;\;t\\
\mathbf{elif}\;x \leq 7 \cdot 10^{+208}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if x < -1.60000000000000005e140 or 7.00000000000000033e208 < x Initial program 98.1%
Taylor expanded in x around 0 78.0%
associate-*r/95.9%
*-commutative95.9%
associate-/r/97.9%
Simplified97.9%
Taylor expanded in y around 0 78.0%
Taylor expanded in x around -inf 74.4%
Taylor expanded in z around 0 51.2%
associate-*r/66.0%
*-commutative66.0%
associate-*r*66.0%
*-commutative66.0%
associate-*r/66.0%
mul-1-neg66.0%
Simplified66.0%
if -1.60000000000000005e140 < x < -6.00000000000000014e-80 or 1.20000000000000007e-105 < x < 7.00000000000000033e208Initial program 98.1%
Taylor expanded in x around 0 91.0%
associate-*r/99.2%
*-commutative99.2%
associate-/r/98.2%
Simplified98.2%
Taylor expanded in y around 0 91.0%
Taylor expanded in x around -inf 71.0%
Taylor expanded in z around inf 51.2%
associate-*r/55.0%
Simplified55.0%
if -6.00000000000000014e-80 < x < 1.20000000000000007e-105Initial program 97.8%
Taylor expanded in x around 0 72.1%
Final simplification63.6%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -100000000000.0) (not (<= (/ x y) 5e-64))) (* (- z t) (/ x y)) (* t (- 1.0 (/ x y)))))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -100000000000.0) || !((x / y) <= 5e-64)) {
tmp = (z - t) * (x / 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 (((x / y) <= (-100000000000.0d0)) .or. (.not. ((x / y) <= 5d-64))) then
tmp = (z - t) * (x / 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 (((x / y) <= -100000000000.0) || !((x / y) <= 5e-64)) {
tmp = (z - t) * (x / y);
} else {
tmp = t * (1.0 - (x / y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x / y) <= -100000000000.0) or not ((x / y) <= 5e-64): tmp = (z - t) * (x / y) else: tmp = t * (1.0 - (x / y)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(x / y) <= -100000000000.0) || !(Float64(x / y) <= 5e-64)) tmp = Float64(Float64(z - t) * Float64(x / 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 (((x / y) <= -100000000000.0) || ~(((x / y) <= 5e-64))) tmp = (z - t) * (x / y); else tmp = t * (1.0 - (x / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(x / y), $MachinePrecision], -100000000000.0], N[Not[LessEqual[N[(x / y), $MachinePrecision], 5e-64]], $MachinePrecision]], N[(N[(z - t), $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision], N[(t * N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -100000000000 \lor \neg \left(\frac{x}{y} \leq 5 \cdot 10^{-64}\right):\\
\;\;\;\;\left(z - t\right) \cdot \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\
\end{array}
\end{array}
if (/.f64 x y) < -1e11 or 5.00000000000000033e-64 < (/.f64 x y) Initial program 98.5%
Taylor expanded in x around 0 90.9%
associate-*r/91.3%
*-commutative91.3%
associate-/r/98.5%
Simplified98.5%
Taylor expanded in y around 0 90.9%
Taylor expanded in x around -inf 88.7%
*-commutative88.7%
associate-/l*96.1%
Applied egg-rr96.1%
if -1e11 < (/.f64 x y) < 5.00000000000000033e-64Initial program 97.5%
Taylor expanded in z around 0 78.1%
mul-1-neg78.1%
*-rgt-identity78.1%
associate-/l*80.5%
distribute-rgt-neg-in80.5%
mul-1-neg80.5%
distribute-lft-in80.5%
mul-1-neg80.5%
unsub-neg80.5%
Simplified80.5%
Final simplification88.7%
(FPCore (x y z t) :precision binary64 (if (<= z -6.8e+25) (/ (* z x) y) (if (<= z 1.3e+114) (* t (- 1.0 (/ x y))) (* x (/ z y)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -6.8e+25) {
tmp = (z * x) / y;
} else if (z <= 1.3e+114) {
tmp = t * (1.0 - (x / y));
} else {
tmp = x * (z / 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 <= (-6.8d+25)) then
tmp = (z * x) / y
else if (z <= 1.3d+114) then
tmp = t * (1.0d0 - (x / y))
else
tmp = x * (z / y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -6.8e+25) {
tmp = (z * x) / y;
} else if (z <= 1.3e+114) {
tmp = t * (1.0 - (x / y));
} else {
tmp = x * (z / y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -6.8e+25: tmp = (z * x) / y elif z <= 1.3e+114: tmp = t * (1.0 - (x / y)) else: tmp = x * (z / y) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -6.8e+25) tmp = Float64(Float64(z * x) / y); elseif (z <= 1.3e+114) tmp = Float64(t * Float64(1.0 - Float64(x / y))); else tmp = Float64(x * Float64(z / y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -6.8e+25) tmp = (z * x) / y; elseif (z <= 1.3e+114) tmp = t * (1.0 - (x / y)); else tmp = x * (z / y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -6.8e+25], N[(N[(z * x), $MachinePrecision] / y), $MachinePrecision], If[LessEqual[z, 1.3e+114], N[(t * N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(z / y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.8 \cdot 10^{+25}:\\
\;\;\;\;\frac{z \cdot x}{y}\\
\mathbf{elif}\;z \leq 1.3 \cdot 10^{+114}:\\
\;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{z}{y}\\
\end{array}
\end{array}
if z < -6.79999999999999967e25Initial program 97.9%
Taylor expanded in x around 0 89.5%
associate-*r/91.2%
*-commutative91.2%
associate-/r/97.9%
Simplified97.9%
Taylor expanded in y around 0 89.5%
Taylor expanded in x around -inf 63.3%
Taylor expanded in z around inf 59.6%
if -6.79999999999999967e25 < z < 1.3e114Initial program 98.7%
Taylor expanded in z around 0 78.3%
mul-1-neg78.3%
*-rgt-identity78.3%
associate-/l*83.5%
distribute-rgt-neg-in83.5%
mul-1-neg83.5%
distribute-lft-in83.5%
mul-1-neg83.5%
unsub-neg83.5%
Simplified83.5%
if 1.3e114 < z Initial program 95.7%
Taylor expanded in x around 0 83.8%
associate-*r/97.8%
*-commutative97.8%
associate-/r/95.8%
Simplified95.8%
Taylor expanded in y around 0 83.8%
Taylor expanded in x around -inf 66.5%
Taylor expanded in z around inf 63.1%
associate-*r/71.2%
Simplified71.2%
Final simplification76.1%
(FPCore (x y z t) :precision binary64 (if (or (<= x -8e-80) (not (<= x 2e-106))) (* x (/ z y)) t))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -8e-80) || !(x <= 2e-106)) {
tmp = x * (z / 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 <= (-8d-80)) .or. (.not. (x <= 2d-106))) then
tmp = x * (z / 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 <= -8e-80) || !(x <= 2e-106)) {
tmp = x * (z / y);
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -8e-80) or not (x <= 2e-106): tmp = x * (z / y) else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -8e-80) || !(x <= 2e-106)) tmp = Float64(x * Float64(z / y)); else tmp = t; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -8e-80) || ~((x <= 2e-106))) tmp = x * (z / y); else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -8e-80], N[Not[LessEqual[x, 2e-106]], $MachinePrecision]], N[(x * N[(z / y), $MachinePrecision]), $MachinePrecision], t]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -8 \cdot 10^{-80} \lor \neg \left(x \leq 2 \cdot 10^{-106}\right):\\
\;\;\;\;x \cdot \frac{z}{y}\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if x < -7.99999999999999969e-80 or 1.99999999999999988e-106 < x Initial program 98.1%
Taylor expanded in x around 0 86.8%
associate-*r/98.1%
*-commutative98.1%
associate-/r/98.1%
Simplified98.1%
Taylor expanded in y around 0 86.8%
Taylor expanded in x around -inf 72.1%
Taylor expanded in z around inf 47.2%
associate-*r/50.4%
Simplified50.4%
if -7.99999999999999969e-80 < x < 1.99999999999999988e-106Initial program 97.8%
Taylor expanded in x around 0 72.1%
Final simplification58.6%
(FPCore (x y z t) :precision binary64 (if (<= y -2900.0) t (if (<= y 2.25e+52) (/ (* z x) y) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -2900.0) {
tmp = t;
} else if (y <= 2.25e+52) {
tmp = (z * x) / 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 (y <= (-2900.0d0)) then
tmp = t
else if (y <= 2.25d+52) then
tmp = (z * x) / 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 (y <= -2900.0) {
tmp = t;
} else if (y <= 2.25e+52) {
tmp = (z * x) / y;
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -2900.0: tmp = t elif y <= 2.25e+52: tmp = (z * x) / y else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -2900.0) tmp = t; elseif (y <= 2.25e+52) tmp = Float64(Float64(z * x) / y); else tmp = t; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -2900.0) tmp = t; elseif (y <= 2.25e+52) tmp = (z * x) / y; else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -2900.0], t, If[LessEqual[y, 2.25e+52], N[(N[(z * x), $MachinePrecision] / y), $MachinePrecision], t]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2900:\\
\;\;\;\;t\\
\mathbf{elif}\;y \leq 2.25 \cdot 10^{+52}:\\
\;\;\;\;\frac{z \cdot x}{y}\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if y < -2900 or 2.25e52 < y Initial program 97.6%
Taylor expanded in x around 0 62.7%
if -2900 < y < 2.25e52Initial program 98.4%
Taylor expanded in x around 0 98.4%
associate-*r/89.8%
*-commutative89.8%
associate-/r/98.4%
Simplified98.4%
Taylor expanded in y around 0 98.4%
Taylor expanded in x around -inf 84.3%
Taylor expanded in z around inf 54.4%
Final simplification58.7%
(FPCore (x y z t) :precision binary64 (+ t (/ (- z t) (/ y x))))
double code(double x, double y, double z, double t) {
return t + ((z - t) / (y / 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 = t + ((z - t) / (y / x))
end function
public static double code(double x, double y, double z, double t) {
return t + ((z - t) / (y / x));
}
def code(x, y, z, t): return t + ((z - t) / (y / x))
function code(x, y, z, t) return Float64(t + Float64(Float64(z - t) / Float64(y / x))) end
function tmp = code(x, y, z, t) tmp = t + ((z - t) / (y / x)); end
code[x_, y_, z_, t_] := N[(t + N[(N[(z - t), $MachinePrecision] / N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
t + \frac{z - t}{\frac{y}{x}}
\end{array}
Initial program 98.0%
Taylor expanded in x around 0 91.4%
associate-*r/93.9%
*-commutative93.9%
associate-/r/98.0%
Simplified98.0%
Final simplification98.0%
(FPCore (x y z t) :precision binary64 (+ t (* (- z t) (/ x y))))
double code(double x, double y, double z, double t) {
return t + ((z - t) * (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 + ((z - t) * (x / y))
end function
public static double code(double x, double y, double z, double t) {
return t + ((z - t) * (x / y));
}
def code(x, y, z, t): return t + ((z - t) * (x / y))
function code(x, y, z, t) return Float64(t + Float64(Float64(z - t) * Float64(x / y))) end
function tmp = code(x, y, z, t) tmp = t + ((z - t) * (x / y)); end
code[x_, y_, z_, t_] := N[(t + N[(N[(z - t), $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
t + \left(z - t\right) \cdot \frac{x}{y}
\end{array}
Initial program 98.0%
Final simplification98.0%
(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.0%
Taylor expanded in x around 0 40.6%
(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 2024144
(FPCore (x y z t)
:name "Numeric.Signal.Multichannel:$cget from hsignal-0.2.7.1"
:precision binary64
:alt
(! :herbie-platform default (if (< z 689864138640673/250000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (+ (* (/ x y) (- z t)) t) (if (< z 581748612718609/25000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (+ (* x (/ (- z t) y)) t) (+ (* (/ x y) (- z t)) t))))
(+ (* (/ x y) (- z t)) t))