
(FPCore (x y z t) :precision binary64 (* (/ (- x y) (- z y)) t))
double code(double x, double y, double z, double t) {
return ((x - y) / (z - y)) * 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 - y)) * t
end function
public static double code(double x, double y, double z, double t) {
return ((x - y) / (z - y)) * t;
}
def code(x, y, z, t): return ((x - y) / (z - y)) * t
function code(x, y, z, t) return Float64(Float64(Float64(x - y) / Float64(z - y)) * t) end
function tmp = code(x, y, z, t) tmp = ((x - y) / (z - y)) * t; end
code[x_, y_, z_, t_] := N[(N[(N[(x - y), $MachinePrecision] / N[(z - y), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]
\begin{array}{l}
\\
\frac{x - y}{z - y} \cdot 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 y)) t))
double code(double x, double y, double z, double t) {
return ((x - y) / (z - y)) * 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 - y)) * t
end function
public static double code(double x, double y, double z, double t) {
return ((x - y) / (z - y)) * t;
}
def code(x, y, z, t): return ((x - y) / (z - y)) * t
function code(x, y, z, t) return Float64(Float64(Float64(x - y) / Float64(z - y)) * t) end
function tmp = code(x, y, z, t) tmp = ((x - y) / (z - y)) * t; end
code[x_, y_, z_, t_] := N[(N[(N[(x - y), $MachinePrecision] / N[(z - y), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]
\begin{array}{l}
\\
\frac{x - y}{z - y} \cdot t
\end{array}
(FPCore (x y z t) :precision binary64 (/ t (/ (- z y) (- x y))))
double code(double x, double y, double z, double t) {
return t / ((z - y) / (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 - y) / (x - y))
end function
public static double code(double x, double y, double z, double t) {
return t / ((z - y) / (x - y));
}
def code(x, y, z, t): return t / ((z - y) / (x - y))
function code(x, y, z, t) return Float64(t / Float64(Float64(z - y) / Float64(x - y))) end
function tmp = code(x, y, z, t) tmp = t / ((z - y) / (x - y)); end
code[x_, y_, z_, t_] := N[(t / N[(N[(z - y), $MachinePrecision] / N[(x - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{t}{\frac{z - y}{x - y}}
\end{array}
Initial program 96.6%
associate-*l/85.1%
associate-/l*85.1%
Simplified85.1%
associate-*r/85.1%
associate-*l/96.6%
*-commutative96.6%
clear-num96.4%
un-div-inv96.9%
Applied egg-rr96.9%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* t (- 1.0 (/ x y)))))
(if (<= y -1.16e+166)
t_1
(if (<= y -3.8e-89)
(* t (/ y (- y z)))
(if (<= y 4.2e+25) (* x (/ t (- z y))) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = t * (1.0 - (x / y));
double tmp;
if (y <= -1.16e+166) {
tmp = t_1;
} else if (y <= -3.8e-89) {
tmp = t * (y / (y - z));
} else if (y <= 4.2e+25) {
tmp = x * (t / (z - y));
} 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 = t * (1.0d0 - (x / y))
if (y <= (-1.16d+166)) then
tmp = t_1
else if (y <= (-3.8d-89)) then
tmp = t * (y / (y - z))
else if (y <= 4.2d+25) then
tmp = x * (t / (z - y))
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 = t * (1.0 - (x / y));
double tmp;
if (y <= -1.16e+166) {
tmp = t_1;
} else if (y <= -3.8e-89) {
tmp = t * (y / (y - z));
} else if (y <= 4.2e+25) {
tmp = x * (t / (z - y));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = t * (1.0 - (x / y)) tmp = 0 if y <= -1.16e+166: tmp = t_1 elif y <= -3.8e-89: tmp = t * (y / (y - z)) elif y <= 4.2e+25: tmp = x * (t / (z - y)) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(t * Float64(1.0 - Float64(x / y))) tmp = 0.0 if (y <= -1.16e+166) tmp = t_1; elseif (y <= -3.8e-89) tmp = Float64(t * Float64(y / Float64(y - z))); elseif (y <= 4.2e+25) tmp = Float64(x * Float64(t / Float64(z - y))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = t * (1.0 - (x / y)); tmp = 0.0; if (y <= -1.16e+166) tmp = t_1; elseif (y <= -3.8e-89) tmp = t * (y / (y - z)); elseif (y <= 4.2e+25) tmp = x * (t / (z - y)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(t * N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.16e+166], t$95$1, If[LessEqual[y, -3.8e-89], N[(t * N[(y / N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4.2e+25], N[(x * N[(t / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t \cdot \left(1 - \frac{x}{y}\right)\\
\mathbf{if}\;y \leq -1.16 \cdot 10^{+166}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -3.8 \cdot 10^{-89}:\\
\;\;\;\;t \cdot \frac{y}{y - z}\\
\mathbf{elif}\;y \leq 4.2 \cdot 10^{+25}:\\
\;\;\;\;x \cdot \frac{t}{z - y}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -1.16000000000000002e166 or 4.1999999999999998e25 < y Initial program 99.9%
associate-*l/69.5%
associate-/l*72.0%
Simplified72.0%
associate-*r/69.5%
associate-*l/99.9%
*-commutative99.9%
clear-num99.8%
un-div-inv99.9%
Applied egg-rr99.9%
Taylor expanded in z around 0 62.3%
associate-*r/62.3%
neg-mul-162.3%
distribute-rgt-neg-in62.3%
sub-neg62.3%
distribute-neg-out62.3%
remove-double-neg62.3%
+-commutative62.3%
sub-neg62.3%
associate-/l*88.6%
div-sub88.6%
*-inverses88.6%
Simplified88.6%
if -1.16000000000000002e166 < y < -3.8000000000000001e-89Initial program 99.8%
Taylor expanded in x around 0 69.1%
neg-mul-169.1%
distribute-neg-frac269.1%
neg-sub069.1%
sub-neg69.1%
+-commutative69.1%
associate--r+69.1%
neg-sub069.1%
remove-double-neg69.1%
Simplified69.1%
if -3.8000000000000001e-89 < y < 4.1999999999999998e25Initial program 92.8%
associate-*l/93.2%
associate-/l*95.8%
Simplified95.8%
Taylor expanded in x around inf 80.7%
Final simplification81.2%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* t (- 1.0 (/ x y)))))
(if (<= y -1.14e+15)
t_1
(if (<= y -1.6e-96)
(* y (/ t (- y z)))
(if (<= y 5.6e+26) (* x (/ t (- z y))) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = t * (1.0 - (x / y));
double tmp;
if (y <= -1.14e+15) {
tmp = t_1;
} else if (y <= -1.6e-96) {
tmp = y * (t / (y - z));
} else if (y <= 5.6e+26) {
tmp = x * (t / (z - y));
} 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 = t * (1.0d0 - (x / y))
if (y <= (-1.14d+15)) then
tmp = t_1
else if (y <= (-1.6d-96)) then
tmp = y * (t / (y - z))
else if (y <= 5.6d+26) then
tmp = x * (t / (z - y))
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 = t * (1.0 - (x / y));
double tmp;
if (y <= -1.14e+15) {
tmp = t_1;
} else if (y <= -1.6e-96) {
tmp = y * (t / (y - z));
} else if (y <= 5.6e+26) {
tmp = x * (t / (z - y));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = t * (1.0 - (x / y)) tmp = 0 if y <= -1.14e+15: tmp = t_1 elif y <= -1.6e-96: tmp = y * (t / (y - z)) elif y <= 5.6e+26: tmp = x * (t / (z - y)) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(t * Float64(1.0 - Float64(x / y))) tmp = 0.0 if (y <= -1.14e+15) tmp = t_1; elseif (y <= -1.6e-96) tmp = Float64(y * Float64(t / Float64(y - z))); elseif (y <= 5.6e+26) tmp = Float64(x * Float64(t / Float64(z - y))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = t * (1.0 - (x / y)); tmp = 0.0; if (y <= -1.14e+15) tmp = t_1; elseif (y <= -1.6e-96) tmp = y * (t / (y - z)); elseif (y <= 5.6e+26) tmp = x * (t / (z - y)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(t * N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.14e+15], t$95$1, If[LessEqual[y, -1.6e-96], N[(y * N[(t / N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 5.6e+26], N[(x * N[(t / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t \cdot \left(1 - \frac{x}{y}\right)\\
\mathbf{if}\;y \leq -1.14 \cdot 10^{+15}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -1.6 \cdot 10^{-96}:\\
\;\;\;\;y \cdot \frac{t}{y - z}\\
\mathbf{elif}\;y \leq 5.6 \cdot 10^{+26}:\\
\;\;\;\;x \cdot \frac{t}{z - y}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -1.14e15 or 5.59999999999999999e26 < y Initial program 99.9%
associate-*l/74.4%
associate-/l*71.9%
Simplified71.9%
associate-*r/74.4%
associate-*l/99.9%
*-commutative99.9%
clear-num99.8%
un-div-inv99.9%
Applied egg-rr99.9%
Taylor expanded in z around 0 60.6%
associate-*r/60.6%
neg-mul-160.6%
distribute-rgt-neg-in60.6%
sub-neg60.6%
distribute-neg-out60.6%
remove-double-neg60.6%
+-commutative60.6%
sub-neg60.6%
associate-/l*82.0%
div-sub82.0%
*-inverses82.0%
Simplified82.0%
if -1.14e15 < y < -1.60000000000000006e-96Initial program 99.7%
associate-*l/99.7%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in x around 0 78.2%
associate-*r/78.2%
mul-1-neg78.2%
distribute-rgt-neg-out78.2%
associate-*l/78.2%
*-commutative78.2%
distribute-lft-neg-out78.2%
distribute-rgt-neg-in78.2%
distribute-frac-neg278.2%
neg-sub078.2%
sub-neg78.2%
+-commutative78.2%
associate--r+78.2%
neg-sub078.2%
remove-double-neg78.2%
Simplified78.2%
if -1.60000000000000006e-96 < y < 5.59999999999999999e26Initial program 92.8%
associate-*l/93.2%
associate-/l*95.8%
Simplified95.8%
Taylor expanded in x around inf 80.7%
(FPCore (x y z t) :precision binary64 (if (<= y -2.65e+154) (* t (- 1.0 (/ x y))) (if (<= y 3.8e+194) (* (- x y) (/ t (- z y))) (* t (/ y (- y z))))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -2.65e+154) {
tmp = t * (1.0 - (x / y));
} else if (y <= 3.8e+194) {
tmp = (x - y) * (t / (z - y));
} else {
tmp = t * (y / (y - 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 (y <= (-2.65d+154)) then
tmp = t * (1.0d0 - (x / y))
else if (y <= 3.8d+194) then
tmp = (x - y) * (t / (z - y))
else
tmp = t * (y / (y - z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -2.65e+154) {
tmp = t * (1.0 - (x / y));
} else if (y <= 3.8e+194) {
tmp = (x - y) * (t / (z - y));
} else {
tmp = t * (y / (y - z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -2.65e+154: tmp = t * (1.0 - (x / y)) elif y <= 3.8e+194: tmp = (x - y) * (t / (z - y)) else: tmp = t * (y / (y - z)) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -2.65e+154) tmp = Float64(t * Float64(1.0 - Float64(x / y))); elseif (y <= 3.8e+194) tmp = Float64(Float64(x - y) * Float64(t / Float64(z - y))); else tmp = Float64(t * Float64(y / Float64(y - z))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -2.65e+154) tmp = t * (1.0 - (x / y)); elseif (y <= 3.8e+194) tmp = (x - y) * (t / (z - y)); else tmp = t * (y / (y - z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -2.65e+154], N[(t * N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3.8e+194], N[(N[(x - y), $MachinePrecision] * N[(t / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t * N[(y / N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.65 \cdot 10^{+154}:\\
\;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\
\mathbf{elif}\;y \leq 3.8 \cdot 10^{+194}:\\
\;\;\;\;\left(x - y\right) \cdot \frac{t}{z - y}\\
\mathbf{else}:\\
\;\;\;\;t \cdot \frac{y}{y - z}\\
\end{array}
\end{array}
if y < -2.65000000000000012e154Initial program 100.0%
associate-*l/64.8%
associate-/l*69.2%
Simplified69.2%
associate-*r/64.8%
associate-*l/100.0%
*-commutative100.0%
clear-num99.9%
un-div-inv99.9%
Applied egg-rr99.9%
Taylor expanded in z around 0 62.1%
associate-*r/62.1%
neg-mul-162.1%
distribute-rgt-neg-in62.1%
sub-neg62.1%
distribute-neg-out62.1%
remove-double-neg62.1%
+-commutative62.1%
sub-neg62.1%
associate-/l*97.2%
div-sub97.2%
*-inverses97.2%
Simplified97.2%
if -2.65000000000000012e154 < y < 3.7999999999999999e194Initial program 95.6%
associate-*l/90.2%
associate-/l*92.1%
Simplified92.1%
if 3.7999999999999999e194 < y Initial program 99.8%
Taylor expanded in x around 0 86.9%
neg-mul-186.9%
distribute-neg-frac286.9%
neg-sub086.9%
sub-neg86.9%
+-commutative86.9%
associate--r+86.9%
neg-sub086.9%
remove-double-neg86.9%
Simplified86.9%
Final simplification92.2%
(FPCore (x y z t) :precision binary64 (if (or (<= z -6.4e-77) (not (<= z 1.8e-17))) (/ t (/ z (- x y))) (* t (- 1.0 (/ x y)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -6.4e-77) || !(z <= 1.8e-17)) {
tmp = t / (z / (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 ((z <= (-6.4d-77)) .or. (.not. (z <= 1.8d-17))) then
tmp = t / (z / (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 ((z <= -6.4e-77) || !(z <= 1.8e-17)) {
tmp = t / (z / (x - y));
} else {
tmp = t * (1.0 - (x / y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -6.4e-77) or not (z <= 1.8e-17): tmp = t / (z / (x - y)) else: tmp = t * (1.0 - (x / y)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -6.4e-77) || !(z <= 1.8e-17)) tmp = Float64(t / Float64(z / 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 ((z <= -6.4e-77) || ~((z <= 1.8e-17))) tmp = t / (z / (x - y)); else tmp = t * (1.0 - (x / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -6.4e-77], N[Not[LessEqual[z, 1.8e-17]], $MachinePrecision]], N[(t / N[(z / N[(x - 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 -6.4 \cdot 10^{-77} \lor \neg \left(z \leq 1.8 \cdot 10^{-17}\right):\\
\;\;\;\;\frac{t}{\frac{z}{x - y}}\\
\mathbf{else}:\\
\;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\
\end{array}
\end{array}
if z < -6.39999999999999999e-77 or 1.79999999999999997e-17 < z Initial program 97.3%
associate-*l/86.4%
associate-/l*82.2%
Simplified82.2%
associate-*r/86.4%
associate-*l/97.3%
*-commutative97.3%
clear-num97.0%
un-div-inv97.1%
Applied egg-rr97.1%
Taylor expanded in z around inf 75.1%
if -6.39999999999999999e-77 < z < 1.79999999999999997e-17Initial program 95.9%
associate-*l/83.5%
associate-/l*88.7%
Simplified88.7%
associate-*r/83.5%
associate-*l/95.9%
*-commutative95.9%
clear-num95.7%
un-div-inv96.6%
Applied egg-rr96.6%
Taylor expanded in z around 0 73.7%
associate-*r/73.7%
neg-mul-173.7%
distribute-rgt-neg-in73.7%
sub-neg73.7%
distribute-neg-out73.7%
remove-double-neg73.7%
+-commutative73.7%
sub-neg73.7%
associate-/l*86.9%
div-sub86.9%
*-inverses86.9%
Simplified86.9%
Final simplification80.4%
(FPCore (x y z t) :precision binary64 (if (or (<= y -2.85e-92) (not (<= y 9e+24))) (* t (- 1.0 (/ x y))) (* x (/ t (- z y)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -2.85e-92) || !(y <= 9e+24)) {
tmp = t * (1.0 - (x / y));
} else {
tmp = x * (t / (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 ((y <= (-2.85d-92)) .or. (.not. (y <= 9d+24))) then
tmp = t * (1.0d0 - (x / y))
else
tmp = x * (t / (z - y))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -2.85e-92) || !(y <= 9e+24)) {
tmp = t * (1.0 - (x / y));
} else {
tmp = x * (t / (z - y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -2.85e-92) or not (y <= 9e+24): tmp = t * (1.0 - (x / y)) else: tmp = x * (t / (z - y)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -2.85e-92) || !(y <= 9e+24)) tmp = Float64(t * Float64(1.0 - Float64(x / y))); else tmp = Float64(x * Float64(t / Float64(z - y))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -2.85e-92) || ~((y <= 9e+24))) tmp = t * (1.0 - (x / y)); else tmp = x * (t / (z - y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -2.85e-92], N[Not[LessEqual[y, 9e+24]], $MachinePrecision]], N[(t * N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(t / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.85 \cdot 10^{-92} \lor \neg \left(y \leq 9 \cdot 10^{+24}\right):\\
\;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{t}{z - y}\\
\end{array}
\end{array}
if y < -2.85000000000000004e-92 or 9.00000000000000039e24 < y Initial program 99.8%
associate-*l/78.4%
associate-/l*76.3%
Simplified76.3%
associate-*r/78.4%
associate-*l/99.8%
*-commutative99.8%
clear-num99.8%
un-div-inv99.9%
Applied egg-rr99.9%
Taylor expanded in z around 0 60.4%
associate-*r/60.4%
neg-mul-160.4%
distribute-rgt-neg-in60.4%
sub-neg60.4%
distribute-neg-out60.4%
remove-double-neg60.4%
+-commutative60.4%
sub-neg60.4%
associate-/l*77.7%
div-sub77.8%
*-inverses77.8%
Simplified77.8%
if -2.85000000000000004e-92 < y < 9.00000000000000039e24Initial program 92.8%
associate-*l/93.2%
associate-/l*95.8%
Simplified95.8%
Taylor expanded in x around inf 80.7%
Final simplification79.1%
(FPCore (x y z t) :precision binary64 (if (or (<= y -2.3e-90) (not (<= y 5.4e-70))) (* t (- 1.0 (/ x y))) (* x (/ t z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -2.3e-90) || !(y <= 5.4e-70)) {
tmp = t * (1.0 - (x / y));
} else {
tmp = 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 ((y <= (-2.3d-90)) .or. (.not. (y <= 5.4d-70))) then
tmp = t * (1.0d0 - (x / y))
else
tmp = x * (t / z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -2.3e-90) || !(y <= 5.4e-70)) {
tmp = t * (1.0 - (x / y));
} else {
tmp = x * (t / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -2.3e-90) or not (y <= 5.4e-70): tmp = t * (1.0 - (x / y)) else: tmp = x * (t / z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -2.3e-90) || !(y <= 5.4e-70)) tmp = Float64(t * Float64(1.0 - Float64(x / y))); else tmp = Float64(x * Float64(t / z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -2.3e-90) || ~((y <= 5.4e-70))) tmp = t * (1.0 - (x / y)); else tmp = x * (t / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -2.3e-90], N[Not[LessEqual[y, 5.4e-70]], $MachinePrecision]], N[(t * N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.3 \cdot 10^{-90} \lor \neg \left(y \leq 5.4 \cdot 10^{-70}\right):\\
\;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{t}{z}\\
\end{array}
\end{array}
if y < -2.2999999999999998e-90 or 5.4000000000000003e-70 < y Initial program 99.8%
associate-*l/80.0%
associate-/l*78.8%
Simplified78.8%
associate-*r/80.0%
associate-*l/99.8%
*-commutative99.8%
clear-num99.8%
un-div-inv99.9%
Applied egg-rr99.9%
Taylor expanded in z around 0 58.4%
associate-*r/58.4%
neg-mul-158.4%
distribute-rgt-neg-in58.4%
sub-neg58.4%
distribute-neg-out58.4%
remove-double-neg58.4%
+-commutative58.4%
sub-neg58.4%
associate-/l*74.1%
div-sub74.1%
*-inverses74.1%
Simplified74.1%
if -2.2999999999999998e-90 < y < 5.4000000000000003e-70Initial program 91.2%
associate-*l/93.7%
associate-/l*95.9%
Simplified95.9%
Taylor expanded in x around inf 86.4%
Taylor expanded in z around inf 78.2%
Final simplification75.7%
(FPCore (x y z t) :precision binary64 (if (<= y -4.1e-89) t (if (<= y 1.12e+27) (* x (/ t z)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -4.1e-89) {
tmp = t;
} else if (y <= 1.12e+27) {
tmp = x * (t / z);
} 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 <= (-4.1d-89)) then
tmp = t
else if (y <= 1.12d+27) then
tmp = x * (t / z)
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 <= -4.1e-89) {
tmp = t;
} else if (y <= 1.12e+27) {
tmp = x * (t / z);
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -4.1e-89: tmp = t elif y <= 1.12e+27: tmp = x * (t / z) else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -4.1e-89) tmp = t; elseif (y <= 1.12e+27) tmp = Float64(x * Float64(t / z)); else tmp = t; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -4.1e-89) tmp = t; elseif (y <= 1.12e+27) tmp = x * (t / z); else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -4.1e-89], t, If[LessEqual[y, 1.12e+27], N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision], t]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.1 \cdot 10^{-89}:\\
\;\;\;\;t\\
\mathbf{elif}\;y \leq 1.12 \cdot 10^{+27}:\\
\;\;\;\;x \cdot \frac{t}{z}\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if y < -4.0999999999999998e-89 or 1.12e27 < y Initial program 99.8%
associate-*l/78.4%
associate-/l*76.3%
Simplified76.3%
Taylor expanded in y around inf 58.3%
if -4.0999999999999998e-89 < y < 1.12e27Initial program 92.8%
associate-*l/93.2%
associate-/l*95.8%
Simplified95.8%
Taylor expanded in x around inf 80.7%
Taylor expanded in z around inf 71.5%
(FPCore (x y z t) :precision binary64 (* t (/ (- x y) (- z y))))
double code(double x, double y, double z, double t) {
return t * ((x - y) / (z - 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 * ((x - y) / (z - y))
end function
public static double code(double x, double y, double z, double t) {
return t * ((x - y) / (z - y));
}
def code(x, y, z, t): return t * ((x - y) / (z - y))
function code(x, y, z, t) return Float64(t * Float64(Float64(x - y) / Float64(z - y))) end
function tmp = code(x, y, z, t) tmp = t * ((x - y) / (z - y)); end
code[x_, y_, z_, t_] := N[(t * N[(N[(x - y), $MachinePrecision] / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
t \cdot \frac{x - y}{z - y}
\end{array}
Initial program 96.6%
Final simplification96.6%
(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 96.6%
associate-*l/85.1%
associate-/l*85.1%
Simplified85.1%
Taylor expanded in y around inf 36.9%
(FPCore (x y z t) :precision binary64 (/ t (/ (- z y) (- x y))))
double code(double x, double y, double z, double t) {
return t / ((z - y) / (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 - y) / (x - y))
end function
public static double code(double x, double y, double z, double t) {
return t / ((z - y) / (x - y));
}
def code(x, y, z, t): return t / ((z - y) / (x - y))
function code(x, y, z, t) return Float64(t / Float64(Float64(z - y) / Float64(x - y))) end
function tmp = code(x, y, z, t) tmp = t / ((z - y) / (x - y)); end
code[x_, y_, z_, t_] := N[(t / N[(N[(z - y), $MachinePrecision] / N[(x - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{t}{\frac{z - y}{x - y}}
\end{array}
herbie shell --seed 2024180
(FPCore (x y z t)
:name "Numeric.Signal.Multichannel:$cput from hsignal-0.2.7.1"
:precision binary64
:alt
(! :herbie-platform default (/ t (/ (- z y) (- x y))))
(* (/ (- x y) (- z y)) t))