
(FPCore (x y z t) :precision binary64 (+ x (/ (* y (- z x)) t)))
double code(double x, double y, double z, double t) {
return x + ((y * (z - x)) / 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 - x)) / t)
end function
public static double code(double x, double y, double z, double t) {
return x + ((y * (z - x)) / t);
}
def code(x, y, z, t): return x + ((y * (z - x)) / t)
function code(x, y, z, t) return Float64(x + Float64(Float64(y * Float64(z - x)) / t)) end
function tmp = code(x, y, z, t) tmp = x + ((y * (z - x)) / t); end
code[x_, y_, z_, t_] := N[(x + N[(N[(y * N[(z - x), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y \cdot \left(z - x\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 x)) t)))
double code(double x, double y, double z, double t) {
return x + ((y * (z - x)) / 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 - x)) / t)
end function
public static double code(double x, double y, double z, double t) {
return x + ((y * (z - x)) / t);
}
def code(x, y, z, t): return x + ((y * (z - x)) / t)
function code(x, y, z, t) return Float64(x + Float64(Float64(y * Float64(z - x)) / t)) end
function tmp = code(x, y, z, t) tmp = x + ((y * (z - x)) / t); end
code[x_, y_, z_, t_] := N[(x + N[(N[(y * N[(z - x), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y \cdot \left(z - x\right)}{t}
\end{array}
(FPCore (x y z t) :precision binary64 (fma (/ y t) (- z x) x))
double code(double x, double y, double z, double t) {
return fma((y / t), (z - x), x);
}
function code(x, y, z, t) return fma(Float64(y / t), Float64(z - x), x) end
code[x_, y_, z_, t_] := N[(N[(y / t), $MachinePrecision] * N[(z - x), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\frac{y}{t}, z - x, x\right)
\end{array}
Initial program 92.7%
+-commutative92.7%
associate-*l/98.1%
fma-def98.1%
Simplified98.1%
Final simplification98.1%
(FPCore (x y z t)
:precision binary64
(if (<= t -5.2e+61)
x
(if (<= t -3.15e-52)
(* y (/ (- x) t))
(if (<= t -4e-107) x (if (<= t 1.35e-47) (* (/ y t) (- x)) x)))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -5.2e+61) {
tmp = x;
} else if (t <= -3.15e-52) {
tmp = y * (-x / t);
} else if (t <= -4e-107) {
tmp = x;
} else if (t <= 1.35e-47) {
tmp = (y / t) * -x;
} else {
tmp = 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 <= (-5.2d+61)) then
tmp = x
else if (t <= (-3.15d-52)) then
tmp = y * (-x / t)
else if (t <= (-4d-107)) then
tmp = x
else if (t <= 1.35d-47) then
tmp = (y / t) * -x
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= -5.2e+61) {
tmp = x;
} else if (t <= -3.15e-52) {
tmp = y * (-x / t);
} else if (t <= -4e-107) {
tmp = x;
} else if (t <= 1.35e-47) {
tmp = (y / t) * -x;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -5.2e+61: tmp = x elif t <= -3.15e-52: tmp = y * (-x / t) elif t <= -4e-107: tmp = x elif t <= 1.35e-47: tmp = (y / t) * -x else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -5.2e+61) tmp = x; elseif (t <= -3.15e-52) tmp = Float64(y * Float64(Float64(-x) / t)); elseif (t <= -4e-107) tmp = x; elseif (t <= 1.35e-47) tmp = Float64(Float64(y / t) * Float64(-x)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -5.2e+61) tmp = x; elseif (t <= -3.15e-52) tmp = y * (-x / t); elseif (t <= -4e-107) tmp = x; elseif (t <= 1.35e-47) tmp = (y / t) * -x; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -5.2e+61], x, If[LessEqual[t, -3.15e-52], N[(y * N[((-x) / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, -4e-107], x, If[LessEqual[t, 1.35e-47], N[(N[(y / t), $MachinePrecision] * (-x)), $MachinePrecision], x]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -5.2 \cdot 10^{+61}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq -3.15 \cdot 10^{-52}:\\
\;\;\;\;y \cdot \frac{-x}{t}\\
\mathbf{elif}\;t \leq -4 \cdot 10^{-107}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq 1.35 \cdot 10^{-47}:\\
\;\;\;\;\frac{y}{t} \cdot \left(-x\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if t < -5.19999999999999945e61 or -3.1500000000000002e-52 < t < -4e-107 or 1.3499999999999999e-47 < t Initial program 87.4%
associate-*l/98.7%
Simplified98.7%
Taylor expanded in y around 0 66.0%
if -5.19999999999999945e61 < t < -3.1500000000000002e-52Initial program 99.9%
associate-*l/96.2%
Simplified96.2%
Taylor expanded in x around inf 40.5%
mul-1-neg40.5%
unsub-neg40.5%
Simplified40.5%
Taylor expanded in y around inf 28.7%
mul-1-neg28.7%
distribute-frac-neg28.7%
Simplified28.7%
Taylor expanded in x around 0 32.4%
associate-*r/32.4%
*-commutative32.4%
neg-mul-132.4%
distribute-rgt-neg-out32.4%
associate-*r/32.4%
Simplified32.4%
if -4e-107 < t < 1.3499999999999999e-47Initial program 98.7%
associate-*l/97.7%
Simplified97.7%
Taylor expanded in x around inf 55.9%
mul-1-neg55.9%
unsub-neg55.9%
Simplified55.9%
Taylor expanded in y around inf 48.7%
mul-1-neg48.7%
distribute-frac-neg48.7%
Simplified48.7%
Final simplification56.5%
(FPCore (x y z t)
:precision binary64
(if (<= t -7.5e+62)
x
(if (<= t -2.85e-52)
(* y (/ (- x) t))
(if (<= t -3.5e-107) x (if (<= t 2.4e-48) (/ x (/ (- t) y)) x)))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -7.5e+62) {
tmp = x;
} else if (t <= -2.85e-52) {
tmp = y * (-x / t);
} else if (t <= -3.5e-107) {
tmp = x;
} else if (t <= 2.4e-48) {
tmp = x / (-t / y);
} else {
tmp = 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 <= (-7.5d+62)) then
tmp = x
else if (t <= (-2.85d-52)) then
tmp = y * (-x / t)
else if (t <= (-3.5d-107)) then
tmp = x
else if (t <= 2.4d-48) then
tmp = x / (-t / y)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= -7.5e+62) {
tmp = x;
} else if (t <= -2.85e-52) {
tmp = y * (-x / t);
} else if (t <= -3.5e-107) {
tmp = x;
} else if (t <= 2.4e-48) {
tmp = x / (-t / y);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -7.5e+62: tmp = x elif t <= -2.85e-52: tmp = y * (-x / t) elif t <= -3.5e-107: tmp = x elif t <= 2.4e-48: tmp = x / (-t / y) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -7.5e+62) tmp = x; elseif (t <= -2.85e-52) tmp = Float64(y * Float64(Float64(-x) / t)); elseif (t <= -3.5e-107) tmp = x; elseif (t <= 2.4e-48) tmp = Float64(x / Float64(Float64(-t) / y)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -7.5e+62) tmp = x; elseif (t <= -2.85e-52) tmp = y * (-x / t); elseif (t <= -3.5e-107) tmp = x; elseif (t <= 2.4e-48) tmp = x / (-t / y); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -7.5e+62], x, If[LessEqual[t, -2.85e-52], N[(y * N[((-x) / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, -3.5e-107], x, If[LessEqual[t, 2.4e-48], N[(x / N[((-t) / y), $MachinePrecision]), $MachinePrecision], x]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -7.5 \cdot 10^{+62}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq -2.85 \cdot 10^{-52}:\\
\;\;\;\;y \cdot \frac{-x}{t}\\
\mathbf{elif}\;t \leq -3.5 \cdot 10^{-107}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq 2.4 \cdot 10^{-48}:\\
\;\;\;\;\frac{x}{\frac{-t}{y}}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if t < -7.49999999999999998e62 or -2.8499999999999999e-52 < t < -3.49999999999999985e-107 or 2.4e-48 < t Initial program 87.4%
associate-*l/98.7%
Simplified98.7%
Taylor expanded in y around 0 66.0%
if -7.49999999999999998e62 < t < -2.8499999999999999e-52Initial program 99.9%
associate-*l/96.2%
Simplified96.2%
Taylor expanded in x around inf 40.5%
mul-1-neg40.5%
unsub-neg40.5%
Simplified40.5%
Taylor expanded in y around inf 28.7%
mul-1-neg28.7%
distribute-frac-neg28.7%
Simplified28.7%
Taylor expanded in x around 0 32.4%
associate-*r/32.4%
*-commutative32.4%
neg-mul-132.4%
distribute-rgt-neg-out32.4%
associate-*r/32.4%
Simplified32.4%
if -3.49999999999999985e-107 < t < 2.4e-48Initial program 98.7%
associate-*l/97.7%
Simplified97.7%
Taylor expanded in x around inf 55.9%
mul-1-neg55.9%
unsub-neg55.9%
Simplified55.9%
Taylor expanded in y around inf 48.7%
mul-1-neg48.7%
distribute-frac-neg48.7%
Simplified48.7%
Taylor expanded in x around 0 42.7%
associate-*r/42.7%
*-commutative42.7%
neg-mul-142.7%
distribute-rgt-neg-out42.7%
associate-*r/38.3%
Simplified38.3%
*-commutative38.3%
distribute-frac-neg38.3%
distribute-lft-neg-in38.3%
associate-/r/48.8%
frac-2neg48.8%
distribute-neg-frac48.8%
remove-double-neg48.8%
distribute-neg-frac48.8%
Applied egg-rr48.8%
Final simplification56.5%
(FPCore (x y z t)
:precision binary64
(if (<= t -4.9e+61)
x
(if (<= t -2.8e-52)
(/ (* y x) (- t))
(if (<= t -1.2e-107) x (if (<= t 2.1e-46) (/ x (/ (- t) y)) x)))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -4.9e+61) {
tmp = x;
} else if (t <= -2.8e-52) {
tmp = (y * x) / -t;
} else if (t <= -1.2e-107) {
tmp = x;
} else if (t <= 2.1e-46) {
tmp = x / (-t / y);
} else {
tmp = 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.9d+61)) then
tmp = x
else if (t <= (-2.8d-52)) then
tmp = (y * x) / -t
else if (t <= (-1.2d-107)) then
tmp = x
else if (t <= 2.1d-46) then
tmp = x / (-t / y)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= -4.9e+61) {
tmp = x;
} else if (t <= -2.8e-52) {
tmp = (y * x) / -t;
} else if (t <= -1.2e-107) {
tmp = x;
} else if (t <= 2.1e-46) {
tmp = x / (-t / y);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -4.9e+61: tmp = x elif t <= -2.8e-52: tmp = (y * x) / -t elif t <= -1.2e-107: tmp = x elif t <= 2.1e-46: tmp = x / (-t / y) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -4.9e+61) tmp = x; elseif (t <= -2.8e-52) tmp = Float64(Float64(y * x) / Float64(-t)); elseif (t <= -1.2e-107) tmp = x; elseif (t <= 2.1e-46) tmp = Float64(x / Float64(Float64(-t) / y)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -4.9e+61) tmp = x; elseif (t <= -2.8e-52) tmp = (y * x) / -t; elseif (t <= -1.2e-107) tmp = x; elseif (t <= 2.1e-46) tmp = x / (-t / y); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -4.9e+61], x, If[LessEqual[t, -2.8e-52], N[(N[(y * x), $MachinePrecision] / (-t)), $MachinePrecision], If[LessEqual[t, -1.2e-107], x, If[LessEqual[t, 2.1e-46], N[(x / N[((-t) / y), $MachinePrecision]), $MachinePrecision], x]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4.9 \cdot 10^{+61}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq -2.8 \cdot 10^{-52}:\\
\;\;\;\;\frac{y \cdot x}{-t}\\
\mathbf{elif}\;t \leq -1.2 \cdot 10^{-107}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq 2.1 \cdot 10^{-46}:\\
\;\;\;\;\frac{x}{\frac{-t}{y}}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if t < -4.90000000000000025e61 or -2.79999999999999995e-52 < t < -1.19999999999999997e-107 or 2.09999999999999987e-46 < t Initial program 87.4%
associate-*l/98.7%
Simplified98.7%
Taylor expanded in y around 0 66.0%
if -4.90000000000000025e61 < t < -2.79999999999999995e-52Initial program 99.9%
associate-*l/96.2%
Simplified96.2%
Taylor expanded in x around inf 40.5%
mul-1-neg40.5%
unsub-neg40.5%
Simplified40.5%
Taylor expanded in y around inf 28.7%
mul-1-neg28.7%
distribute-frac-neg28.7%
Simplified28.7%
frac-2neg28.7%
remove-double-neg28.7%
associate-*r/32.4%
*-commutative32.4%
Applied egg-rr32.4%
if -1.19999999999999997e-107 < t < 2.09999999999999987e-46Initial program 98.7%
associate-*l/97.7%
Simplified97.7%
Taylor expanded in x around inf 55.9%
mul-1-neg55.9%
unsub-neg55.9%
Simplified55.9%
Taylor expanded in y around inf 48.7%
mul-1-neg48.7%
distribute-frac-neg48.7%
Simplified48.7%
Taylor expanded in x around 0 42.7%
associate-*r/42.7%
*-commutative42.7%
neg-mul-142.7%
distribute-rgt-neg-out42.7%
associate-*r/38.3%
Simplified38.3%
*-commutative38.3%
distribute-frac-neg38.3%
distribute-lft-neg-in38.3%
associate-/r/48.8%
frac-2neg48.8%
distribute-neg-frac48.8%
remove-double-neg48.8%
distribute-neg-frac48.8%
Applied egg-rr48.8%
Final simplification56.5%
(FPCore (x y z t) :precision binary64 (if (or (<= x -2.9e-77) (not (<= x 5.4e+78))) (* x (- 1.0 (/ y t))) (+ x (* (/ y t) z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -2.9e-77) || !(x <= 5.4e+78)) {
tmp = x * (1.0 - (y / t));
} else {
tmp = x + ((y / 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 ((x <= (-2.9d-77)) .or. (.not. (x <= 5.4d+78))) then
tmp = x * (1.0d0 - (y / t))
else
tmp = x + ((y / t) * z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -2.9e-77) || !(x <= 5.4e+78)) {
tmp = x * (1.0 - (y / t));
} else {
tmp = x + ((y / t) * z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -2.9e-77) or not (x <= 5.4e+78): tmp = x * (1.0 - (y / t)) else: tmp = x + ((y / t) * z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -2.9e-77) || !(x <= 5.4e+78)) tmp = Float64(x * Float64(1.0 - Float64(y / t))); else tmp = Float64(x + Float64(Float64(y / t) * z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -2.9e-77) || ~((x <= 5.4e+78))) tmp = x * (1.0 - (y / t)); else tmp = x + ((y / t) * z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -2.9e-77], N[Not[LessEqual[x, 5.4e+78]], $MachinePrecision]], N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y / t), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.9 \cdot 10^{-77} \lor \neg \left(x \leq 5.4 \cdot 10^{+78}\right):\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{t} \cdot z\\
\end{array}
\end{array}
if x < -2.8999999999999999e-77 or 5.40000000000000009e78 < x Initial program 91.4%
associate-*l/98.6%
Simplified98.6%
Taylor expanded in x around inf 89.4%
mul-1-neg89.4%
unsub-neg89.4%
Simplified89.4%
if -2.8999999999999999e-77 < x < 5.40000000000000009e78Initial program 93.9%
associate-*l/97.7%
Simplified97.7%
Taylor expanded in z around inf 86.3%
associate-*l/90.0%
*-commutative90.0%
Simplified90.0%
Final simplification89.7%
(FPCore (x y z t) :precision binary64 (if (<= x -3.05e-75) (* x (- 1.0 (/ y t))) (if (<= x 5.5e+78) (+ x (* (/ y t) z)) (- x (/ x (/ t y))))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -3.05e-75) {
tmp = x * (1.0 - (y / t));
} else if (x <= 5.5e+78) {
tmp = x + ((y / t) * z);
} else {
tmp = x - (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 <= (-3.05d-75)) then
tmp = x * (1.0d0 - (y / t))
else if (x <= 5.5d+78) then
tmp = x + ((y / t) * z)
else
tmp = x - (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 <= -3.05e-75) {
tmp = x * (1.0 - (y / t));
} else if (x <= 5.5e+78) {
tmp = x + ((y / t) * z);
} else {
tmp = x - (x / (t / y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -3.05e-75: tmp = x * (1.0 - (y / t)) elif x <= 5.5e+78: tmp = x + ((y / t) * z) else: tmp = x - (x / (t / y)) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -3.05e-75) tmp = Float64(x * Float64(1.0 - Float64(y / t))); elseif (x <= 5.5e+78) tmp = Float64(x + Float64(Float64(y / t) * z)); else tmp = Float64(x - Float64(x / Float64(t / y))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -3.05e-75) tmp = x * (1.0 - (y / t)); elseif (x <= 5.5e+78) tmp = x + ((y / t) * z); else tmp = x - (x / (t / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -3.05e-75], N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 5.5e+78], N[(x + N[(N[(y / t), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], N[(x - N[(x / N[(t / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.05 \cdot 10^{-75}:\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\mathbf{elif}\;x \leq 5.5 \cdot 10^{+78}:\\
\;\;\;\;x + \frac{y}{t} \cdot z\\
\mathbf{else}:\\
\;\;\;\;x - \frac{x}{\frac{t}{y}}\\
\end{array}
\end{array}
if x < -3.05000000000000021e-75Initial program 92.7%
associate-*l/97.8%
Simplified97.8%
Taylor expanded in x around inf 87.8%
mul-1-neg87.8%
unsub-neg87.8%
Simplified87.8%
if -3.05000000000000021e-75 < x < 5.4999999999999997e78Initial program 93.9%
associate-*l/97.7%
Simplified97.7%
Taylor expanded in z around inf 86.3%
associate-*l/90.0%
*-commutative90.0%
Simplified90.0%
if 5.4999999999999997e78 < x Initial program 89.2%
associate-*l/99.9%
Simplified99.9%
Taylor expanded in z around 0 83.1%
mul-1-neg83.1%
associate-/l*92.3%
distribute-neg-frac92.3%
Simplified92.3%
Final simplification89.7%
(FPCore (x y z t) :precision binary64 (if (<= t -4.2e-107) x (if (<= t 3.2e-46) (* (/ y t) (- x)) x)))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -4.2e-107) {
tmp = x;
} else if (t <= 3.2e-46) {
tmp = (y / t) * -x;
} else {
tmp = 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-107)) then
tmp = x
else if (t <= 3.2d-46) then
tmp = (y / t) * -x
else
tmp = 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-107) {
tmp = x;
} else if (t <= 3.2e-46) {
tmp = (y / t) * -x;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -4.2e-107: tmp = x elif t <= 3.2e-46: tmp = (y / t) * -x else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -4.2e-107) tmp = x; elseif (t <= 3.2e-46) tmp = Float64(Float64(y / t) * Float64(-x)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -4.2e-107) tmp = x; elseif (t <= 3.2e-46) tmp = (y / t) * -x; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -4.2e-107], x, If[LessEqual[t, 3.2e-46], N[(N[(y / t), $MachinePrecision] * (-x)), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4.2 \cdot 10^{-107}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq 3.2 \cdot 10^{-46}:\\
\;\;\;\;\frac{y}{t} \cdot \left(-x\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if t < -4.1999999999999998e-107 or 3.1999999999999999e-46 < t Initial program 89.3%
associate-*l/98.3%
Simplified98.3%
Taylor expanded in y around 0 58.5%
if -4.1999999999999998e-107 < t < 3.1999999999999999e-46Initial program 98.7%
associate-*l/97.7%
Simplified97.7%
Taylor expanded in x around inf 55.9%
mul-1-neg55.9%
unsub-neg55.9%
Simplified55.9%
Taylor expanded in y around inf 48.7%
mul-1-neg48.7%
distribute-frac-neg48.7%
Simplified48.7%
Final simplification54.9%
(FPCore (x y z t) :precision binary64 (+ x (* (/ y t) (- z x))))
double code(double x, double y, double z, double t) {
return x + ((y / t) * (z - 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 = x + ((y / t) * (z - x))
end function
public static double code(double x, double y, double z, double t) {
return x + ((y / t) * (z - x));
}
def code(x, y, z, t): return x + ((y / t) * (z - x))
function code(x, y, z, t) return Float64(x + Float64(Float64(y / t) * Float64(z - x))) end
function tmp = code(x, y, z, t) tmp = x + ((y / t) * (z - x)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(y / t), $MachinePrecision] * N[(z - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y}{t} \cdot \left(z - x\right)
\end{array}
Initial program 92.7%
associate-*l/98.1%
Simplified98.1%
Final simplification98.1%
(FPCore (x y z t) :precision binary64 (* x (- 1.0 (/ y t))))
double code(double x, double y, double z, double t) {
return x * (1.0 - (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 * (1.0d0 - (y / t))
end function
public static double code(double x, double y, double z, double t) {
return x * (1.0 - (y / t));
}
def code(x, y, z, t): return x * (1.0 - (y / t))
function code(x, y, z, t) return Float64(x * Float64(1.0 - Float64(y / t))) end
function tmp = code(x, y, z, t) tmp = x * (1.0 - (y / t)); end
code[x_, y_, z_, t_] := N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(1 - \frac{y}{t}\right)
\end{array}
Initial program 92.7%
associate-*l/98.1%
Simplified98.1%
Taylor expanded in x around inf 66.2%
mul-1-neg66.2%
unsub-neg66.2%
Simplified66.2%
Final simplification66.2%
(FPCore (x y z t) :precision binary64 x)
double code(double x, double y, double z, double t) {
return 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 = x
end function
public static double code(double x, double y, double z, double t) {
return x;
}
def code(x, y, z, t): return x
function code(x, y, z, t) return x end
function tmp = code(x, y, z, t) tmp = x; end
code[x_, y_, z_, t_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 92.7%
associate-*l/98.1%
Simplified98.1%
Taylor expanded in y around 0 39.9%
Final simplification39.9%
(FPCore (x y z t) :precision binary64 (- x (+ (* x (/ y t)) (* (- z) (/ y t)))))
double code(double x, double y, double z, double t) {
return x - ((x * (y / t)) + (-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 - ((x * (y / t)) + (-z * (y / t)))
end function
public static double code(double x, double y, double z, double t) {
return x - ((x * (y / t)) + (-z * (y / t)));
}
def code(x, y, z, t): return x - ((x * (y / t)) + (-z * (y / t)))
function code(x, y, z, t) return Float64(x - Float64(Float64(x * Float64(y / t)) + Float64(Float64(-z) * Float64(y / t)))) end
function tmp = code(x, y, z, t) tmp = x - ((x * (y / t)) + (-z * (y / t))); end
code[x_, y_, z_, t_] := N[(x - N[(N[(x * N[(y / t), $MachinePrecision]), $MachinePrecision] + N[((-z) * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - \left(x \cdot \frac{y}{t} + \left(-z\right) \cdot \frac{y}{t}\right)
\end{array}
herbie shell --seed 2023336
(FPCore (x y z t)
:name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, D"
:precision binary64
:herbie-target
(- x (+ (* x (/ y t)) (* (- z) (/ y t))))
(+ x (/ (* y (- z x)) t)))