
(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 11 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 (+ x (/ (- z x) (/ t y))))
double code(double x, double y, double z, double t) {
return x + ((z - x) / (t / 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 = x + ((z - x) / (t / y))
end function
public static double code(double x, double y, double z, double t) {
return x + ((z - x) / (t / y));
}
def code(x, y, z, t): return x + ((z - x) / (t / y))
function code(x, y, z, t) return Float64(x + Float64(Float64(z - x) / Float64(t / y))) end
function tmp = code(x, y, z, t) tmp = x + ((z - x) / (t / y)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(z - x), $MachinePrecision] / N[(t / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{z - x}{\frac{t}{y}}
\end{array}
Initial program 95.4%
Taylor expanded in z around 0 91.9%
+-commutative91.9%
*-commutative91.9%
associate-*r/90.0%
mul-1-neg90.0%
associate-/l*89.5%
distribute-lft-neg-in89.5%
distribute-rgt-in97.3%
sub-neg97.3%
Simplified97.3%
*-commutative97.3%
clear-num97.3%
un-div-inv97.4%
Applied egg-rr97.4%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (- 1.0 (/ y t)))))
(if (<= x -3.8e-31)
t_1
(if (<= x -1.65e-155)
(* (- z x) (/ y t))
(if (<= x -1.32e-186) x (if (<= x 9.2e-23) (* y (/ (- z x) t)) t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = x * (1.0 - (y / t));
double tmp;
if (x <= -3.8e-31) {
tmp = t_1;
} else if (x <= -1.65e-155) {
tmp = (z - x) * (y / t);
} else if (x <= -1.32e-186) {
tmp = x;
} else if (x <= 9.2e-23) {
tmp = y * ((z - x) / 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 * (1.0d0 - (y / t))
if (x <= (-3.8d-31)) then
tmp = t_1
else if (x <= (-1.65d-155)) then
tmp = (z - x) * (y / t)
else if (x <= (-1.32d-186)) then
tmp = x
else if (x <= 9.2d-23) then
tmp = y * ((z - x) / 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 * (1.0 - (y / t));
double tmp;
if (x <= -3.8e-31) {
tmp = t_1;
} else if (x <= -1.65e-155) {
tmp = (z - x) * (y / t);
} else if (x <= -1.32e-186) {
tmp = x;
} else if (x <= 9.2e-23) {
tmp = y * ((z - x) / t);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (1.0 - (y / t)) tmp = 0 if x <= -3.8e-31: tmp = t_1 elif x <= -1.65e-155: tmp = (z - x) * (y / t) elif x <= -1.32e-186: tmp = x elif x <= 9.2e-23: tmp = y * ((z - x) / t) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(1.0 - Float64(y / t))) tmp = 0.0 if (x <= -3.8e-31) tmp = t_1; elseif (x <= -1.65e-155) tmp = Float64(Float64(z - x) * Float64(y / t)); elseif (x <= -1.32e-186) tmp = x; elseif (x <= 9.2e-23) tmp = Float64(y * Float64(Float64(z - x) / t)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (1.0 - (y / t)); tmp = 0.0; if (x <= -3.8e-31) tmp = t_1; elseif (x <= -1.65e-155) tmp = (z - x) * (y / t); elseif (x <= -1.32e-186) tmp = x; elseif (x <= 9.2e-23) tmp = y * ((z - x) / t); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -3.8e-31], t$95$1, If[LessEqual[x, -1.65e-155], N[(N[(z - x), $MachinePrecision] * N[(y / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -1.32e-186], x, If[LessEqual[x, 9.2e-23], N[(y * N[(N[(z - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(1 - \frac{y}{t}\right)\\
\mathbf{if}\;x \leq -3.8 \cdot 10^{-31}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq -1.65 \cdot 10^{-155}:\\
\;\;\;\;\left(z - x\right) \cdot \frac{y}{t}\\
\mathbf{elif}\;x \leq -1.32 \cdot 10^{-186}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 9.2 \cdot 10^{-23}:\\
\;\;\;\;y \cdot \frac{z - x}{t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -3.8e-31 or 9.2000000000000004e-23 < x Initial program 94.9%
Taylor expanded in x around inf 85.2%
mul-1-neg85.2%
unsub-neg85.2%
Simplified85.2%
if -3.8e-31 < x < -1.64999999999999993e-155Initial program 95.4%
Taylor expanded in y around -inf 70.8%
Taylor expanded in z around 0 70.8%
+-commutative95.4%
*-commutative95.4%
associate-*r/95.4%
mul-1-neg95.4%
associate-/l*91.3%
distribute-lft-neg-in91.3%
distribute-rgt-in95.9%
sub-neg95.9%
Simplified71.3%
if -1.64999999999999993e-155 < x < -1.32e-186Initial program 100.0%
Taylor expanded in y around 0 87.6%
if -1.32e-186 < x < 9.2000000000000004e-23Initial program 95.7%
Taylor expanded in y around -inf 80.1%
associate-/l*79.0%
*-commutative79.0%
Applied egg-rr79.0%
Final simplification81.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (- z x) (/ y t))) (t_2 (* x (- 1.0 (/ y t)))))
(if (<= x -3.4e-30)
t_2
(if (<= x -1.65e-155)
t_1
(if (<= x -4e-189) x (if (<= x 9.2e-23) t_1 t_2))))))
double code(double x, double y, double z, double t) {
double t_1 = (z - x) * (y / t);
double t_2 = x * (1.0 - (y / t));
double tmp;
if (x <= -3.4e-30) {
tmp = t_2;
} else if (x <= -1.65e-155) {
tmp = t_1;
} else if (x <= -4e-189) {
tmp = x;
} else if (x <= 9.2e-23) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = (z - x) * (y / t)
t_2 = x * (1.0d0 - (y / t))
if (x <= (-3.4d-30)) then
tmp = t_2
else if (x <= (-1.65d-155)) then
tmp = t_1
else if (x <= (-4d-189)) then
tmp = x
else if (x <= 9.2d-23) then
tmp = t_1
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (z - x) * (y / t);
double t_2 = x * (1.0 - (y / t));
double tmp;
if (x <= -3.4e-30) {
tmp = t_2;
} else if (x <= -1.65e-155) {
tmp = t_1;
} else if (x <= -4e-189) {
tmp = x;
} else if (x <= 9.2e-23) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t): t_1 = (z - x) * (y / t) t_2 = x * (1.0 - (y / t)) tmp = 0 if x <= -3.4e-30: tmp = t_2 elif x <= -1.65e-155: tmp = t_1 elif x <= -4e-189: tmp = x elif x <= 9.2e-23: tmp = t_1 else: tmp = t_2 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(z - x) * Float64(y / t)) t_2 = Float64(x * Float64(1.0 - Float64(y / t))) tmp = 0.0 if (x <= -3.4e-30) tmp = t_2; elseif (x <= -1.65e-155) tmp = t_1; elseif (x <= -4e-189) tmp = x; elseif (x <= 9.2e-23) tmp = t_1; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (z - x) * (y / t); t_2 = x * (1.0 - (y / t)); tmp = 0.0; if (x <= -3.4e-30) tmp = t_2; elseif (x <= -1.65e-155) tmp = t_1; elseif (x <= -4e-189) tmp = x; elseif (x <= 9.2e-23) tmp = t_1; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(z - x), $MachinePrecision] * N[(y / t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -3.4e-30], t$95$2, If[LessEqual[x, -1.65e-155], t$95$1, If[LessEqual[x, -4e-189], x, If[LessEqual[x, 9.2e-23], t$95$1, t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(z - x\right) \cdot \frac{y}{t}\\
t_2 := x \cdot \left(1 - \frac{y}{t}\right)\\
\mathbf{if}\;x \leq -3.4 \cdot 10^{-30}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;x \leq -1.65 \cdot 10^{-155}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq -4 \cdot 10^{-189}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 9.2 \cdot 10^{-23}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if x < -3.4000000000000003e-30 or 9.2000000000000004e-23 < x Initial program 94.9%
Taylor expanded in x around inf 85.2%
mul-1-neg85.2%
unsub-neg85.2%
Simplified85.2%
if -3.4000000000000003e-30 < x < -1.64999999999999993e-155 or -4.00000000000000027e-189 < x < 9.2000000000000004e-23Initial program 95.7%
Taylor expanded in y around -inf 78.3%
Taylor expanded in z around 0 77.4%
+-commutative94.8%
*-commutative94.8%
associate-*r/93.1%
mul-1-neg93.1%
associate-/l*87.1%
distribute-lft-neg-in87.1%
distribute-rgt-in94.2%
sub-neg94.2%
Simplified77.0%
if -1.64999999999999993e-155 < x < -4.00000000000000027e-189Initial program 100.0%
Taylor expanded in y around 0 87.6%
Final simplification81.6%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* t (/ x t))) (t_2 (* z (/ y t))))
(if (<= x -2.6e-28)
t_1
(if (<= x -1.12e-151)
t_2
(if (<= x -1.32e-186) x (if (<= x 1.2e-21) t_2 t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = t * (x / t);
double t_2 = z * (y / t);
double tmp;
if (x <= -2.6e-28) {
tmp = t_1;
} else if (x <= -1.12e-151) {
tmp = t_2;
} else if (x <= -1.32e-186) {
tmp = x;
} else if (x <= 1.2e-21) {
tmp = t_2;
} 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) :: t_2
real(8) :: tmp
t_1 = t * (x / t)
t_2 = z * (y / t)
if (x <= (-2.6d-28)) then
tmp = t_1
else if (x <= (-1.12d-151)) then
tmp = t_2
else if (x <= (-1.32d-186)) then
tmp = x
else if (x <= 1.2d-21) then
tmp = t_2
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 * (x / t);
double t_2 = z * (y / t);
double tmp;
if (x <= -2.6e-28) {
tmp = t_1;
} else if (x <= -1.12e-151) {
tmp = t_2;
} else if (x <= -1.32e-186) {
tmp = x;
} else if (x <= 1.2e-21) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = t * (x / t) t_2 = z * (y / t) tmp = 0 if x <= -2.6e-28: tmp = t_1 elif x <= -1.12e-151: tmp = t_2 elif x <= -1.32e-186: tmp = x elif x <= 1.2e-21: tmp = t_2 else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(t * Float64(x / t)) t_2 = Float64(z * Float64(y / t)) tmp = 0.0 if (x <= -2.6e-28) tmp = t_1; elseif (x <= -1.12e-151) tmp = t_2; elseif (x <= -1.32e-186) tmp = x; elseif (x <= 1.2e-21) tmp = t_2; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = t * (x / t); t_2 = z * (y / t); tmp = 0.0; if (x <= -2.6e-28) tmp = t_1; elseif (x <= -1.12e-151) tmp = t_2; elseif (x <= -1.32e-186) tmp = x; elseif (x <= 1.2e-21) tmp = t_2; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(t * N[(x / t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -2.6e-28], t$95$1, If[LessEqual[x, -1.12e-151], t$95$2, If[LessEqual[x, -1.32e-186], x, If[LessEqual[x, 1.2e-21], t$95$2, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t \cdot \frac{x}{t}\\
t_2 := z \cdot \frac{y}{t}\\
\mathbf{if}\;x \leq -2.6 \cdot 10^{-28}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq -1.12 \cdot 10^{-151}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;x \leq -1.32 \cdot 10^{-186}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 1.2 \cdot 10^{-21}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -2.6e-28 or 1.2e-21 < x Initial program 94.9%
Taylor expanded in t around 0 80.1%
Taylor expanded in t around inf 35.4%
*-commutative35.4%
Simplified35.4%
*-commutative35.4%
associate-/l*60.0%
Applied egg-rr60.0%
if -2.6e-28 < x < -1.11999999999999994e-151 or -1.32e-186 < x < 1.2e-21Initial program 95.7%
Taylor expanded in y around -inf 78.3%
Taylor expanded in z around inf 64.6%
associate-/l*79.7%
Simplified62.9%
clear-num62.0%
un-div-inv62.5%
Applied egg-rr62.5%
associate-/r/66.4%
Applied egg-rr66.4%
if -1.11999999999999994e-151 < x < -1.32e-186Initial program 100.0%
Taylor expanded in y around 0 87.6%
Final simplification63.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* t (/ x t))) (t_2 (* y (/ z t))))
(if (<= x -4.4e-31)
t_1
(if (<= x -1.35e-153)
t_2
(if (<= x -1.32e-186) x (if (<= x 2.5e-22) t_2 t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = t * (x / t);
double t_2 = y * (z / t);
double tmp;
if (x <= -4.4e-31) {
tmp = t_1;
} else if (x <= -1.35e-153) {
tmp = t_2;
} else if (x <= -1.32e-186) {
tmp = x;
} else if (x <= 2.5e-22) {
tmp = t_2;
} 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) :: t_2
real(8) :: tmp
t_1 = t * (x / t)
t_2 = y * (z / t)
if (x <= (-4.4d-31)) then
tmp = t_1
else if (x <= (-1.35d-153)) then
tmp = t_2
else if (x <= (-1.32d-186)) then
tmp = x
else if (x <= 2.5d-22) then
tmp = t_2
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 * (x / t);
double t_2 = y * (z / t);
double tmp;
if (x <= -4.4e-31) {
tmp = t_1;
} else if (x <= -1.35e-153) {
tmp = t_2;
} else if (x <= -1.32e-186) {
tmp = x;
} else if (x <= 2.5e-22) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = t * (x / t) t_2 = y * (z / t) tmp = 0 if x <= -4.4e-31: tmp = t_1 elif x <= -1.35e-153: tmp = t_2 elif x <= -1.32e-186: tmp = x elif x <= 2.5e-22: tmp = t_2 else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(t * Float64(x / t)) t_2 = Float64(y * Float64(z / t)) tmp = 0.0 if (x <= -4.4e-31) tmp = t_1; elseif (x <= -1.35e-153) tmp = t_2; elseif (x <= -1.32e-186) tmp = x; elseif (x <= 2.5e-22) tmp = t_2; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = t * (x / t); t_2 = y * (z / t); tmp = 0.0; if (x <= -4.4e-31) tmp = t_1; elseif (x <= -1.35e-153) tmp = t_2; elseif (x <= -1.32e-186) tmp = x; elseif (x <= 2.5e-22) tmp = t_2; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(t * N[(x / t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -4.4e-31], t$95$1, If[LessEqual[x, -1.35e-153], t$95$2, If[LessEqual[x, -1.32e-186], x, If[LessEqual[x, 2.5e-22], t$95$2, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t \cdot \frac{x}{t}\\
t_2 := y \cdot \frac{z}{t}\\
\mathbf{if}\;x \leq -4.4 \cdot 10^{-31}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq -1.35 \cdot 10^{-153}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;x \leq -1.32 \cdot 10^{-186}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 2.5 \cdot 10^{-22}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -4.40000000000000019e-31 or 2.49999999999999977e-22 < x Initial program 94.9%
Taylor expanded in t around 0 80.1%
Taylor expanded in t around inf 35.4%
*-commutative35.4%
Simplified35.4%
*-commutative35.4%
associate-/l*60.0%
Applied egg-rr60.0%
if -4.40000000000000019e-31 < x < -1.35000000000000005e-153 or -1.32e-186 < x < 2.49999999999999977e-22Initial program 95.7%
Taylor expanded in y around -inf 78.3%
Taylor expanded in z around inf 64.6%
associate-/l*79.7%
Simplified62.9%
if -1.35000000000000005e-153 < x < -1.32e-186Initial program 100.0%
Taylor expanded in y around 0 87.6%
(FPCore (x y z t) :precision binary64 (if (or (<= z -7.2e-66) (not (<= z 3.3e-128))) (+ x (/ (* z y) t)) (* x (- 1.0 (/ y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -7.2e-66) || !(z <= 3.3e-128)) {
tmp = x + ((z * y) / t);
} else {
tmp = x * (1.0 - (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 ((z <= (-7.2d-66)) .or. (.not. (z <= 3.3d-128))) then
tmp = x + ((z * y) / t)
else
tmp = x * (1.0d0 - (y / t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -7.2e-66) || !(z <= 3.3e-128)) {
tmp = x + ((z * y) / t);
} else {
tmp = x * (1.0 - (y / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -7.2e-66) or not (z <= 3.3e-128): tmp = x + ((z * y) / t) else: tmp = x * (1.0 - (y / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -7.2e-66) || !(z <= 3.3e-128)) tmp = Float64(x + Float64(Float64(z * y) / t)); else tmp = Float64(x * Float64(1.0 - Float64(y / t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -7.2e-66) || ~((z <= 3.3e-128))) tmp = x + ((z * y) / t); else tmp = x * (1.0 - (y / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -7.2e-66], N[Not[LessEqual[z, 3.3e-128]], $MachinePrecision]], N[(x + N[(N[(z * y), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.2 \cdot 10^{-66} \lor \neg \left(z \leq 3.3 \cdot 10^{-128}\right):\\
\;\;\;\;x + \frac{z \cdot y}{t}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\end{array}
\end{array}
if z < -7.20000000000000025e-66 or 3.3e-128 < z Initial program 94.1%
Taylor expanded in z around 0 88.5%
+-commutative88.5%
*-commutative88.5%
associate-*r/89.7%
mul-1-neg89.7%
associate-/l*87.6%
distribute-lft-neg-in87.6%
distribute-rgt-in98.1%
sub-neg98.1%
Simplified98.1%
Taylor expanded in z around inf 89.4%
if -7.20000000000000025e-66 < z < 3.3e-128Initial program 97.8%
Taylor expanded in x around inf 90.1%
mul-1-neg90.1%
unsub-neg90.1%
Simplified90.1%
Final simplification89.7%
(FPCore (x y z t) :precision binary64 (if (or (<= z -7.2e-67) (not (<= z 6.6e-131))) (+ x (* y (/ z t))) (* x (- 1.0 (/ y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -7.2e-67) || !(z <= 6.6e-131)) {
tmp = x + (y * (z / t));
} else {
tmp = x * (1.0 - (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 ((z <= (-7.2d-67)) .or. (.not. (z <= 6.6d-131))) then
tmp = x + (y * (z / t))
else
tmp = x * (1.0d0 - (y / t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -7.2e-67) || !(z <= 6.6e-131)) {
tmp = x + (y * (z / t));
} else {
tmp = x * (1.0 - (y / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -7.2e-67) or not (z <= 6.6e-131): tmp = x + (y * (z / t)) else: tmp = x * (1.0 - (y / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -7.2e-67) || !(z <= 6.6e-131)) tmp = Float64(x + Float64(y * Float64(z / t))); else tmp = Float64(x * Float64(1.0 - Float64(y / t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -7.2e-67) || ~((z <= 6.6e-131))) tmp = x + (y * (z / t)); else tmp = x * (1.0 - (y / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -7.2e-67], N[Not[LessEqual[z, 6.6e-131]], $MachinePrecision]], N[(x + N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.2 \cdot 10^{-67} \lor \neg \left(z \leq 6.6 \cdot 10^{-131}\right):\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\end{array}
\end{array}
if z < -7.19999999999999998e-67 or 6.6000000000000004e-131 < z Initial program 94.1%
Taylor expanded in z around inf 89.4%
associate-/l*85.6%
Simplified85.6%
if -7.19999999999999998e-67 < z < 6.6000000000000004e-131Initial program 97.8%
Taylor expanded in x around inf 90.1%
mul-1-neg90.1%
unsub-neg90.1%
Simplified90.1%
Final simplification87.3%
(FPCore (x y z t) :precision binary64 (if (<= z -6.4e+114) (* z (/ y t)) (if (<= z 5e+113) (* x (- 1.0 (/ y t))) (/ (* z y) t))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -6.4e+114) {
tmp = z * (y / t);
} else if (z <= 5e+113) {
tmp = x * (1.0 - (y / t));
} else {
tmp = (z * 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 (z <= (-6.4d+114)) then
tmp = z * (y / t)
else if (z <= 5d+113) then
tmp = x * (1.0d0 - (y / t))
else
tmp = (z * y) / t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -6.4e+114) {
tmp = z * (y / t);
} else if (z <= 5e+113) {
tmp = x * (1.0 - (y / t));
} else {
tmp = (z * y) / t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -6.4e+114: tmp = z * (y / t) elif z <= 5e+113: tmp = x * (1.0 - (y / t)) else: tmp = (z * y) / t return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -6.4e+114) tmp = Float64(z * Float64(y / t)); elseif (z <= 5e+113) tmp = Float64(x * Float64(1.0 - Float64(y / t))); else tmp = Float64(Float64(z * y) / t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -6.4e+114) tmp = z * (y / t); elseif (z <= 5e+113) tmp = x * (1.0 - (y / t)); else tmp = (z * y) / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -6.4e+114], N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 5e+113], N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(z * y), $MachinePrecision] / t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.4 \cdot 10^{+114}:\\
\;\;\;\;z \cdot \frac{y}{t}\\
\mathbf{elif}\;z \leq 5 \cdot 10^{+113}:\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{z \cdot y}{t}\\
\end{array}
\end{array}
if z < -6.4e114Initial program 89.2%
Taylor expanded in y around -inf 73.5%
Taylor expanded in z around inf 73.0%
associate-/l*88.9%
Simplified70.7%
clear-num70.7%
un-div-inv70.8%
Applied egg-rr70.8%
associate-/r/79.5%
Applied egg-rr79.5%
if -6.4e114 < z < 5e113Initial program 97.0%
Taylor expanded in x around inf 77.3%
mul-1-neg77.3%
unsub-neg77.3%
Simplified77.3%
if 5e113 < z Initial program 95.1%
Taylor expanded in t around 0 90.5%
Taylor expanded in x around 0 76.4%
Final simplification77.5%
(FPCore (x y z t) :precision binary64 (if (or (<= y -0.00045) (not (<= y 3.2e+111))) (* t (/ x t)) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -0.00045) || !(y <= 3.2e+111)) {
tmp = t * (x / t);
} 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 ((y <= (-0.00045d0)) .or. (.not. (y <= 3.2d+111))) then
tmp = t * (x / t)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -0.00045) || !(y <= 3.2e+111)) {
tmp = t * (x / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -0.00045) or not (y <= 3.2e+111): tmp = t * (x / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -0.00045) || !(y <= 3.2e+111)) tmp = Float64(t * Float64(x / t)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -0.00045) || ~((y <= 3.2e+111))) tmp = t * (x / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -0.00045], N[Not[LessEqual[y, 3.2e+111]], $MachinePrecision]], N[(t * N[(x / t), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -0.00045 \lor \neg \left(y \leq 3.2 \cdot 10^{+111}\right):\\
\;\;\;\;t \cdot \frac{x}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -4.4999999999999999e-4 or 3.2000000000000001e111 < y Initial program 89.8%
Taylor expanded in t around 0 86.1%
Taylor expanded in t around inf 5.4%
*-commutative5.4%
Simplified5.4%
*-commutative5.4%
associate-/l*23.3%
Applied egg-rr23.3%
if -4.4999999999999999e-4 < y < 3.2000000000000001e111Initial program 99.3%
Taylor expanded in y around 0 57.6%
Final simplification43.7%
(FPCore (x y z t) :precision binary64 (+ x (* (- z x) (/ y t))))
double code(double x, double y, double z, double t) {
return x + ((z - x) * (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 + ((z - x) * (y / t))
end function
public static double code(double x, double y, double z, double t) {
return x + ((z - x) * (y / t));
}
def code(x, y, z, t): return x + ((z - x) * (y / t))
function code(x, y, z, t) return Float64(x + Float64(Float64(z - x) * Float64(y / t))) end
function tmp = code(x, y, z, t) tmp = x + ((z - x) * (y / t)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(z - x), $MachinePrecision] * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(z - x\right) \cdot \frac{y}{t}
\end{array}
Initial program 95.4%
Taylor expanded in z around 0 91.9%
+-commutative91.9%
*-commutative91.9%
associate-*r/90.0%
mul-1-neg90.0%
associate-/l*89.5%
distribute-lft-neg-in89.5%
distribute-rgt-in97.3%
sub-neg97.3%
Simplified97.3%
Final simplification97.3%
(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 95.4%
Taylor expanded in y around 0 38.6%
(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 2024100
(FPCore (x y z t)
:name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, D"
:precision binary64
:alt
(- x (+ (* x (/ y t)) (* (- z) (/ y t))))
(+ x (/ (* y (- z x)) t)))