
(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 13 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 (if (<= t -3.4e-186) (fma y (/ (- z x) t) x) (+ x (/ (- z x) (/ t y)))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -3.4e-186) {
tmp = fma(y, ((z - x) / t), x);
} else {
tmp = x + ((z - x) / (t / y));
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (t <= -3.4e-186) tmp = fma(y, Float64(Float64(z - x) / t), x); else tmp = Float64(x + Float64(Float64(z - x) / Float64(t / y))); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[t, -3.4e-186], N[(y * N[(N[(z - x), $MachinePrecision] / t), $MachinePrecision] + x), $MachinePrecision], N[(x + N[(N[(z - x), $MachinePrecision] / N[(t / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.4 \cdot 10^{-186}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{z - x}{t}, x\right)\\
\mathbf{else}:\\
\;\;\;\;x + \frac{z - x}{\frac{t}{y}}\\
\end{array}
\end{array}
if t < -3.3999999999999999e-186Initial program 93.6%
+-commutative93.6%
associate-/l*98.8%
fma-define98.8%
Simplified98.8%
if -3.3999999999999999e-186 < t Initial program 92.0%
Taylor expanded in z around 0 83.5%
+-commutative83.5%
*-commutative83.5%
associate-*r/84.5%
mul-1-neg84.5%
associate-/l*86.5%
distribute-lft-neg-in86.5%
distribute-rgt-in99.2%
sub-neg99.2%
Simplified99.2%
*-commutative99.2%
clear-num99.2%
un-div-inv99.3%
Applied egg-rr99.3%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* y (/ (- z x) t))))
(if (<= y -1.06e+72)
t_1
(if (<= y 2.8e-210)
(+ x (* z (/ y t)))
(if (<= y 3.1e+139) (- x (/ x (/ t y))) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = y * ((z - x) / t);
double tmp;
if (y <= -1.06e+72) {
tmp = t_1;
} else if (y <= 2.8e-210) {
tmp = x + (z * (y / t));
} else if (y <= 3.1e+139) {
tmp = x - (x / (t / y));
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = y * ((z - x) / t)
if (y <= (-1.06d+72)) then
tmp = t_1
else if (y <= 2.8d-210) then
tmp = x + (z * (y / t))
else if (y <= 3.1d+139) then
tmp = x - (x / (t / y))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = y * ((z - x) / t);
double tmp;
if (y <= -1.06e+72) {
tmp = t_1;
} else if (y <= 2.8e-210) {
tmp = x + (z * (y / t));
} else if (y <= 3.1e+139) {
tmp = x - (x / (t / y));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = y * ((z - x) / t) tmp = 0 if y <= -1.06e+72: tmp = t_1 elif y <= 2.8e-210: tmp = x + (z * (y / t)) elif y <= 3.1e+139: tmp = x - (x / (t / y)) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(y * Float64(Float64(z - x) / t)) tmp = 0.0 if (y <= -1.06e+72) tmp = t_1; elseif (y <= 2.8e-210) tmp = Float64(x + Float64(z * Float64(y / t))); elseif (y <= 3.1e+139) tmp = Float64(x - Float64(x / Float64(t / y))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = y * ((z - x) / t); tmp = 0.0; if (y <= -1.06e+72) tmp = t_1; elseif (y <= 2.8e-210) tmp = x + (z * (y / t)); elseif (y <= 3.1e+139) tmp = x - (x / (t / y)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * N[(N[(z - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.06e+72], t$95$1, If[LessEqual[y, 2.8e-210], N[(x + N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3.1e+139], N[(x - N[(x / N[(t / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \frac{z - x}{t}\\
\mathbf{if}\;y \leq -1.06 \cdot 10^{+72}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 2.8 \cdot 10^{-210}:\\
\;\;\;\;x + z \cdot \frac{y}{t}\\
\mathbf{elif}\;y \leq 3.1 \cdot 10^{+139}:\\
\;\;\;\;x - \frac{x}{\frac{t}{y}}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -1.06e72 or 3.1e139 < y Initial program 91.0%
Taylor expanded in y around inf 87.8%
Taylor expanded in t around 0 93.0%
if -1.06e72 < y < 2.8e-210Initial program 94.7%
Taylor expanded in z around 0 94.7%
+-commutative94.7%
*-commutative94.7%
associate-*r/97.4%
mul-1-neg97.4%
associate-/l*98.1%
distribute-lft-neg-in98.1%
distribute-rgt-in98.1%
sub-neg98.1%
Simplified98.1%
Taylor expanded in z around inf 90.4%
if 2.8e-210 < y < 3.1e139Initial program 92.0%
Taylor expanded in z around 0 92.0%
+-commutative92.0%
*-commutative92.0%
associate-*r/92.1%
mul-1-neg92.1%
associate-/l*98.5%
distribute-lft-neg-in98.5%
distribute-rgt-in98.5%
sub-neg98.5%
Simplified98.5%
*-commutative98.5%
clear-num98.5%
un-div-inv98.6%
Applied egg-rr98.6%
Taylor expanded in z around 0 81.4%
neg-mul-181.4%
Simplified81.4%
Final simplification88.9%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* y (/ (- z x) t))))
(if (<= y -8.5e+70)
t_1
(if (<= y 2.7e-210)
(+ x (* z (/ y t)))
(if (<= y 8e+139) (* x (- 1.0 (/ y t))) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = y * ((z - x) / t);
double tmp;
if (y <= -8.5e+70) {
tmp = t_1;
} else if (y <= 2.7e-210) {
tmp = x + (z * (y / t));
} else if (y <= 8e+139) {
tmp = x * (1.0 - (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 = y * ((z - x) / t)
if (y <= (-8.5d+70)) then
tmp = t_1
else if (y <= 2.7d-210) then
tmp = x + (z * (y / t))
else if (y <= 8d+139) then
tmp = x * (1.0d0 - (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 = y * ((z - x) / t);
double tmp;
if (y <= -8.5e+70) {
tmp = t_1;
} else if (y <= 2.7e-210) {
tmp = x + (z * (y / t));
} else if (y <= 8e+139) {
tmp = x * (1.0 - (y / t));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = y * ((z - x) / t) tmp = 0 if y <= -8.5e+70: tmp = t_1 elif y <= 2.7e-210: tmp = x + (z * (y / t)) elif y <= 8e+139: tmp = x * (1.0 - (y / t)) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(y * Float64(Float64(z - x) / t)) tmp = 0.0 if (y <= -8.5e+70) tmp = t_1; elseif (y <= 2.7e-210) tmp = Float64(x + Float64(z * Float64(y / t))); elseif (y <= 8e+139) tmp = Float64(x * Float64(1.0 - Float64(y / t))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = y * ((z - x) / t); tmp = 0.0; if (y <= -8.5e+70) tmp = t_1; elseif (y <= 2.7e-210) tmp = x + (z * (y / t)); elseif (y <= 8e+139) tmp = x * (1.0 - (y / t)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * N[(N[(z - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -8.5e+70], t$95$1, If[LessEqual[y, 2.7e-210], N[(x + N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 8e+139], N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \frac{z - x}{t}\\
\mathbf{if}\;y \leq -8.5 \cdot 10^{+70}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 2.7 \cdot 10^{-210}:\\
\;\;\;\;x + z \cdot \frac{y}{t}\\
\mathbf{elif}\;y \leq 8 \cdot 10^{+139}:\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -8.4999999999999996e70 or 8.00000000000000026e139 < y Initial program 91.0%
Taylor expanded in y around inf 87.8%
Taylor expanded in t around 0 93.0%
if -8.4999999999999996e70 < y < 2.69999999999999992e-210Initial program 94.7%
Taylor expanded in z around 0 94.7%
+-commutative94.7%
*-commutative94.7%
associate-*r/97.4%
mul-1-neg97.4%
associate-/l*98.1%
distribute-lft-neg-in98.1%
distribute-rgt-in98.1%
sub-neg98.1%
Simplified98.1%
Taylor expanded in z around inf 90.4%
if 2.69999999999999992e-210 < y < 8.00000000000000026e139Initial program 92.0%
Taylor expanded in x around inf 81.4%
mul-1-neg81.4%
unsub-neg81.4%
Simplified81.4%
Final simplification88.9%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* y (/ (- z x) t))))
(if (<= y -1.45e+71)
t_1
(if (<= y 5.6e-223)
(+ x (* y (/ z t)))
(if (<= y 1.45e+140) (* x (- 1.0 (/ y t))) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = y * ((z - x) / t);
double tmp;
if (y <= -1.45e+71) {
tmp = t_1;
} else if (y <= 5.6e-223) {
tmp = x + (y * (z / t));
} else if (y <= 1.45e+140) {
tmp = x * (1.0 - (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 = y * ((z - x) / t)
if (y <= (-1.45d+71)) then
tmp = t_1
else if (y <= 5.6d-223) then
tmp = x + (y * (z / t))
else if (y <= 1.45d+140) then
tmp = x * (1.0d0 - (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 = y * ((z - x) / t);
double tmp;
if (y <= -1.45e+71) {
tmp = t_1;
} else if (y <= 5.6e-223) {
tmp = x + (y * (z / t));
} else if (y <= 1.45e+140) {
tmp = x * (1.0 - (y / t));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = y * ((z - x) / t) tmp = 0 if y <= -1.45e+71: tmp = t_1 elif y <= 5.6e-223: tmp = x + (y * (z / t)) elif y <= 1.45e+140: tmp = x * (1.0 - (y / t)) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(y * Float64(Float64(z - x) / t)) tmp = 0.0 if (y <= -1.45e+71) tmp = t_1; elseif (y <= 5.6e-223) tmp = Float64(x + Float64(y * Float64(z / t))); elseif (y <= 1.45e+140) tmp = Float64(x * Float64(1.0 - Float64(y / t))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = y * ((z - x) / t); tmp = 0.0; if (y <= -1.45e+71) tmp = t_1; elseif (y <= 5.6e-223) tmp = x + (y * (z / t)); elseif (y <= 1.45e+140) tmp = x * (1.0 - (y / t)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * N[(N[(z - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.45e+71], t$95$1, If[LessEqual[y, 5.6e-223], N[(x + N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.45e+140], N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \frac{z - x}{t}\\
\mathbf{if}\;y \leq -1.45 \cdot 10^{+71}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 5.6 \cdot 10^{-223}:\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\mathbf{elif}\;y \leq 1.45 \cdot 10^{+140}:\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -1.45000000000000004e71 or 1.4499999999999999e140 < y Initial program 91.0%
Taylor expanded in y around inf 87.8%
Taylor expanded in t around 0 93.0%
if -1.45000000000000004e71 < y < 5.6000000000000003e-223Initial program 95.6%
Taylor expanded in z around inf 89.3%
associate-/l*84.9%
Simplified84.9%
if 5.6000000000000003e-223 < y < 1.4499999999999999e140Initial program 91.1%
Taylor expanded in x around inf 81.0%
mul-1-neg81.0%
unsub-neg81.0%
Simplified81.0%
(FPCore (x y z t) :precision binary64 (if (or (<= x -1.12e-135) (not (<= x 3.6e+72))) (* x (- 1.0 (/ y t))) (* y (/ (- z x) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.12e-135) || !(x <= 3.6e+72)) {
tmp = x * (1.0 - (y / t));
} else {
tmp = y * ((z - x) / 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 <= (-1.12d-135)) .or. (.not. (x <= 3.6d+72))) then
tmp = x * (1.0d0 - (y / t))
else
tmp = y * ((z - x) / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.12e-135) || !(x <= 3.6e+72)) {
tmp = x * (1.0 - (y / t));
} else {
tmp = y * ((z - x) / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -1.12e-135) or not (x <= 3.6e+72): tmp = x * (1.0 - (y / t)) else: tmp = y * ((z - x) / t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -1.12e-135) || !(x <= 3.6e+72)) tmp = Float64(x * Float64(1.0 - Float64(y / t))); else tmp = Float64(y * Float64(Float64(z - x) / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -1.12e-135) || ~((x <= 3.6e+72))) tmp = x * (1.0 - (y / t)); else tmp = y * ((z - x) / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -1.12e-135], N[Not[LessEqual[x, 3.6e+72]], $MachinePrecision]], N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * N[(N[(z - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.12 \cdot 10^{-135} \lor \neg \left(x \leq 3.6 \cdot 10^{+72}\right):\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{z - x}{t}\\
\end{array}
\end{array}
if x < -1.12e-135 or 3.60000000000000035e72 < x Initial program 92.0%
Taylor expanded in x around inf 86.6%
mul-1-neg86.6%
unsub-neg86.6%
Simplified86.6%
if -1.12e-135 < x < 3.60000000000000035e72Initial program 93.3%
Taylor expanded in y around inf 77.5%
Taylor expanded in t around 0 77.5%
Final simplification82.7%
(FPCore (x y z t) :precision binary64 (if (or (<= x -9.5e-139) (not (<= x 6.5e-127))) (* x (- 1.0 (/ y t))) (* z (/ y t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -9.5e-139) || !(x <= 6.5e-127)) {
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 ((x <= (-9.5d-139)) .or. (.not. (x <= 6.5d-127))) 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 ((x <= -9.5e-139) || !(x <= 6.5e-127)) {
tmp = x * (1.0 - (y / t));
} else {
tmp = z * (y / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -9.5e-139) or not (x <= 6.5e-127): tmp = x * (1.0 - (y / t)) else: tmp = z * (y / t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -9.5e-139) || !(x <= 6.5e-127)) tmp = Float64(x * Float64(1.0 - Float64(y / t))); else tmp = Float64(z * Float64(y / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -9.5e-139) || ~((x <= 6.5e-127))) tmp = x * (1.0 - (y / t)); else tmp = z * (y / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -9.5e-139], N[Not[LessEqual[x, 6.5e-127]], $MachinePrecision]], N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -9.5 \cdot 10^{-139} \lor \neg \left(x \leq 6.5 \cdot 10^{-127}\right):\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \frac{y}{t}\\
\end{array}
\end{array}
if x < -9.5000000000000006e-139 or 6.49999999999999998e-127 < x Initial program 92.3%
Taylor expanded in x around inf 82.1%
mul-1-neg82.1%
unsub-neg82.1%
Simplified82.1%
if -9.5000000000000006e-139 < x < 6.49999999999999998e-127Initial program 93.1%
Taylor expanded in y around inf 78.3%
Taylor expanded in z around inf 67.6%
clear-num67.5%
un-div-inv67.6%
Applied egg-rr67.6%
associate-/r/68.7%
Applied egg-rr68.7%
Final simplification77.9%
(FPCore (x y z t) :precision binary64 (if (<= y -3.25e-105) (/ z (/ t y)) (if (<= y 7e+96) x (* (/ y t) (- x)))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -3.25e-105) {
tmp = z / (t / y);
} else if (y <= 7e+96) {
tmp = x;
} else {
tmp = (y / t) * -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 <= (-3.25d-105)) then
tmp = z / (t / y)
else if (y <= 7d+96) then
tmp = x
else
tmp = (y / t) * -x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -3.25e-105) {
tmp = z / (t / y);
} else if (y <= 7e+96) {
tmp = x;
} else {
tmp = (y / t) * -x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -3.25e-105: tmp = z / (t / y) elif y <= 7e+96: tmp = x else: tmp = (y / t) * -x return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -3.25e-105) tmp = Float64(z / Float64(t / y)); elseif (y <= 7e+96) tmp = x; else tmp = Float64(Float64(y / t) * Float64(-x)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -3.25e-105) tmp = z / (t / y); elseif (y <= 7e+96) tmp = x; else tmp = (y / t) * -x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -3.25e-105], N[(z / N[(t / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 7e+96], x, N[(N[(y / t), $MachinePrecision] * (-x)), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.25 \cdot 10^{-105}:\\
\;\;\;\;\frac{z}{\frac{t}{y}}\\
\mathbf{elif}\;y \leq 7 \cdot 10^{+96}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{t} \cdot \left(-x\right)\\
\end{array}
\end{array}
if y < -3.25000000000000003e-105Initial program 94.2%
Taylor expanded in y around inf 77.7%
Taylor expanded in z around inf 55.0%
*-commutative55.0%
associate-/r/60.5%
Applied egg-rr60.5%
if -3.25000000000000003e-105 < y < 6.9999999999999998e96Initial program 92.9%
Taylor expanded in y around 0 61.3%
if 6.9999999999999998e96 < y Initial program 89.3%
Taylor expanded in x around inf 70.1%
mul-1-neg70.1%
unsub-neg70.1%
Simplified70.1%
Taylor expanded in y around inf 59.4%
mul-1-neg59.4%
distribute-frac-neg259.4%
Simplified59.4%
Final simplification60.6%
(FPCore (x y z t) :precision binary64 (if (or (<= y -2.5e+46) (not (<= y 7e+96))) (* y (/ z t)) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -2.5e+46) || !(y <= 7e+96)) {
tmp = y * (z / 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 <= (-2.5d+46)) .or. (.not. (y <= 7d+96))) then
tmp = y * (z / 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 <= -2.5e+46) || !(y <= 7e+96)) {
tmp = y * (z / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -2.5e+46) or not (y <= 7e+96): tmp = y * (z / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -2.5e+46) || !(y <= 7e+96)) tmp = Float64(y * Float64(z / t)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -2.5e+46) || ~((y <= 7e+96))) tmp = y * (z / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -2.5e+46], N[Not[LessEqual[y, 7e+96]], $MachinePrecision]], N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.5 \cdot 10^{+46} \lor \neg \left(y \leq 7 \cdot 10^{+96}\right):\\
\;\;\;\;y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -2.5000000000000001e46 or 6.9999999999999998e96 < y Initial program 90.8%
Taylor expanded in y around inf 86.4%
Taylor expanded in z around inf 54.7%
if -2.5000000000000001e46 < y < 6.9999999999999998e96Initial program 94.0%
Taylor expanded in y around 0 57.9%
Final simplification56.4%
(FPCore (x y z t) :precision binary64 (if (<= t -1.2e+38) x (if (<= t 2.6e+70) (/ z (/ t y)) x)))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1.2e+38) {
tmp = x;
} else if (t <= 2.6e+70) {
tmp = z / (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 <= (-1.2d+38)) then
tmp = x
else if (t <= 2.6d+70) then
tmp = z / (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 <= -1.2e+38) {
tmp = x;
} else if (t <= 2.6e+70) {
tmp = z / (t / y);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -1.2e+38: tmp = x elif t <= 2.6e+70: tmp = z / (t / y) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -1.2e+38) tmp = x; elseif (t <= 2.6e+70) tmp = Float64(z / Float64(t / y)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -1.2e+38) tmp = x; elseif (t <= 2.6e+70) tmp = z / (t / y); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -1.2e+38], x, If[LessEqual[t, 2.6e+70], N[(z / N[(t / y), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.2 \cdot 10^{+38}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq 2.6 \cdot 10^{+70}:\\
\;\;\;\;\frac{z}{\frac{t}{y}}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if t < -1.20000000000000009e38 or 2.6e70 < t Initial program 88.1%
Taylor expanded in y around 0 66.9%
if -1.20000000000000009e38 < t < 2.6e70Initial program 95.7%
Taylor expanded in y around inf 75.0%
Taylor expanded in z around inf 47.0%
*-commutative47.0%
associate-/r/52.4%
Applied egg-rr52.4%
(FPCore (x y z t) :precision binary64 (if (<= t -7.8e+37) x (if (<= t 8.5e+69) (* z (/ y t)) x)))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -7.8e+37) {
tmp = x;
} else if (t <= 8.5e+69) {
tmp = z * (y / 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 (t <= (-7.8d+37)) then
tmp = x
else if (t <= 8.5d+69) then
tmp = z * (y / 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 (t <= -7.8e+37) {
tmp = x;
} else if (t <= 8.5e+69) {
tmp = z * (y / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -7.8e+37: tmp = x elif t <= 8.5e+69: tmp = z * (y / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -7.8e+37) tmp = x; elseif (t <= 8.5e+69) tmp = Float64(z * Float64(y / t)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -7.8e+37) tmp = x; elseif (t <= 8.5e+69) tmp = z * (y / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -7.8e+37], x, If[LessEqual[t, 8.5e+69], N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -7.8 \cdot 10^{+37}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq 8.5 \cdot 10^{+69}:\\
\;\;\;\;z \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if t < -7.7999999999999997e37 or 8.5000000000000002e69 < t Initial program 88.1%
Taylor expanded in y around 0 66.9%
if -7.7999999999999997e37 < t < 8.5000000000000002e69Initial program 95.7%
Taylor expanded in y around inf 75.0%
Taylor expanded in z around inf 47.0%
clear-num47.0%
un-div-inv47.3%
Applied egg-rr47.3%
associate-/r/52.3%
Applied egg-rr52.3%
Final simplification58.3%
(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 92.6%
Taylor expanded in z around 0 85.5%
+-commutative85.5%
*-commutative85.5%
associate-*r/84.1%
mul-1-neg84.1%
associate-/l*86.9%
distribute-lft-neg-in86.9%
distribute-rgt-in96.7%
sub-neg96.7%
Simplified96.7%
*-commutative96.7%
clear-num96.5%
un-div-inv96.8%
Applied egg-rr96.8%
(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 92.6%
Taylor expanded in z around 0 85.5%
+-commutative85.5%
*-commutative85.5%
associate-*r/84.1%
mul-1-neg84.1%
associate-/l*86.9%
distribute-lft-neg-in86.9%
distribute-rgt-in96.7%
sub-neg96.7%
Simplified96.7%
Final simplification96.7%
(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.6%
Taylor expanded in y around 0 36.4%
(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 2024165
(FPCore (x y z t)
:name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, D"
:precision binary64
:alt
(! :herbie-platform default (- x (+ (* x (/ y t)) (* (- z) (/ y t)))))
(+ x (/ (* y (- z x)) t)))