
(FPCore (x y z t a) :precision binary64 (+ x (/ (* y (- z t)) a)))
double code(double x, double y, double z, double t, double a) {
return x + ((y * (z - t)) / a);
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x + ((y * (z - t)) / a)
end function
public static double code(double x, double y, double z, double t, double a) {
return x + ((y * (z - t)) / a);
}
def code(x, y, z, t, a): return x + ((y * (z - t)) / a)
function code(x, y, z, t, a) return Float64(x + Float64(Float64(y * Float64(z - t)) / a)) end
function tmp = code(x, y, z, t, a) tmp = x + ((y * (z - t)) / a); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y \cdot \left(z - t\right)}{a}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (+ x (/ (* y (- z t)) a)))
double code(double x, double y, double z, double t, double a) {
return x + ((y * (z - t)) / a);
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x + ((y * (z - t)) / a)
end function
public static double code(double x, double y, double z, double t, double a) {
return x + ((y * (z - t)) / a);
}
def code(x, y, z, t, a): return x + ((y * (z - t)) / a)
function code(x, y, z, t, a) return Float64(x + Float64(Float64(y * Float64(z - t)) / a)) end
function tmp = code(x, y, z, t, a) tmp = x + ((y * (z - t)) / a); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y \cdot \left(z - t\right)}{a}
\end{array}
(FPCore (x y z t a) :precision binary64 (if (<= x -4.8e-117) (fma (/ y a) (- z t) x) (+ (/ y (* (/ 1.0 (- z t)) a)) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (x <= -4.8e-117) {
tmp = fma((y / a), (z - t), x);
} else {
tmp = (y / ((1.0 / (z - t)) * a)) + x;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (x <= -4.8e-117) tmp = fma(Float64(y / a), Float64(z - t), x); else tmp = Float64(Float64(y / Float64(Float64(1.0 / Float64(z - t)) * a)) + x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[x, -4.8e-117], N[(N[(y / a), $MachinePrecision] * N[(z - t), $MachinePrecision] + x), $MachinePrecision], N[(N[(y / N[(N[(1.0 / N[(z - t), $MachinePrecision]), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.8 \cdot 10^{-117}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{a}, z - t, x\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{\frac{1}{z - t} \cdot a} + x\\
\end{array}
\end{array}
if x < -4.80000000000000028e-117Initial program 90.6%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6497.8
Applied rewrites97.8%
if -4.80000000000000028e-117 < x Initial program 92.0%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lift--.f64N/A
flip--N/A
clear-numN/A
frac-timesN/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f64N/A
clear-numN/A
flip--N/A
lift--.f64N/A
lower-/.f6499.0
Applied rewrites99.0%
Final simplification98.5%
(FPCore (x y z t a) :precision binary64 (if (<= y 5e-220) (+ (/ (- z t) (/ a y)) x) (fma (/ (- z t) a) y x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= 5e-220) {
tmp = ((z - t) / (a / y)) + x;
} else {
tmp = fma(((z - t) / a), y, x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (y <= 5e-220) tmp = Float64(Float64(Float64(z - t) / Float64(a / y)) + x); else tmp = fma(Float64(Float64(z - t) / a), y, x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[y, 5e-220], N[(N[(N[(z - t), $MachinePrecision] / N[(a / y), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], N[(N[(N[(z - t), $MachinePrecision] / a), $MachinePrecision] * y + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 5 \cdot 10^{-220}:\\
\;\;\;\;\frac{z - t}{\frac{a}{y}} + x\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z - t}{a}, y, x\right)\\
\end{array}
\end{array}
if y < 5.0000000000000002e-220Initial program 91.6%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lift--.f64N/A
flip--N/A
clear-numN/A
frac-timesN/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f64N/A
clear-numN/A
flip--N/A
lift--.f64N/A
lower-/.f6494.4
Applied rewrites94.4%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
clear-numN/A
un-div-invN/A
lift-/.f64N/A
remove-double-divN/A
lower-/.f64N/A
lower-/.f6497.6
Applied rewrites97.6%
if 5.0000000000000002e-220 < y Initial program 91.3%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6499.1
Applied rewrites99.1%
Final simplification98.2%
(FPCore (x y z t a) :precision binary64 (if (<= z -6.4e-21) (fma (/ y a) z x) (if (<= z 4.9e+36) (- x (* (/ t a) y)) (fma (/ z a) y x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -6.4e-21) {
tmp = fma((y / a), z, x);
} else if (z <= 4.9e+36) {
tmp = x - ((t / a) * y);
} else {
tmp = fma((z / a), y, x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -6.4e-21) tmp = fma(Float64(y / a), z, x); elseif (z <= 4.9e+36) tmp = Float64(x - Float64(Float64(t / a) * y)); else tmp = fma(Float64(z / a), y, x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -6.4e-21], N[(N[(y / a), $MachinePrecision] * z + x), $MachinePrecision], If[LessEqual[z, 4.9e+36], N[(x - N[(N[(t / a), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision], N[(N[(z / a), $MachinePrecision] * y + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.4 \cdot 10^{-21}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{a}, z, x\right)\\
\mathbf{elif}\;z \leq 4.9 \cdot 10^{+36}:\\
\;\;\;\;x - \frac{t}{a} \cdot y\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{a}, y, x\right)\\
\end{array}
\end{array}
if z < -6.4000000000000003e-21Initial program 89.2%
Taylor expanded in t around 0
+-commutativeN/A
associate-*l/N/A
lower-fma.f64N/A
lower-/.f6488.0
Applied rewrites88.0%
if -6.4000000000000003e-21 < z < 4.89999999999999981e36Initial program 92.5%
Taylor expanded in z around 0
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
associate-*l/N/A
lower-*.f64N/A
lower-/.f6490.5
Applied rewrites90.5%
if 4.89999999999999981e36 < z Initial program 93.5%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6495.7
Applied rewrites95.7%
Taylor expanded in z around inf
lower-/.f6493.5
Applied rewrites93.5%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (* (- t) (/ y a)))) (if (<= t -1.9e+188) t_1 (if (<= t 1.1e+137) (fma (/ z a) y x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = -t * (y / a);
double tmp;
if (t <= -1.9e+188) {
tmp = t_1;
} else if (t <= 1.1e+137) {
tmp = fma((z / a), y, x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(-t) * Float64(y / a)) tmp = 0.0 if (t <= -1.9e+188) tmp = t_1; elseif (t <= 1.1e+137) tmp = fma(Float64(z / a), y, x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[((-t) * N[(y / a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -1.9e+188], t$95$1, If[LessEqual[t, 1.1e+137], N[(N[(z / a), $MachinePrecision] * y + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(-t\right) \cdot \frac{y}{a}\\
\mathbf{if}\;t \leq -1.9 \cdot 10^{+188}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 1.1 \cdot 10^{+137}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{a}, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -1.8999999999999999e188 or 1.10000000000000008e137 < t Initial program 85.4%
Taylor expanded in x around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f6468.4
Applied rewrites68.4%
Taylor expanded in z around 0
Applied rewrites62.7%
Applied rewrites75.3%
if -1.8999999999999999e188 < t < 1.10000000000000008e137Initial program 93.0%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6496.2
Applied rewrites96.2%
Taylor expanded in z around inf
lower-/.f6481.0
Applied rewrites81.0%
Final simplification79.9%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (* (/ (- t) a) y))) (if (<= t -1.9e+188) t_1 (if (<= t 7e+133) (fma (/ z a) y x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (-t / a) * y;
double tmp;
if (t <= -1.9e+188) {
tmp = t_1;
} else if (t <= 7e+133) {
tmp = fma((z / a), y, x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(Float64(-t) / a) * y) tmp = 0.0 if (t <= -1.9e+188) tmp = t_1; elseif (t <= 7e+133) tmp = fma(Float64(z / a), y, x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[((-t) / a), $MachinePrecision] * y), $MachinePrecision]}, If[LessEqual[t, -1.9e+188], t$95$1, If[LessEqual[t, 7e+133], N[(N[(z / a), $MachinePrecision] * y + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{-t}{a} \cdot y\\
\mathbf{if}\;t \leq -1.9 \cdot 10^{+188}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 7 \cdot 10^{+133}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{a}, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -1.8999999999999999e188 or 6.9999999999999997e133 < t Initial program 85.4%
Taylor expanded in z around 0
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
associate-*l/N/A
lower-*.f64N/A
lower-/.f6486.9
Applied rewrites86.9%
Taylor expanded in x around 0
Applied rewrites69.7%
if -1.8999999999999999e188 < t < 6.9999999999999997e133Initial program 93.0%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6496.2
Applied rewrites96.2%
Taylor expanded in z around inf
lower-/.f6481.0
Applied rewrites81.0%
(FPCore (x y z t a) :precision binary64 (if (<= (- z t) -1e+70) (fma (/ y a) (- z t) x) (fma (/ (- z t) a) y x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z - t) <= -1e+70) {
tmp = fma((y / a), (z - t), x);
} else {
tmp = fma(((z - t) / a), y, x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (Float64(z - t) <= -1e+70) tmp = fma(Float64(y / a), Float64(z - t), x); else tmp = fma(Float64(Float64(z - t) / a), y, x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[N[(z - t), $MachinePrecision], -1e+70], N[(N[(y / a), $MachinePrecision] * N[(z - t), $MachinePrecision] + x), $MachinePrecision], N[(N[(N[(z - t), $MachinePrecision] / a), $MachinePrecision] * y + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z - t \leq -1 \cdot 10^{+70}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{a}, z - t, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z - t}{a}, y, x\right)\\
\end{array}
\end{array}
if (-.f64 z t) < -1.00000000000000007e70Initial program 86.7%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6499.9
Applied rewrites99.9%
if -1.00000000000000007e70 < (-.f64 z t) Initial program 94.2%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6497.1
Applied rewrites97.1%
(FPCore (x y z t a) :precision binary64 (if (<= (- z t) -2e-44) (fma (/ y a) z x) (fma (/ z a) y x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z - t) <= -2e-44) {
tmp = fma((y / a), z, x);
} else {
tmp = fma((z / a), y, x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (Float64(z - t) <= -2e-44) tmp = fma(Float64(y / a), z, x); else tmp = fma(Float64(z / a), y, x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[N[(z - t), $MachinePrecision], -2e-44], N[(N[(y / a), $MachinePrecision] * z + x), $MachinePrecision], N[(N[(z / a), $MachinePrecision] * y + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z - t \leq -2 \cdot 10^{-44}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{a}, z, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{a}, y, x\right)\\
\end{array}
\end{array}
if (-.f64 z t) < -1.99999999999999991e-44Initial program 89.2%
Taylor expanded in t around 0
+-commutativeN/A
associate-*l/N/A
lower-fma.f64N/A
lower-/.f6475.2
Applied rewrites75.2%
if -1.99999999999999991e-44 < (-.f64 z t) Initial program 94.0%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6496.2
Applied rewrites96.2%
Taylor expanded in z around inf
lower-/.f6473.7
Applied rewrites73.7%
(FPCore (x y z t a) :precision binary64 (if (<= (- z t) -2e-44) (* z (/ y a)) (* (/ z a) y)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z - t) <= -2e-44) {
tmp = z * (y / a);
} else {
tmp = (z / a) * y;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((z - t) <= (-2d-44)) then
tmp = z * (y / a)
else
tmp = (z / a) * y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z - t) <= -2e-44) {
tmp = z * (y / a);
} else {
tmp = (z / a) * y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z - t) <= -2e-44: tmp = z * (y / a) else: tmp = (z / a) * y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (Float64(z - t) <= -2e-44) tmp = Float64(z * Float64(y / a)); else tmp = Float64(Float64(z / a) * y); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z - t) <= -2e-44) tmp = z * (y / a); else tmp = (z / a) * y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[N[(z - t), $MachinePrecision], -2e-44], N[(z * N[(y / a), $MachinePrecision]), $MachinePrecision], N[(N[(z / a), $MachinePrecision] * y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z - t \leq -2 \cdot 10^{-44}:\\
\;\;\;\;z \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{z}{a} \cdot y\\
\end{array}
\end{array}
if (-.f64 z t) < -1.99999999999999991e-44Initial program 89.2%
Taylor expanded in z around inf
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6437.0
Applied rewrites37.0%
Applied rewrites40.5%
if -1.99999999999999991e-44 < (-.f64 z t) Initial program 94.0%
Taylor expanded in z around inf
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6429.6
Applied rewrites29.6%
(FPCore (x y z t a) :precision binary64 (fma (/ y a) (- z t) x))
double code(double x, double y, double z, double t, double a) {
return fma((y / a), (z - t), x);
}
function code(x, y, z, t, a) return fma(Float64(y / a), Float64(z - t), x) end
code[x_, y_, z_, t_, a_] := N[(N[(y / a), $MachinePrecision] * N[(z - t), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\frac{y}{a}, z - t, x\right)
\end{array}
Initial program 91.5%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6495.3
Applied rewrites95.3%
(FPCore (x y z t a) :precision binary64 (fma (/ y a) z x))
double code(double x, double y, double z, double t, double a) {
return fma((y / a), z, x);
}
function code(x, y, z, t, a) return fma(Float64(y / a), z, x) end
code[x_, y_, z_, t_, a_] := N[(N[(y / a), $MachinePrecision] * z + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\frac{y}{a}, z, x\right)
\end{array}
Initial program 91.5%
Taylor expanded in t around 0
+-commutativeN/A
associate-*l/N/A
lower-fma.f64N/A
lower-/.f6472.1
Applied rewrites72.1%
(FPCore (x y z t a) :precision binary64 (* z (/ y a)))
double code(double x, double y, double z, double t, double a) {
return z * (y / a);
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = z * (y / a)
end function
public static double code(double x, double y, double z, double t, double a) {
return z * (y / a);
}
def code(x, y, z, t, a): return z * (y / a)
function code(x, y, z, t, a) return Float64(z * Float64(y / a)) end
function tmp = code(x, y, z, t, a) tmp = z * (y / a); end
code[x_, y_, z_, t_, a_] := N[(z * N[(y / a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
z \cdot \frac{y}{a}
\end{array}
Initial program 91.5%
Taylor expanded in z around inf
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6433.4
Applied rewrites33.4%
Applied rewrites33.2%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ a (- z t))))
(if (< y -1.0761266216389975e-10)
(+ x (/ 1.0 (/ t_1 y)))
(if (< y 2.894426862792089e-49)
(+ x (/ (* y (- z t)) a))
(+ x (/ y t_1))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = a / (z - t);
double tmp;
if (y < -1.0761266216389975e-10) {
tmp = x + (1.0 / (t_1 / y));
} else if (y < 2.894426862792089e-49) {
tmp = x + ((y * (z - t)) / a);
} else {
tmp = x + (y / t_1);
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = a / (z - t)
if (y < (-1.0761266216389975d-10)) then
tmp = x + (1.0d0 / (t_1 / y))
else if (y < 2.894426862792089d-49) then
tmp = x + ((y * (z - t)) / a)
else
tmp = x + (y / t_1)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = a / (z - t);
double tmp;
if (y < -1.0761266216389975e-10) {
tmp = x + (1.0 / (t_1 / y));
} else if (y < 2.894426862792089e-49) {
tmp = x + ((y * (z - t)) / a);
} else {
tmp = x + (y / t_1);
}
return tmp;
}
def code(x, y, z, t, a): t_1 = a / (z - t) tmp = 0 if y < -1.0761266216389975e-10: tmp = x + (1.0 / (t_1 / y)) elif y < 2.894426862792089e-49: tmp = x + ((y * (z - t)) / a) else: tmp = x + (y / t_1) return tmp
function code(x, y, z, t, a) t_1 = Float64(a / Float64(z - t)) tmp = 0.0 if (y < -1.0761266216389975e-10) tmp = Float64(x + Float64(1.0 / Float64(t_1 / y))); elseif (y < 2.894426862792089e-49) tmp = Float64(x + Float64(Float64(y * Float64(z - t)) / a)); else tmp = Float64(x + Float64(y / t_1)); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = a / (z - t); tmp = 0.0; if (y < -1.0761266216389975e-10) tmp = x + (1.0 / (t_1 / y)); elseif (y < 2.894426862792089e-49) tmp = x + ((y * (z - t)) / a); else tmp = x + (y / t_1); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(a / N[(z - t), $MachinePrecision]), $MachinePrecision]}, If[Less[y, -1.0761266216389975e-10], N[(x + N[(1.0 / N[(t$95$1 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Less[y, 2.894426862792089e-49], N[(x + N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(x + N[(y / t$95$1), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{a}{z - t}\\
\mathbf{if}\;y < -1.0761266216389975 \cdot 10^{-10}:\\
\;\;\;\;x + \frac{1}{\frac{t\_1}{y}}\\
\mathbf{elif}\;y < 2.894426862792089 \cdot 10^{-49}:\\
\;\;\;\;x + \frac{y \cdot \left(z - t\right)}{a}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{t\_1}\\
\end{array}
\end{array}
herbie shell --seed 2024304
(FPCore (x y z t a)
:name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, E"
:precision binary64
:alt
(! :herbie-platform default (if (< y -430450648655599/4000000000000000000000000) (+ x (/ 1 (/ (/ a (- z t)) y))) (if (< y 2894426862792089/10000000000000000000000000000000000000000000000000000000000000000) (+ x (/ (* y (- z t)) a)) (+ x (/ y (/ a (- z t)))))))
(+ x (/ (* y (- z t)) a)))