
(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(Float64(Float64(x * 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[(N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot y - z \cdot t}{a}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 7 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(Float64(Float64(x * 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[(N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot y - z \cdot t}{a}
\end{array}
(FPCore (x y z t a) :precision binary64 (/ (fma y x (* t (- z))) a))
double code(double x, double y, double z, double t, double a) {
return fma(y, x, (t * -z)) / a;
}
function code(x, y, z, t, a) return Float64(fma(y, x, Float64(t * Float64(-z))) / a) end
code[x_, y_, z_, t_, a_] := N[(N[(y * x + N[(t * (-z)), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]
\begin{array}{l}
\\
\frac{\mathsf{fma}\left(y, x, t \cdot \left(-z\right)\right)}{a}
\end{array}
Initial program 97.9%
Taylor expanded in x around 0 94.0%
+-commutative94.0%
mul-1-neg94.0%
sub-neg94.0%
div-sub97.9%
fma-neg98.3%
distribute-rgt-neg-out98.3%
Simplified98.3%
Final simplification98.3%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* (- z) (/ t a))))
(if (<= y -1.35e-101)
(* y (/ x a))
(if (<= y 1.45e+44)
t_1
(if (<= y 2.05e+87)
(/ (* y x) a)
(if (<= y 9.6e+101) t_1 (/ y (/ a x))))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = -z * (t / a);
double tmp;
if (y <= -1.35e-101) {
tmp = y * (x / a);
} else if (y <= 1.45e+44) {
tmp = t_1;
} else if (y <= 2.05e+87) {
tmp = (y * x) / a;
} else if (y <= 9.6e+101) {
tmp = t_1;
} else {
tmp = y / (a / x);
}
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 = -z * (t / a)
if (y <= (-1.35d-101)) then
tmp = y * (x / a)
else if (y <= 1.45d+44) then
tmp = t_1
else if (y <= 2.05d+87) then
tmp = (y * x) / a
else if (y <= 9.6d+101) then
tmp = t_1
else
tmp = y / (a / x)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = -z * (t / a);
double tmp;
if (y <= -1.35e-101) {
tmp = y * (x / a);
} else if (y <= 1.45e+44) {
tmp = t_1;
} else if (y <= 2.05e+87) {
tmp = (y * x) / a;
} else if (y <= 9.6e+101) {
tmp = t_1;
} else {
tmp = y / (a / x);
}
return tmp;
}
def code(x, y, z, t, a): t_1 = -z * (t / a) tmp = 0 if y <= -1.35e-101: tmp = y * (x / a) elif y <= 1.45e+44: tmp = t_1 elif y <= 2.05e+87: tmp = (y * x) / a elif y <= 9.6e+101: tmp = t_1 else: tmp = y / (a / x) return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(-z) * Float64(t / a)) tmp = 0.0 if (y <= -1.35e-101) tmp = Float64(y * Float64(x / a)); elseif (y <= 1.45e+44) tmp = t_1; elseif (y <= 2.05e+87) tmp = Float64(Float64(y * x) / a); elseif (y <= 9.6e+101) tmp = t_1; else tmp = Float64(y / Float64(a / x)); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = -z * (t / a); tmp = 0.0; if (y <= -1.35e-101) tmp = y * (x / a); elseif (y <= 1.45e+44) tmp = t_1; elseif (y <= 2.05e+87) tmp = (y * x) / a; elseif (y <= 9.6e+101) tmp = t_1; else tmp = y / (a / x); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[((-z) * N[(t / a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.35e-101], N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.45e+44], t$95$1, If[LessEqual[y, 2.05e+87], N[(N[(y * x), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[y, 9.6e+101], t$95$1, N[(y / N[(a / x), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(-z\right) \cdot \frac{t}{a}\\
\mathbf{if}\;y \leq -1.35 \cdot 10^{-101}:\\
\;\;\;\;y \cdot \frac{x}{a}\\
\mathbf{elif}\;y \leq 1.45 \cdot 10^{+44}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 2.05 \cdot 10^{+87}:\\
\;\;\;\;\frac{y \cdot x}{a}\\
\mathbf{elif}\;y \leq 9.6 \cdot 10^{+101}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{\frac{a}{x}}\\
\end{array}
\end{array}
if y < -1.3500000000000001e-101Initial program 97.6%
Taylor expanded in x around inf 73.0%
associate-*r/72.0%
Simplified72.0%
if -1.3500000000000001e-101 < y < 1.4500000000000001e44 or 2.05e87 < y < 9.59999999999999953e101Initial program 97.1%
Taylor expanded in x around 0 94.4%
+-commutative94.4%
mul-1-neg94.4%
sub-neg94.4%
div-sub97.1%
fma-neg97.1%
distribute-rgt-neg-out97.1%
Simplified97.1%
Taylor expanded in y around 0 72.4%
mul-1-neg72.4%
associate-*l/70.8%
distribute-rgt-neg-in70.8%
Simplified70.8%
if 1.4500000000000001e44 < y < 2.05e87Initial program 100.0%
Taylor expanded in x around inf 66.9%
if 9.59999999999999953e101 < y Initial program 99.8%
Taylor expanded in x around inf 85.0%
associate-/l*85.1%
Simplified85.1%
Final simplification73.6%
(FPCore (x y z t a)
:precision binary64
(if (<= y -1.4e-101)
(* y (/ x a))
(if (<= y 1.95e+44)
(* (- z) (/ t a))
(if (<= y 1.95e+87)
(/ (* y x) a)
(if (<= y 1.9e+101) (* t (/ (- z) a)) (/ y (/ a x)))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -1.4e-101) {
tmp = y * (x / a);
} else if (y <= 1.95e+44) {
tmp = -z * (t / a);
} else if (y <= 1.95e+87) {
tmp = (y * x) / a;
} else if (y <= 1.9e+101) {
tmp = t * (-z / a);
} else {
tmp = y / (a / x);
}
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 (y <= (-1.4d-101)) then
tmp = y * (x / a)
else if (y <= 1.95d+44) then
tmp = -z * (t / a)
else if (y <= 1.95d+87) then
tmp = (y * x) / a
else if (y <= 1.9d+101) then
tmp = t * (-z / a)
else
tmp = y / (a / x)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -1.4e-101) {
tmp = y * (x / a);
} else if (y <= 1.95e+44) {
tmp = -z * (t / a);
} else if (y <= 1.95e+87) {
tmp = (y * x) / a;
} else if (y <= 1.9e+101) {
tmp = t * (-z / a);
} else {
tmp = y / (a / x);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if y <= -1.4e-101: tmp = y * (x / a) elif y <= 1.95e+44: tmp = -z * (t / a) elif y <= 1.95e+87: tmp = (y * x) / a elif y <= 1.9e+101: tmp = t * (-z / a) else: tmp = y / (a / x) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (y <= -1.4e-101) tmp = Float64(y * Float64(x / a)); elseif (y <= 1.95e+44) tmp = Float64(Float64(-z) * Float64(t / a)); elseif (y <= 1.95e+87) tmp = Float64(Float64(y * x) / a); elseif (y <= 1.9e+101) tmp = Float64(t * Float64(Float64(-z) / a)); else tmp = Float64(y / Float64(a / x)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (y <= -1.4e-101) tmp = y * (x / a); elseif (y <= 1.95e+44) tmp = -z * (t / a); elseif (y <= 1.95e+87) tmp = (y * x) / a; elseif (y <= 1.9e+101) tmp = t * (-z / a); else tmp = y / (a / x); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[y, -1.4e-101], N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.95e+44], N[((-z) * N[(t / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.95e+87], N[(N[(y * x), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[y, 1.9e+101], N[(t * N[((-z) / a), $MachinePrecision]), $MachinePrecision], N[(y / N[(a / x), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.4 \cdot 10^{-101}:\\
\;\;\;\;y \cdot \frac{x}{a}\\
\mathbf{elif}\;y \leq 1.95 \cdot 10^{+44}:\\
\;\;\;\;\left(-z\right) \cdot \frac{t}{a}\\
\mathbf{elif}\;y \leq 1.95 \cdot 10^{+87}:\\
\;\;\;\;\frac{y \cdot x}{a}\\
\mathbf{elif}\;y \leq 1.9 \cdot 10^{+101}:\\
\;\;\;\;t \cdot \frac{-z}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{\frac{a}{x}}\\
\end{array}
\end{array}
if y < -1.39999999999999995e-101Initial program 97.6%
Taylor expanded in x around inf 73.0%
associate-*r/72.0%
Simplified72.0%
if -1.39999999999999995e-101 < y < 1.9500000000000001e44Initial program 97.0%
Taylor expanded in x around 0 95.1%
+-commutative95.1%
mul-1-neg95.1%
sub-neg95.1%
div-sub97.0%
fma-neg97.0%
distribute-rgt-neg-out97.0%
Simplified97.0%
Taylor expanded in y around 0 72.3%
mul-1-neg72.3%
associate-*l/70.6%
distribute-rgt-neg-in70.6%
Simplified70.6%
if 1.9500000000000001e44 < y < 1.9500000000000001e87Initial program 100.0%
Taylor expanded in x around inf 66.9%
if 1.9500000000000001e87 < y < 1.8999999999999999e101Initial program 99.6%
Taylor expanded in x around 0 75.5%
associate-*r/75.5%
mul-1-neg75.5%
distribute-rgt-neg-out75.5%
*-commutative75.5%
associate-/l*75.4%
associate-/r/75.4%
Simplified75.4%
if 1.8999999999999999e101 < y Initial program 99.8%
Taylor expanded in x around inf 85.0%
associate-/l*85.1%
Simplified85.1%
Final simplification73.6%
(FPCore (x y z t a)
:precision binary64
(if (<= y -4.8e-109)
(* y (/ x a))
(if (<= y 1.9e+44)
(/ z (- (/ a t)))
(if (<= y 2.05e+87)
(/ (* y x) a)
(if (<= y 3.1e+101) (* t (/ (- z) a)) (/ y (/ a x)))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -4.8e-109) {
tmp = y * (x / a);
} else if (y <= 1.9e+44) {
tmp = z / -(a / t);
} else if (y <= 2.05e+87) {
tmp = (y * x) / a;
} else if (y <= 3.1e+101) {
tmp = t * (-z / a);
} else {
tmp = y / (a / x);
}
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 (y <= (-4.8d-109)) then
tmp = y * (x / a)
else if (y <= 1.9d+44) then
tmp = z / -(a / t)
else if (y <= 2.05d+87) then
tmp = (y * x) / a
else if (y <= 3.1d+101) then
tmp = t * (-z / a)
else
tmp = y / (a / x)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -4.8e-109) {
tmp = y * (x / a);
} else if (y <= 1.9e+44) {
tmp = z / -(a / t);
} else if (y <= 2.05e+87) {
tmp = (y * x) / a;
} else if (y <= 3.1e+101) {
tmp = t * (-z / a);
} else {
tmp = y / (a / x);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if y <= -4.8e-109: tmp = y * (x / a) elif y <= 1.9e+44: tmp = z / -(a / t) elif y <= 2.05e+87: tmp = (y * x) / a elif y <= 3.1e+101: tmp = t * (-z / a) else: tmp = y / (a / x) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (y <= -4.8e-109) tmp = Float64(y * Float64(x / a)); elseif (y <= 1.9e+44) tmp = Float64(z / Float64(-Float64(a / t))); elseif (y <= 2.05e+87) tmp = Float64(Float64(y * x) / a); elseif (y <= 3.1e+101) tmp = Float64(t * Float64(Float64(-z) / a)); else tmp = Float64(y / Float64(a / x)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (y <= -4.8e-109) tmp = y * (x / a); elseif (y <= 1.9e+44) tmp = z / -(a / t); elseif (y <= 2.05e+87) tmp = (y * x) / a; elseif (y <= 3.1e+101) tmp = t * (-z / a); else tmp = y / (a / x); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[y, -4.8e-109], N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.9e+44], N[(z / (-N[(a / t), $MachinePrecision])), $MachinePrecision], If[LessEqual[y, 2.05e+87], N[(N[(y * x), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[y, 3.1e+101], N[(t * N[((-z) / a), $MachinePrecision]), $MachinePrecision], N[(y / N[(a / x), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.8 \cdot 10^{-109}:\\
\;\;\;\;y \cdot \frac{x}{a}\\
\mathbf{elif}\;y \leq 1.9 \cdot 10^{+44}:\\
\;\;\;\;\frac{z}{-\frac{a}{t}}\\
\mathbf{elif}\;y \leq 2.05 \cdot 10^{+87}:\\
\;\;\;\;\frac{y \cdot x}{a}\\
\mathbf{elif}\;y \leq 3.1 \cdot 10^{+101}:\\
\;\;\;\;t \cdot \frac{-z}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{\frac{a}{x}}\\
\end{array}
\end{array}
if y < -4.79999999999999977e-109Initial program 97.7%
Taylor expanded in x around inf 73.3%
associate-*r/71.3%
Simplified71.3%
if -4.79999999999999977e-109 < y < 1.9000000000000001e44Initial program 97.0%
Taylor expanded in x around 0 72.9%
associate-*r/72.9%
mul-1-neg72.9%
distribute-rgt-neg-out72.9%
*-commutative72.9%
associate-/l*71.4%
associate-/r/66.9%
Simplified66.9%
add-sqr-sqrt32.2%
sqrt-unprod26.8%
sqr-neg26.8%
sqrt-unprod1.7%
add-sqr-sqrt3.2%
associate-/r/4.1%
frac-2neg4.1%
add-sqr-sqrt2.4%
sqrt-unprod30.1%
sqr-neg30.1%
sqrt-unprod35.5%
add-sqr-sqrt71.4%
Applied egg-rr71.4%
if 1.9000000000000001e44 < y < 2.05e87Initial program 100.0%
Taylor expanded in x around inf 66.9%
if 2.05e87 < y < 3.09999999999999999e101Initial program 99.6%
Taylor expanded in x around 0 75.5%
associate-*r/75.5%
mul-1-neg75.5%
distribute-rgt-neg-out75.5%
*-commutative75.5%
associate-/l*75.4%
associate-/r/75.4%
Simplified75.4%
if 3.09999999999999999e101 < y Initial program 99.8%
Taylor expanded in x around inf 85.0%
associate-/l*85.1%
Simplified85.1%
Final simplification73.6%
(FPCore (x y z t a) :precision binary64 (if (<= y -5e-102) (* y (/ x a)) (if (<= y 1.02e+101) (/ (* t (- z)) a) (/ y (/ a x)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -5e-102) {
tmp = y * (x / a);
} else if (y <= 1.02e+101) {
tmp = (t * -z) / a;
} else {
tmp = y / (a / x);
}
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 (y <= (-5d-102)) then
tmp = y * (x / a)
else if (y <= 1.02d+101) then
tmp = (t * -z) / a
else
tmp = y / (a / x)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -5e-102) {
tmp = y * (x / a);
} else if (y <= 1.02e+101) {
tmp = (t * -z) / a;
} else {
tmp = y / (a / x);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if y <= -5e-102: tmp = y * (x / a) elif y <= 1.02e+101: tmp = (t * -z) / a else: tmp = y / (a / x) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (y <= -5e-102) tmp = Float64(y * Float64(x / a)); elseif (y <= 1.02e+101) tmp = Float64(Float64(t * Float64(-z)) / a); else tmp = Float64(y / Float64(a / x)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (y <= -5e-102) tmp = y * (x / a); elseif (y <= 1.02e+101) tmp = (t * -z) / a; else tmp = y / (a / x); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[y, -5e-102], N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.02e+101], N[(N[(t * (-z)), $MachinePrecision] / a), $MachinePrecision], N[(y / N[(a / x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5 \cdot 10^{-102}:\\
\;\;\;\;y \cdot \frac{x}{a}\\
\mathbf{elif}\;y \leq 1.02 \cdot 10^{+101}:\\
\;\;\;\;\frac{t \cdot \left(-z\right)}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{\frac{a}{x}}\\
\end{array}
\end{array}
if y < -5.00000000000000026e-102Initial program 97.6%
Taylor expanded in x around inf 73.0%
associate-*r/72.0%
Simplified72.0%
if -5.00000000000000026e-102 < y < 1.02000000000000002e101Initial program 97.3%
Taylor expanded in x around 0 70.3%
associate-*r/70.3%
associate-*r*70.3%
neg-mul-170.3%
Simplified70.3%
if 1.02000000000000002e101 < y Initial program 99.8%
Taylor expanded in x around inf 85.0%
associate-/l*85.1%
Simplified85.1%
Final simplification73.5%
(FPCore (x y z t a) :precision binary64 (/ (- (* y x) (* t z)) a))
double code(double x, double y, double z, double t, double a) {
return ((y * x) - (t * z)) / 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 = ((y * x) - (t * z)) / a
end function
public static double code(double x, double y, double z, double t, double a) {
return ((y * x) - (t * z)) / a;
}
def code(x, y, z, t, a): return ((y * x) - (t * z)) / a
function code(x, y, z, t, a) return Float64(Float64(Float64(y * x) - Float64(t * z)) / a) end
function tmp = code(x, y, z, t, a) tmp = ((y * x) - (t * z)) / a; end
code[x_, y_, z_, t_, a_] := N[(N[(N[(y * x), $MachinePrecision] - N[(t * z), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]
\begin{array}{l}
\\
\frac{y \cdot x - t \cdot z}{a}
\end{array}
Initial program 97.9%
Final simplification97.9%
(FPCore (x y z t a) :precision binary64 (* y (/ x a)))
double code(double x, double y, double z, double t, double a) {
return y * (x / 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 = y * (x / a)
end function
public static double code(double x, double y, double z, double t, double a) {
return y * (x / a);
}
def code(x, y, z, t, a): return y * (x / a)
function code(x, y, z, t, a) return Float64(y * Float64(x / a)) end
function tmp = code(x, y, z, t, a) tmp = y * (x / a); end
code[x_, y_, z_, t_, a_] := N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
y \cdot \frac{x}{a}
\end{array}
Initial program 97.9%
Taylor expanded in x around inf 56.3%
associate-*r/55.2%
Simplified55.2%
Final simplification55.2%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- (* (/ y a) x) (* (/ t a) z))))
(if (< z -2.468684968699548e+170)
t_1
(if (< z 6.309831121978371e-71) (/ (- (* x y) (* z t)) a) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = ((y / a) * x) - ((t / a) * z);
double tmp;
if (z < -2.468684968699548e+170) {
tmp = t_1;
} else if (z < 6.309831121978371e-71) {
tmp = ((x * y) - (z * t)) / a;
} else {
tmp = 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 = ((y / a) * x) - ((t / a) * z)
if (z < (-2.468684968699548d+170)) then
tmp = t_1
else if (z < 6.309831121978371d-71) then
tmp = ((x * y) - (z * t)) / a
else
tmp = 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 = ((y / a) * x) - ((t / a) * z);
double tmp;
if (z < -2.468684968699548e+170) {
tmp = t_1;
} else if (z < 6.309831121978371e-71) {
tmp = ((x * y) - (z * t)) / a;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = ((y / a) * x) - ((t / a) * z) tmp = 0 if z < -2.468684968699548e+170: tmp = t_1 elif z < 6.309831121978371e-71: tmp = ((x * y) - (z * t)) / a else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(Float64(y / a) * x) - Float64(Float64(t / a) * z)) tmp = 0.0 if (z < -2.468684968699548e+170) tmp = t_1; elseif (z < 6.309831121978371e-71) tmp = Float64(Float64(Float64(x * y) - Float64(z * t)) / a); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = ((y / a) * x) - ((t / a) * z); tmp = 0.0; if (z < -2.468684968699548e+170) tmp = t_1; elseif (z < 6.309831121978371e-71) tmp = ((x * y) - (z * t)) / a; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(y / a), $MachinePrecision] * x), $MachinePrecision] - N[(N[(t / a), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]}, If[Less[z, -2.468684968699548e+170], t$95$1, If[Less[z, 6.309831121978371e-71], N[(N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y}{a} \cdot x - \frac{t}{a} \cdot z\\
\mathbf{if}\;z < -2.468684968699548 \cdot 10^{+170}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z < 6.309831121978371 \cdot 10^{-71}:\\
\;\;\;\;\frac{x \cdot y - z \cdot t}{a}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
herbie shell --seed 2023278
(FPCore (x y z t a)
:name "Data.Colour.Matrix:inverse from colour-2.3.3, B"
:precision binary64
:herbie-target
(if (< z -2.468684968699548e+170) (- (* (/ y a) x) (* (/ t a) z)) (if (< z 6.309831121978371e-71) (/ (- (* x y) (* z t)) a) (- (* (/ y a) x) (* (/ t a) z))))
(/ (- (* x y) (* z t)) a))