
(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 (+ 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 96.9%
Final simplification96.9%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -10.0) (not (<= (/ x y) 1e-7))) (* (/ x y) (- t)) t))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -10.0) || !((x / y) <= 1e-7)) {
tmp = (x / y) * -t;
} 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) <= (-10.0d0)) .or. (.not. ((x / y) <= 1d-7))) then
tmp = (x / y) * -t
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) <= -10.0) || !((x / y) <= 1e-7)) {
tmp = (x / y) * -t;
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x / y) <= -10.0) or not ((x / y) <= 1e-7): tmp = (x / y) * -t else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(x / y) <= -10.0) || !(Float64(x / y) <= 1e-7)) tmp = Float64(Float64(x / y) * Float64(-t)); else tmp = t; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((x / y) <= -10.0) || ~(((x / y) <= 1e-7))) tmp = (x / y) * -t; else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(x / y), $MachinePrecision], -10.0], N[Not[LessEqual[N[(x / y), $MachinePrecision], 1e-7]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] * (-t)), $MachinePrecision], t]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -10 \lor \neg \left(\frac{x}{y} \leq 10^{-7}\right):\\
\;\;\;\;\frac{x}{y} \cdot \left(-t\right)\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if (/.f64 x y) < -10 or 9.9999999999999995e-8 < (/.f64 x y) Initial program 95.5%
fma-def95.5%
Simplified95.5%
Taylor expanded in z around 0 51.6%
mul-1-neg51.6%
unsub-neg51.6%
*-rgt-identity51.6%
associate-*r/53.7%
distribute-lft-out--53.7%
Simplified53.7%
Taylor expanded in x around inf 53.4%
mul-1-neg53.4%
distribute-frac-neg53.4%
Simplified53.4%
if -10 < (/.f64 x y) < 9.9999999999999995e-8Initial program 98.4%
fma-def98.4%
Simplified98.4%
Taylor expanded in x around 0 66.7%
Final simplification59.9%
(FPCore (x y z t) :precision binary64 (if (<= (/ x y) -10.0) (* (/ x y) (- t)) (if (<= (/ x y) 1e-7) t (* x (/ t (- y))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -10.0) {
tmp = (x / y) * -t;
} else if ((x / y) <= 1e-7) {
tmp = t;
} 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) :: tmp
if ((x / y) <= (-10.0d0)) then
tmp = (x / y) * -t
else if ((x / y) <= 1d-7) then
tmp = t
else
tmp = x * (t / -y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -10.0) {
tmp = (x / y) * -t;
} else if ((x / y) <= 1e-7) {
tmp = t;
} else {
tmp = x * (t / -y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x / y) <= -10.0: tmp = (x / y) * -t elif (x / y) <= 1e-7: tmp = t else: tmp = x * (t / -y) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x / y) <= -10.0) tmp = Float64(Float64(x / y) * Float64(-t)); elseif (Float64(x / y) <= 1e-7) tmp = t; else tmp = Float64(x * Float64(t / Float64(-y))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x / y) <= -10.0) tmp = (x / y) * -t; elseif ((x / y) <= 1e-7) tmp = t; else tmp = x * (t / -y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x / y), $MachinePrecision], -10.0], N[(N[(x / y), $MachinePrecision] * (-t)), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 1e-7], t, N[(x * N[(t / (-y)), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -10:\\
\;\;\;\;\frac{x}{y} \cdot \left(-t\right)\\
\mathbf{elif}\;\frac{x}{y} \leq 10^{-7}:\\
\;\;\;\;t\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{t}{-y}\\
\end{array}
\end{array}
if (/.f64 x y) < -10Initial program 96.4%
fma-def96.4%
Simplified96.4%
Taylor expanded in z around 0 52.0%
mul-1-neg52.0%
unsub-neg52.0%
*-rgt-identity52.0%
associate-*r/60.1%
distribute-lft-out--60.1%
Simplified60.1%
Taylor expanded in x around inf 60.1%
mul-1-neg60.1%
distribute-frac-neg60.1%
Simplified60.1%
if -10 < (/.f64 x y) < 9.9999999999999995e-8Initial program 98.4%
fma-def98.4%
Simplified98.4%
Taylor expanded in x around 0 66.7%
if 9.9999999999999995e-8 < (/.f64 x y) Initial program 94.8%
fma-def94.8%
Simplified94.8%
Taylor expanded in z around 0 51.2%
mul-1-neg51.2%
unsub-neg51.2%
*-rgt-identity51.2%
associate-*r/48.7%
distribute-lft-out--48.7%
Simplified48.7%
Taylor expanded in x around inf 48.2%
mul-1-neg48.2%
distribute-frac-neg48.2%
Simplified48.2%
*-commutative48.2%
frac-2neg48.2%
remove-double-neg48.2%
associate-*l/50.7%
Applied egg-rr50.7%
*-commutative50.7%
associate-/l*48.1%
associate-/r/48.2%
*-commutative48.2%
Simplified48.2%
Final simplification59.9%
(FPCore (x y z t) :precision binary64 (if (<= (/ x y) -10.0) (* (/ x y) (- t)) (if (<= (/ x y) 1e-7) t (/ x (/ (- y) t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -10.0) {
tmp = (x / y) * -t;
} else if ((x / y) <= 1e-7) {
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) <= (-10.0d0)) then
tmp = (x / y) * -t
else if ((x / y) <= 1d-7) 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) <= -10.0) {
tmp = (x / y) * -t;
} else if ((x / y) <= 1e-7) {
tmp = t;
} else {
tmp = x / (-y / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x / y) <= -10.0: tmp = (x / y) * -t elif (x / y) <= 1e-7: tmp = t else: tmp = x / (-y / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x / y) <= -10.0) tmp = Float64(Float64(x / y) * Float64(-t)); elseif (Float64(x / y) <= 1e-7) tmp = t; else tmp = Float64(x / Float64(Float64(-y) / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x / y) <= -10.0) tmp = (x / y) * -t; elseif ((x / y) <= 1e-7) tmp = t; else tmp = x / (-y / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x / y), $MachinePrecision], -10.0], N[(N[(x / y), $MachinePrecision] * (-t)), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 1e-7], t, N[(x / N[((-y) / t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -10:\\
\;\;\;\;\frac{x}{y} \cdot \left(-t\right)\\
\mathbf{elif}\;\frac{x}{y} \leq 10^{-7}:\\
\;\;\;\;t\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{-y}{t}}\\
\end{array}
\end{array}
if (/.f64 x y) < -10Initial program 96.4%
fma-def96.4%
Simplified96.4%
Taylor expanded in z around 0 52.0%
mul-1-neg52.0%
unsub-neg52.0%
*-rgt-identity52.0%
associate-*r/60.1%
distribute-lft-out--60.1%
Simplified60.1%
Taylor expanded in x around inf 60.1%
mul-1-neg60.1%
distribute-frac-neg60.1%
Simplified60.1%
if -10 < (/.f64 x y) < 9.9999999999999995e-8Initial program 98.4%
fma-def98.4%
Simplified98.4%
Taylor expanded in x around 0 66.7%
if 9.9999999999999995e-8 < (/.f64 x y) Initial program 94.8%
fma-def94.8%
Simplified94.8%
Taylor expanded in z around 0 51.2%
mul-1-neg51.2%
unsub-neg51.2%
*-rgt-identity51.2%
associate-*r/48.7%
distribute-lft-out--48.7%
Simplified48.7%
Taylor expanded in x around inf 48.2%
mul-1-neg48.2%
distribute-frac-neg48.2%
Simplified48.2%
*-commutative48.2%
frac-2neg48.2%
remove-double-neg48.2%
associate-*l/50.7%
Applied egg-rr50.7%
associate-/l*48.2%
Simplified48.2%
Final simplification59.9%
(FPCore (x y z t) :precision binary64 (if (<= (/ x y) -10.0) (* (/ x y) (- t)) (if (<= (/ x y) 1e-7) t (/ (* x t) (- y)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -10.0) {
tmp = (x / y) * -t;
} else if ((x / y) <= 1e-7) {
tmp = t;
} 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) :: tmp
if ((x / y) <= (-10.0d0)) then
tmp = (x / y) * -t
else if ((x / y) <= 1d-7) then
tmp = t
else
tmp = (x * t) / -y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -10.0) {
tmp = (x / y) * -t;
} else if ((x / y) <= 1e-7) {
tmp = t;
} else {
tmp = (x * t) / -y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x / y) <= -10.0: tmp = (x / y) * -t elif (x / y) <= 1e-7: tmp = t else: tmp = (x * t) / -y return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x / y) <= -10.0) tmp = Float64(Float64(x / y) * Float64(-t)); elseif (Float64(x / y) <= 1e-7) tmp = t; else tmp = Float64(Float64(x * t) / Float64(-y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x / y) <= -10.0) tmp = (x / y) * -t; elseif ((x / y) <= 1e-7) tmp = t; else tmp = (x * t) / -y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x / y), $MachinePrecision], -10.0], N[(N[(x / y), $MachinePrecision] * (-t)), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 1e-7], t, N[(N[(x * t), $MachinePrecision] / (-y)), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -10:\\
\;\;\;\;\frac{x}{y} \cdot \left(-t\right)\\
\mathbf{elif}\;\frac{x}{y} \leq 10^{-7}:\\
\;\;\;\;t\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot t}{-y}\\
\end{array}
\end{array}
if (/.f64 x y) < -10Initial program 96.4%
fma-def96.4%
Simplified96.4%
Taylor expanded in z around 0 52.0%
mul-1-neg52.0%
unsub-neg52.0%
*-rgt-identity52.0%
associate-*r/60.1%
distribute-lft-out--60.1%
Simplified60.1%
Taylor expanded in x around inf 60.1%
mul-1-neg60.1%
distribute-frac-neg60.1%
Simplified60.1%
if -10 < (/.f64 x y) < 9.9999999999999995e-8Initial program 98.4%
fma-def98.4%
Simplified98.4%
Taylor expanded in x around 0 66.7%
if 9.9999999999999995e-8 < (/.f64 x y) Initial program 94.8%
fma-def94.8%
Simplified94.8%
Taylor expanded in z around 0 51.2%
mul-1-neg51.2%
unsub-neg51.2%
*-rgt-identity51.2%
associate-*r/48.7%
distribute-lft-out--48.7%
Simplified48.7%
Taylor expanded in x around inf 48.2%
mul-1-neg48.2%
distribute-frac-neg48.2%
Simplified48.2%
*-commutative48.2%
frac-2neg48.2%
remove-double-neg48.2%
associate-*l/50.7%
Applied egg-rr50.7%
Final simplification60.6%
(FPCore (x y z t) :precision binary64 (if (or (<= z -3.1e+85) (not (<= z 4.2e-86))) (+ t (* (/ x y) z)) (* t (- 1.0 (/ x y)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -3.1e+85) || !(z <= 4.2e-86)) {
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 <= (-3.1d+85)) .or. (.not. (z <= 4.2d-86))) 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 <= -3.1e+85) || !(z <= 4.2e-86)) {
tmp = t + ((x / y) * z);
} else {
tmp = t * (1.0 - (x / y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -3.1e+85) or not (z <= 4.2e-86): 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 <= -3.1e+85) || !(z <= 4.2e-86)) 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 <= -3.1e+85) || ~((z <= 4.2e-86))) 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, -3.1e+85], N[Not[LessEqual[z, 4.2e-86]], $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 -3.1 \cdot 10^{+85} \lor \neg \left(z \leq 4.2 \cdot 10^{-86}\right):\\
\;\;\;\;t + \frac{x}{y} \cdot z\\
\mathbf{else}:\\
\;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\
\end{array}
\end{array}
if z < -3.10000000000000011e85 or 4.2e-86 < z Initial program 98.4%
Taylor expanded in z around inf 84.6%
associate-/l*85.4%
associate-/r/91.3%
Applied egg-rr91.3%
if -3.10000000000000011e85 < z < 4.2e-86Initial program 95.1%
fma-def95.1%
Simplified95.1%
Taylor expanded in z around 0 85.0%
mul-1-neg85.0%
unsub-neg85.0%
*-rgt-identity85.0%
associate-*r/87.4%
distribute-lft-out--87.4%
Simplified87.4%
Final simplification89.5%
(FPCore (x y z t) :precision binary64 (if (or (<= z -9.2e+80) (not (<= z 4.2e-86))) (+ t (* (/ x y) z)) (- t (* x (/ t y)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -9.2e+80) || !(z <= 4.2e-86)) {
tmp = t + ((x / y) * z);
} else {
tmp = t - (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) :: tmp
if ((z <= (-9.2d+80)) .or. (.not. (z <= 4.2d-86))) then
tmp = t + ((x / y) * z)
else
tmp = t - (x * (t / y))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -9.2e+80) || !(z <= 4.2e-86)) {
tmp = t + ((x / y) * z);
} else {
tmp = t - (x * (t / y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -9.2e+80) or not (z <= 4.2e-86): tmp = t + ((x / y) * z) else: tmp = t - (x * (t / y)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -9.2e+80) || !(z <= 4.2e-86)) tmp = Float64(t + Float64(Float64(x / y) * z)); else tmp = Float64(t - Float64(x * Float64(t / y))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -9.2e+80) || ~((z <= 4.2e-86))) tmp = t + ((x / y) * z); else tmp = t - (x * (t / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -9.2e+80], N[Not[LessEqual[z, 4.2e-86]], $MachinePrecision]], N[(t + N[(N[(x / y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], N[(t - N[(x * N[(t / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -9.2 \cdot 10^{+80} \lor \neg \left(z \leq 4.2 \cdot 10^{-86}\right):\\
\;\;\;\;t + \frac{x}{y} \cdot z\\
\mathbf{else}:\\
\;\;\;\;t - x \cdot \frac{t}{y}\\
\end{array}
\end{array}
if z < -9.20000000000000016e80 or 4.2e-86 < z Initial program 98.5%
Taylor expanded in z around inf 84.7%
associate-/l*85.5%
associate-/r/91.4%
Applied egg-rr91.4%
if -9.20000000000000016e80 < z < 4.2e-86Initial program 95.0%
Taylor expanded in z around 0 85.7%
associate-*r/85.7%
mul-1-neg85.7%
*-commutative85.7%
distribute-rgt-neg-out85.7%
associate-*r/87.4%
Simplified87.4%
Final simplification89.5%
(FPCore (x y z t) :precision binary64 (if (<= (/ x y) 5e+17) t (* (/ x y) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= 5e+17) {
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+17) 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+17) {
tmp = t;
} else {
tmp = (x / y) * t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x / y) <= 5e+17: tmp = t else: tmp = (x / y) * t return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x / y) <= 5e+17) tmp = t; else tmp = Float64(Float64(x / y) * t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x / y) <= 5e+17) tmp = t; else tmp = (x / y) * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x / y), $MachinePrecision], 5e+17], t, N[(N[(x / y), $MachinePrecision] * t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq 5 \cdot 10^{+17}:\\
\;\;\;\;t\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} \cdot t\\
\end{array}
\end{array}
if (/.f64 x y) < 5e17Initial program 97.8%
fma-def97.8%
Simplified97.8%
Taylor expanded in x around 0 45.5%
if 5e17 < (/.f64 x y) Initial program 94.3%
fma-def94.3%
Simplified94.3%
Taylor expanded in z around 0 51.3%
mul-1-neg51.3%
unsub-neg51.3%
*-rgt-identity51.3%
associate-*r/48.6%
distribute-lft-out--48.6%
Simplified48.6%
Taylor expanded in x around inf 48.6%
mul-1-neg48.6%
distribute-frac-neg48.6%
Simplified48.6%
associate-*r/51.3%
expm1-log1p-u26.6%
expm1-udef25.9%
associate-/l*25.0%
associate-/r/25.9%
add-sqr-sqrt10.4%
sqrt-unprod11.2%
sqr-neg11.2%
sqrt-unprod0.4%
add-sqr-sqrt2.4%
Applied egg-rr2.4%
expm1-def2.4%
expm1-log1p4.6%
associate-*l/4.7%
associate-*r/11.4%
Simplified11.4%
Final simplification36.5%
(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 96.9%
fma-def96.9%
Simplified96.9%
Taylor expanded in z around 0 58.1%
mul-1-neg58.1%
unsub-neg58.1%
*-rgt-identity58.1%
associate-*r/60.8%
distribute-lft-out--60.7%
Simplified60.7%
Final simplification60.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 96.9%
fma-def96.9%
Simplified96.9%
Taylor expanded in x around 0 33.8%
Final simplification33.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 2023334
(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))