
(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 12 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 (/ (- 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 97.4%
Taylor expanded in x around 0 94.7%
*-commutative94.7%
associate-*r/93.9%
Simplified93.9%
associate-*r/94.7%
associate-*l/97.4%
clear-num97.3%
associate-*l/97.6%
*-un-lft-identity97.6%
Applied egg-rr97.6%
Final simplification97.6%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -2e-9) (not (<= (/ x y) 1e-17))) (/ (- z t) (/ y x)) (+ t (/ (* z x) y))))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -2e-9) || !((x / y) <= 1e-17)) {
tmp = (z - t) / (y / x);
} else {
tmp = t + ((z * 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) <= (-2d-9)) .or. (.not. ((x / y) <= 1d-17))) then
tmp = (z - t) / (y / x)
else
tmp = t + ((z * 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) <= -2e-9) || !((x / y) <= 1e-17)) {
tmp = (z - t) / (y / x);
} else {
tmp = t + ((z * x) / y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x / y) <= -2e-9) or not ((x / y) <= 1e-17): tmp = (z - t) / (y / x) else: tmp = t + ((z * x) / y) return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(x / y) <= -2e-9) || !(Float64(x / y) <= 1e-17)) tmp = Float64(Float64(z - t) / Float64(y / x)); else tmp = Float64(t + Float64(Float64(z * x) / y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((x / y) <= -2e-9) || ~(((x / y) <= 1e-17))) tmp = (z - t) / (y / x); else tmp = t + ((z * x) / y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(x / y), $MachinePrecision], -2e-9], N[Not[LessEqual[N[(x / y), $MachinePrecision], 1e-17]], $MachinePrecision]], N[(N[(z - t), $MachinePrecision] / N[(y / x), $MachinePrecision]), $MachinePrecision], N[(t + N[(N[(z * x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -2 \cdot 10^{-9} \lor \neg \left(\frac{x}{y} \leq 10^{-17}\right):\\
\;\;\;\;\frac{z - t}{\frac{y}{x}}\\
\mathbf{else}:\\
\;\;\;\;t + \frac{z \cdot x}{y}\\
\end{array}
\end{array}
if (/.f64 x y) < -2.00000000000000012e-9 or 1.00000000000000007e-17 < (/.f64 x y) Initial program 97.0%
associate-*l/93.2%
div-inv93.1%
associate-*r*92.8%
div-inv92.9%
fma-udef92.9%
add-cube-cbrt92.3%
pow392.3%
fma-udef92.3%
associate-*r/92.5%
associate-*l/96.4%
fma-def96.4%
Applied egg-rr96.4%
Taylor expanded in x around -inf 91.3%
rem-cube-cbrt91.9%
associate-/l*96.1%
Applied egg-rr96.1%
if -2.00000000000000012e-9 < (/.f64 x y) < 1.00000000000000007e-17Initial program 97.8%
Taylor expanded in z around inf 97.7%
Final simplification96.8%
(FPCore (x y z t) :precision binary64 (if (<= (/ x y) -5e+61) (* t (/ (- x) y)) (if (<= (/ x y) 5e+58) (+ t (* x (/ z y))) (/ (* t x) (- y)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -5e+61) {
tmp = t * (-x / y);
} else if ((x / y) <= 5e+58) {
tmp = t + (x * (z / y));
} else {
tmp = (t * 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) <= (-5d+61)) then
tmp = t * (-x / y)
else if ((x / y) <= 5d+58) then
tmp = t + (x * (z / y))
else
tmp = (t * 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) <= -5e+61) {
tmp = t * (-x / y);
} else if ((x / y) <= 5e+58) {
tmp = t + (x * (z / y));
} else {
tmp = (t * x) / -y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x / y) <= -5e+61: tmp = t * (-x / y) elif (x / y) <= 5e+58: tmp = t + (x * (z / y)) else: tmp = (t * x) / -y return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x / y) <= -5e+61) tmp = Float64(t * Float64(Float64(-x) / y)); elseif (Float64(x / y) <= 5e+58) tmp = Float64(t + Float64(x * Float64(z / y))); else tmp = Float64(Float64(t * x) / Float64(-y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x / y) <= -5e+61) tmp = t * (-x / y); elseif ((x / y) <= 5e+58) tmp = t + (x * (z / y)); else tmp = (t * x) / -y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x / y), $MachinePrecision], -5e+61], N[(t * N[((-x) / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 5e+58], N[(t + N[(x * N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t * x), $MachinePrecision] / (-y)), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -5 \cdot 10^{+61}:\\
\;\;\;\;t \cdot \frac{-x}{y}\\
\mathbf{elif}\;\frac{x}{y} \leq 5 \cdot 10^{+58}:\\
\;\;\;\;t + x \cdot \frac{z}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{t \cdot x}{-y}\\
\end{array}
\end{array}
if (/.f64 x y) < -5.00000000000000018e61Initial program 94.1%
Taylor expanded in z around 0 61.7%
mul-1-neg61.7%
unsub-neg61.7%
associate-/l*61.9%
associate-/r/64.8%
Simplified64.8%
Taylor expanded in y around 0 61.6%
associate-*r/61.6%
*-commutative61.6%
neg-mul-161.6%
distribute-rgt-neg-in61.6%
*-commutative61.6%
associate-*r/64.9%
distribute-lft-neg-out64.9%
distribute-rgt-neg-in64.9%
mul-1-neg64.9%
associate-*r/64.9%
neg-mul-164.9%
Simplified64.9%
if -5.00000000000000018e61 < (/.f64 x y) < 4.99999999999999986e58Initial program 98.1%
Taylor expanded in z around inf 89.9%
div-inv89.9%
*-commutative89.9%
associate-*l*90.4%
div-inv90.4%
Applied egg-rr90.4%
if 4.99999999999999986e58 < (/.f64 x y) Initial program 98.2%
Taylor expanded in z around 0 75.7%
mul-1-neg75.7%
unsub-neg75.7%
associate-/l*72.4%
associate-/r/74.0%
Simplified74.0%
Taylor expanded in y around 0 75.7%
associate-*r/75.7%
*-commutative75.7%
neg-mul-175.7%
distribute-rgt-neg-in75.7%
*-commutative75.7%
associate-*r/74.1%
distribute-lft-neg-out74.1%
distribute-rgt-neg-in74.1%
mul-1-neg74.1%
associate-*r/74.1%
neg-mul-174.1%
Simplified74.1%
frac-2neg74.1%
remove-double-neg74.1%
associate-*r/75.7%
Applied egg-rr75.7%
Final simplification82.2%
(FPCore (x y z t) :precision binary64 (if (<= (/ x y) -5e+61) (* t (/ (- x) y)) (if (<= (/ x y) 5e+58) (+ t (* z (/ x y))) (/ (* t x) (- y)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -5e+61) {
tmp = t * (-x / y);
} else if ((x / y) <= 5e+58) {
tmp = t + (z * (x / y));
} else {
tmp = (t * 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) <= (-5d+61)) then
tmp = t * (-x / y)
else if ((x / y) <= 5d+58) then
tmp = t + (z * (x / y))
else
tmp = (t * 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) <= -5e+61) {
tmp = t * (-x / y);
} else if ((x / y) <= 5e+58) {
tmp = t + (z * (x / y));
} else {
tmp = (t * x) / -y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x / y) <= -5e+61: tmp = t * (-x / y) elif (x / y) <= 5e+58: tmp = t + (z * (x / y)) else: tmp = (t * x) / -y return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x / y) <= -5e+61) tmp = Float64(t * Float64(Float64(-x) / y)); elseif (Float64(x / y) <= 5e+58) tmp = Float64(t + Float64(z * Float64(x / y))); else tmp = Float64(Float64(t * x) / Float64(-y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x / y) <= -5e+61) tmp = t * (-x / y); elseif ((x / y) <= 5e+58) tmp = t + (z * (x / y)); else tmp = (t * x) / -y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x / y), $MachinePrecision], -5e+61], N[(t * N[((-x) / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 5e+58], N[(t + N[(z * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t * x), $MachinePrecision] / (-y)), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -5 \cdot 10^{+61}:\\
\;\;\;\;t \cdot \frac{-x}{y}\\
\mathbf{elif}\;\frac{x}{y} \leq 5 \cdot 10^{+58}:\\
\;\;\;\;t + z \cdot \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{t \cdot x}{-y}\\
\end{array}
\end{array}
if (/.f64 x y) < -5.00000000000000018e61Initial program 94.1%
Taylor expanded in z around 0 61.7%
mul-1-neg61.7%
unsub-neg61.7%
associate-/l*61.9%
associate-/r/64.8%
Simplified64.8%
Taylor expanded in y around 0 61.6%
associate-*r/61.6%
*-commutative61.6%
neg-mul-161.6%
distribute-rgt-neg-in61.6%
*-commutative61.6%
associate-*r/64.9%
distribute-lft-neg-out64.9%
distribute-rgt-neg-in64.9%
mul-1-neg64.9%
associate-*r/64.9%
neg-mul-164.9%
Simplified64.9%
if -5.00000000000000018e61 < (/.f64 x y) < 4.99999999999999986e58Initial program 98.1%
Taylor expanded in z around inf 89.9%
associate-*r/93.2%
Simplified93.2%
if 4.99999999999999986e58 < (/.f64 x y) Initial program 98.2%
Taylor expanded in z around 0 75.7%
mul-1-neg75.7%
unsub-neg75.7%
associate-/l*72.4%
associate-/r/74.0%
Simplified74.0%
Taylor expanded in y around 0 75.7%
associate-*r/75.7%
*-commutative75.7%
neg-mul-175.7%
distribute-rgt-neg-in75.7%
*-commutative75.7%
associate-*r/74.1%
distribute-lft-neg-out74.1%
distribute-rgt-neg-in74.1%
mul-1-neg74.1%
associate-*r/74.1%
neg-mul-174.1%
Simplified74.1%
frac-2neg74.1%
remove-double-neg74.1%
associate-*r/75.7%
Applied egg-rr75.7%
Final simplification83.8%
(FPCore (x y z t) :precision binary64 (if (<= (/ x y) -2000.0) (+ t (* x (/ (- z t) y))) (if (<= (/ x y) 1e-17) (+ t (* z (/ x y))) (/ (- z t) (/ y x)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -2000.0) {
tmp = t + (x * ((z - t) / y));
} else if ((x / y) <= 1e-17) {
tmp = t + (z * (x / y));
} else {
tmp = (z - t) / (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 ((x / y) <= (-2000.0d0)) then
tmp = t + (x * ((z - t) / y))
else if ((x / y) <= 1d-17) then
tmp = t + (z * (x / y))
else
tmp = (z - t) / (y / x)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -2000.0) {
tmp = t + (x * ((z - t) / y));
} else if ((x / y) <= 1e-17) {
tmp = t + (z * (x / y));
} else {
tmp = (z - t) / (y / x);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x / y) <= -2000.0: tmp = t + (x * ((z - t) / y)) elif (x / y) <= 1e-17: tmp = t + (z * (x / y)) else: tmp = (z - t) / (y / x) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x / y) <= -2000.0) tmp = Float64(t + Float64(x * Float64(Float64(z - t) / y))); elseif (Float64(x / y) <= 1e-17) tmp = Float64(t + Float64(z * Float64(x / y))); else tmp = Float64(Float64(z - t) / Float64(y / x)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x / y) <= -2000.0) tmp = t + (x * ((z - t) / y)); elseif ((x / y) <= 1e-17) tmp = t + (z * (x / y)); else tmp = (z - t) / (y / x); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x / y), $MachinePrecision], -2000.0], N[(t + N[(x * N[(N[(z - t), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 1e-17], N[(t + N[(z * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(z - t), $MachinePrecision] / N[(y / x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -2000:\\
\;\;\;\;t + x \cdot \frac{z - t}{y}\\
\mathbf{elif}\;\frac{x}{y} \leq 10^{-17}:\\
\;\;\;\;t + z \cdot \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{z - t}{\frac{y}{x}}\\
\end{array}
\end{array}
if (/.f64 x y) < -2e3Initial program 94.7%
Taylor expanded in x around 0 95.4%
*-commutative95.4%
associate-*r/98.2%
Simplified98.2%
if -2e3 < (/.f64 x y) < 1.00000000000000007e-17Initial program 97.9%
Taylor expanded in z around inf 96.4%
associate-*r/96.6%
Simplified96.6%
if 1.00000000000000007e-17 < (/.f64 x y) Initial program 98.5%
associate-*l/92.2%
div-inv92.1%
associate-*r*92.1%
div-inv92.2%
fma-udef92.2%
add-cube-cbrt91.7%
pow391.6%
fma-udef91.6%
associate-*r/91.7%
associate-*l/97.9%
fma-def97.9%
Applied egg-rr97.9%
Taylor expanded in x around -inf 91.2%
rem-cube-cbrt91.7%
associate-/l*98.0%
Applied egg-rr98.0%
Final simplification97.4%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -40.0) (not (<= (/ x y) 5e-5))) (* t (/ (- x) y)) t))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -40.0) || !((x / y) <= 5e-5)) {
tmp = t * (-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 (((x / y) <= (-40.0d0)) .or. (.not. ((x / y) <= 5d-5))) then
tmp = t * (-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 (((x / y) <= -40.0) || !((x / y) <= 5e-5)) {
tmp = t * (-x / y);
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x / y) <= -40.0) or not ((x / y) <= 5e-5): tmp = t * (-x / y) else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(x / y) <= -40.0) || !(Float64(x / y) <= 5e-5)) tmp = Float64(t * Float64(Float64(-x) / y)); else tmp = t; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((x / y) <= -40.0) || ~(((x / y) <= 5e-5))) tmp = t * (-x / y); else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(x / y), $MachinePrecision], -40.0], N[Not[LessEqual[N[(x / y), $MachinePrecision], 5e-5]], $MachinePrecision]], N[(t * N[((-x) / y), $MachinePrecision]), $MachinePrecision], t]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -40 \lor \neg \left(\frac{x}{y} \leq 5 \cdot 10^{-5}\right):\\
\;\;\;\;t \cdot \frac{-x}{y}\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if (/.f64 x y) < -40 or 5.00000000000000024e-5 < (/.f64 x y) Initial program 96.8%
Taylor expanded in z around 0 61.9%
mul-1-neg61.9%
unsub-neg61.9%
associate-/l*61.3%
associate-/r/61.0%
Simplified61.0%
Taylor expanded in y around 0 60.6%
associate-*r/60.6%
*-commutative60.6%
neg-mul-160.6%
distribute-rgt-neg-in60.6%
*-commutative60.6%
associate-*r/61.9%
distribute-lft-neg-out61.9%
distribute-rgt-neg-in61.9%
mul-1-neg61.9%
associate-*r/61.9%
neg-mul-161.9%
Simplified61.9%
if -40 < (/.f64 x y) < 5.00000000000000024e-5Initial program 97.9%
Taylor expanded in x around 0 74.2%
Final simplification68.0%
(FPCore (x y z t) :precision binary64 (if (or (<= t -4.5e+21) (not (<= t 3.2e+107))) (- t (* t (/ x y))) (+ t (/ z (/ y x)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -4.5e+21) || !(t <= 3.2e+107)) {
tmp = t - (t * (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 ((t <= (-4.5d+21)) .or. (.not. (t <= 3.2d+107))) then
tmp = t - (t * (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 ((t <= -4.5e+21) || !(t <= 3.2e+107)) {
tmp = t - (t * (x / y));
} else {
tmp = t + (z / (y / x));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -4.5e+21) or not (t <= 3.2e+107): tmp = t - (t * (x / y)) else: tmp = t + (z / (y / x)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -4.5e+21) || !(t <= 3.2e+107)) tmp = Float64(t - Float64(t * 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 ((t <= -4.5e+21) || ~((t <= 3.2e+107))) tmp = t - (t * (x / y)); else tmp = t + (z / (y / x)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -4.5e+21], N[Not[LessEqual[t, 3.2e+107]], $MachinePrecision]], N[(t - N[(t * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t + N[(z / N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4.5 \cdot 10^{+21} \lor \neg \left(t \leq 3.2 \cdot 10^{+107}\right):\\
\;\;\;\;t - t \cdot \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;t + \frac{z}{\frac{y}{x}}\\
\end{array}
\end{array}
if t < -4.5e21 or 3.20000000000000029e107 < t Initial program 99.9%
Taylor expanded in z around 0 90.3%
mul-1-neg90.3%
unsub-neg90.3%
associate-*r/92.1%
Simplified92.1%
if -4.5e21 < t < 3.20000000000000029e107Initial program 95.7%
Taylor expanded in z around inf 82.2%
associate-/l*84.9%
Simplified84.9%
Final simplification87.8%
(FPCore (x y z t) :precision binary64 (if (or (<= t -4.2e+21) (not (<= t 7.2e+108))) (- t (/ t (/ y x))) (+ t (/ z (/ y x)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -4.2e+21) || !(t <= 7.2e+108)) {
tmp = t - (t / (y / x));
} 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 ((t <= (-4.2d+21)) .or. (.not. (t <= 7.2d+108))) then
tmp = t - (t / (y / x))
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 ((t <= -4.2e+21) || !(t <= 7.2e+108)) {
tmp = t - (t / (y / x));
} else {
tmp = t + (z / (y / x));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -4.2e+21) or not (t <= 7.2e+108): tmp = t - (t / (y / x)) else: tmp = t + (z / (y / x)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -4.2e+21) || !(t <= 7.2e+108)) tmp = Float64(t - Float64(t / Float64(y / x))); 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 ((t <= -4.2e+21) || ~((t <= 7.2e+108))) tmp = t - (t / (y / x)); else tmp = t + (z / (y / x)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -4.2e+21], N[Not[LessEqual[t, 7.2e+108]], $MachinePrecision]], N[(t - N[(t / N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t + N[(z / N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4.2 \cdot 10^{+21} \lor \neg \left(t \leq 7.2 \cdot 10^{+108}\right):\\
\;\;\;\;t - \frac{t}{\frac{y}{x}}\\
\mathbf{else}:\\
\;\;\;\;t + \frac{z}{\frac{y}{x}}\\
\end{array}
\end{array}
if t < -4.2e21 or 7.2e108 < t Initial program 99.9%
Taylor expanded in z around 0 90.3%
mul-1-neg90.3%
unsub-neg90.3%
associate-/l*92.1%
associate-/r/86.6%
Simplified86.6%
associate-*l/90.3%
associate-/l*92.1%
Applied egg-rr92.1%
if -4.2e21 < t < 7.2e108Initial program 95.7%
Taylor expanded in z around inf 82.2%
associate-/l*84.9%
Simplified84.9%
Final simplification87.8%
(FPCore (x y z t) :precision binary64 (if (<= t -1.42e+22) (- t (/ (* t x) y)) (if (<= t 2.4e+104) (+ t (/ z (/ y x))) (- t (/ t (/ y x))))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1.42e+22) {
tmp = t - ((t * x) / y);
} else if (t <= 2.4e+104) {
tmp = t + (z / (y / x));
} else {
tmp = t - (t / (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 (t <= (-1.42d+22)) then
tmp = t - ((t * x) / y)
else if (t <= 2.4d+104) then
tmp = t + (z / (y / x))
else
tmp = t - (t / (y / x))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1.42e+22) {
tmp = t - ((t * x) / y);
} else if (t <= 2.4e+104) {
tmp = t + (z / (y / x));
} else {
tmp = t - (t / (y / x));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -1.42e+22: tmp = t - ((t * x) / y) elif t <= 2.4e+104: tmp = t + (z / (y / x)) else: tmp = t - (t / (y / x)) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -1.42e+22) tmp = Float64(t - Float64(Float64(t * x) / y)); elseif (t <= 2.4e+104) tmp = Float64(t + Float64(z / Float64(y / x))); else tmp = Float64(t - Float64(t / Float64(y / x))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -1.42e+22) tmp = t - ((t * x) / y); elseif (t <= 2.4e+104) tmp = t + (z / (y / x)); else tmp = t - (t / (y / x)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -1.42e+22], N[(t - N[(N[(t * x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 2.4e+104], N[(t + N[(z / N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t - N[(t / N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.42 \cdot 10^{+22}:\\
\;\;\;\;t - \frac{t \cdot x}{y}\\
\mathbf{elif}\;t \leq 2.4 \cdot 10^{+104}:\\
\;\;\;\;t + \frac{z}{\frac{y}{x}}\\
\mathbf{else}:\\
\;\;\;\;t - \frac{t}{\frac{y}{x}}\\
\end{array}
\end{array}
if t < -1.42e22Initial program 99.9%
Taylor expanded in z around 0 88.3%
mul-1-neg88.3%
unsub-neg88.3%
associate-/l*86.8%
associate-/r/85.2%
Simplified85.2%
*-commutative85.2%
associate-*r/88.3%
Applied egg-rr88.3%
if -1.42e22 < t < 2.4e104Initial program 95.7%
Taylor expanded in z around inf 82.2%
associate-/l*84.9%
Simplified84.9%
if 2.4e104 < t Initial program 99.9%
Taylor expanded in z around 0 93.2%
mul-1-neg93.2%
unsub-neg93.2%
associate-/l*99.9%
associate-/r/88.6%
Simplified88.6%
associate-*l/93.2%
associate-/l*99.9%
Applied egg-rr99.9%
Final simplification88.2%
(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 97.4%
Final simplification97.4%
(FPCore (x y z t) :precision binary64 (if (<= x -2.45e+185) (* t (/ x y)) t))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -2.45e+185) {
tmp = t * (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 (x <= (-2.45d+185)) then
tmp = t * (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 (x <= -2.45e+185) {
tmp = t * (x / y);
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -2.45e+185: tmp = t * (x / y) else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -2.45e+185) tmp = Float64(t * Float64(x / y)); else tmp = t; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -2.45e+185) tmp = t * (x / y); else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -2.45e+185], N[(t * N[(x / y), $MachinePrecision]), $MachinePrecision], t]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.45 \cdot 10^{+185}:\\
\;\;\;\;t \cdot \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if x < -2.44999999999999992e185Initial program 96.4%
Taylor expanded in z around 0 41.8%
mul-1-neg41.8%
unsub-neg41.8%
associate-/l*34.9%
associate-/r/38.4%
Simplified38.4%
Taylor expanded in y around 0 41.8%
associate-*r/41.8%
*-commutative41.8%
neg-mul-141.8%
distribute-rgt-neg-in41.8%
*-commutative41.8%
associate-*r/42.0%
distribute-lft-neg-out42.0%
distribute-rgt-neg-in42.0%
mul-1-neg42.0%
associate-*r/42.0%
neg-mul-142.0%
Simplified42.0%
distribute-frac-neg42.0%
distribute-rgt-neg-in42.0%
clear-num42.0%
div-inv34.9%
distribute-neg-frac34.9%
Applied egg-rr34.9%
div-inv42.0%
clear-num42.0%
*-commutative42.0%
add-sqr-sqrt30.4%
sqrt-unprod30.5%
sqr-neg30.5%
sqrt-unprod15.3%
add-sqr-sqrt20.2%
Applied egg-rr20.2%
if -2.44999999999999992e185 < x Initial program 97.5%
Taylor expanded in x around 0 42.2%
Final simplification39.9%
(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 97.4%
Taylor expanded in x around 0 38.0%
Final simplification38.0%
(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 2023224
(FPCore (x y z t)
:name "Numeric.Signal.Multichannel:$cget from hsignal-0.2.7.1"
:precision binary64
:herbie-target
(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))