
(FPCore (x y z) :precision binary64 (/ (* x (+ (- y z) 1.0)) z))
double code(double x, double y, double z) {
return (x * ((y - z) + 1.0)) / z;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (x * ((y - z) + 1.0d0)) / z
end function
public static double code(double x, double y, double z) {
return (x * ((y - z) + 1.0)) / z;
}
def code(x, y, z): return (x * ((y - z) + 1.0)) / z
function code(x, y, z) return Float64(Float64(x * Float64(Float64(y - z) + 1.0)) / z) end
function tmp = code(x, y, z) tmp = (x * ((y - z) + 1.0)) / z; end
code[x_, y_, z_] := N[(N[(x * N[(N[(y - z), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot \left(\left(y - z\right) + 1\right)}{z}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 14 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (/ (* x (+ (- y z) 1.0)) z))
double code(double x, double y, double z) {
return (x * ((y - z) + 1.0)) / z;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (x * ((y - z) + 1.0d0)) / z
end function
public static double code(double x, double y, double z) {
return (x * ((y - z) + 1.0)) / z;
}
def code(x, y, z): return (x * ((y - z) + 1.0)) / z
function code(x, y, z) return Float64(Float64(x * Float64(Float64(y - z) + 1.0)) / z) end
function tmp = code(x, y, z) tmp = (x * ((y - z) + 1.0)) / z; end
code[x_, y_, z_] := N[(N[(x * N[(N[(y - z), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot \left(\left(y - z\right) + 1\right)}{z}
\end{array}
(FPCore (x y z) :precision binary64 (if (or (<= z -1.5e-17) (not (<= z 9.2e-48))) (- (/ x (/ z (+ 1.0 y))) x) (/ (+ x (* x y)) z)))
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.5e-17) || !(z <= 9.2e-48)) {
tmp = (x / (z / (1.0 + y))) - x;
} else {
tmp = (x + (x * y)) / z;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((z <= (-1.5d-17)) .or. (.not. (z <= 9.2d-48))) then
tmp = (x / (z / (1.0d0 + y))) - x
else
tmp = (x + (x * y)) / z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -1.5e-17) || !(z <= 9.2e-48)) {
tmp = (x / (z / (1.0 + y))) - x;
} else {
tmp = (x + (x * y)) / z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -1.5e-17) or not (z <= 9.2e-48): tmp = (x / (z / (1.0 + y))) - x else: tmp = (x + (x * y)) / z return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -1.5e-17) || !(z <= 9.2e-48)) tmp = Float64(Float64(x / Float64(z / Float64(1.0 + y))) - x); else tmp = Float64(Float64(x + Float64(x * y)) / z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -1.5e-17) || ~((z <= 9.2e-48))) tmp = (x / (z / (1.0 + y))) - x; else tmp = (x + (x * y)) / z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -1.5e-17], N[Not[LessEqual[z, 9.2e-48]], $MachinePrecision]], N[(N[(x / N[(z / N[(1.0 + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision], N[(N[(x + N[(x * y), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.5 \cdot 10^{-17} \lor \neg \left(z \leq 9.2 \cdot 10^{-48}\right):\\
\;\;\;\;\frac{x}{\frac{z}{1 + y}} - x\\
\mathbf{else}:\\
\;\;\;\;\frac{x + x \cdot y}{z}\\
\end{array}
\end{array}
if z < -1.50000000000000003e-17 or 9.2000000000000003e-48 < z Initial program 75.5%
Taylor expanded in x around 0 75.5%
associate--l+75.5%
+-commutative75.5%
associate-*r/99.8%
+-commutative99.8%
associate--l+99.8%
div-sub99.8%
sub-neg99.8%
*-inverses99.8%
metadata-eval99.8%
Simplified99.8%
distribute-rgt-in99.8%
neg-mul-199.8%
unsub-neg99.8%
clear-num99.8%
associate-*l/99.9%
*-un-lft-identity99.9%
Applied egg-rr99.9%
if -1.50000000000000003e-17 < z < 9.2000000000000003e-48Initial program 99.9%
distribute-lft-in99.9%
fma-def99.9%
*-rgt-identity99.9%
Simplified99.9%
Taylor expanded in z around 0 99.9%
Final simplification99.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* y (/ x z))) (t_1 (* x (/ y z))))
(if (<= z -3.2e+77)
(- x)
(if (<= z -2.55e-79)
t_1
(if (<= z -2.5e-93)
(/ x z)
(if (<= z -1.65e-267)
t_0
(if (<= z 1.55e-229)
(/ x z)
(if (<= z 1.4e-208)
t_0
(if (<= z 3.25e-159)
(* x (/ 1.0 z))
(if (<= z 6.3e-65)
t_0
(if (<= z 8.6e-13)
(/ x z)
(if (<= z 1.35e+105) t_1 (- x)))))))))))))
double code(double x, double y, double z) {
double t_0 = y * (x / z);
double t_1 = x * (y / z);
double tmp;
if (z <= -3.2e+77) {
tmp = -x;
} else if (z <= -2.55e-79) {
tmp = t_1;
} else if (z <= -2.5e-93) {
tmp = x / z;
} else if (z <= -1.65e-267) {
tmp = t_0;
} else if (z <= 1.55e-229) {
tmp = x / z;
} else if (z <= 1.4e-208) {
tmp = t_0;
} else if (z <= 3.25e-159) {
tmp = x * (1.0 / z);
} else if (z <= 6.3e-65) {
tmp = t_0;
} else if (z <= 8.6e-13) {
tmp = x / z;
} else if (z <= 1.35e+105) {
tmp = t_1;
} else {
tmp = -x;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = y * (x / z)
t_1 = x * (y / z)
if (z <= (-3.2d+77)) then
tmp = -x
else if (z <= (-2.55d-79)) then
tmp = t_1
else if (z <= (-2.5d-93)) then
tmp = x / z
else if (z <= (-1.65d-267)) then
tmp = t_0
else if (z <= 1.55d-229) then
tmp = x / z
else if (z <= 1.4d-208) then
tmp = t_0
else if (z <= 3.25d-159) then
tmp = x * (1.0d0 / z)
else if (z <= 6.3d-65) then
tmp = t_0
else if (z <= 8.6d-13) then
tmp = x / z
else if (z <= 1.35d+105) then
tmp = t_1
else
tmp = -x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = y * (x / z);
double t_1 = x * (y / z);
double tmp;
if (z <= -3.2e+77) {
tmp = -x;
} else if (z <= -2.55e-79) {
tmp = t_1;
} else if (z <= -2.5e-93) {
tmp = x / z;
} else if (z <= -1.65e-267) {
tmp = t_0;
} else if (z <= 1.55e-229) {
tmp = x / z;
} else if (z <= 1.4e-208) {
tmp = t_0;
} else if (z <= 3.25e-159) {
tmp = x * (1.0 / z);
} else if (z <= 6.3e-65) {
tmp = t_0;
} else if (z <= 8.6e-13) {
tmp = x / z;
} else if (z <= 1.35e+105) {
tmp = t_1;
} else {
tmp = -x;
}
return tmp;
}
def code(x, y, z): t_0 = y * (x / z) t_1 = x * (y / z) tmp = 0 if z <= -3.2e+77: tmp = -x elif z <= -2.55e-79: tmp = t_1 elif z <= -2.5e-93: tmp = x / z elif z <= -1.65e-267: tmp = t_0 elif z <= 1.55e-229: tmp = x / z elif z <= 1.4e-208: tmp = t_0 elif z <= 3.25e-159: tmp = x * (1.0 / z) elif z <= 6.3e-65: tmp = t_0 elif z <= 8.6e-13: tmp = x / z elif z <= 1.35e+105: tmp = t_1 else: tmp = -x return tmp
function code(x, y, z) t_0 = Float64(y * Float64(x / z)) t_1 = Float64(x * Float64(y / z)) tmp = 0.0 if (z <= -3.2e+77) tmp = Float64(-x); elseif (z <= -2.55e-79) tmp = t_1; elseif (z <= -2.5e-93) tmp = Float64(x / z); elseif (z <= -1.65e-267) tmp = t_0; elseif (z <= 1.55e-229) tmp = Float64(x / z); elseif (z <= 1.4e-208) tmp = t_0; elseif (z <= 3.25e-159) tmp = Float64(x * Float64(1.0 / z)); elseif (z <= 6.3e-65) tmp = t_0; elseif (z <= 8.6e-13) tmp = Float64(x / z); elseif (z <= 1.35e+105) tmp = t_1; else tmp = Float64(-x); end return tmp end
function tmp_2 = code(x, y, z) t_0 = y * (x / z); t_1 = x * (y / z); tmp = 0.0; if (z <= -3.2e+77) tmp = -x; elseif (z <= -2.55e-79) tmp = t_1; elseif (z <= -2.5e-93) tmp = x / z; elseif (z <= -1.65e-267) tmp = t_0; elseif (z <= 1.55e-229) tmp = x / z; elseif (z <= 1.4e-208) tmp = t_0; elseif (z <= 3.25e-159) tmp = x * (1.0 / z); elseif (z <= 6.3e-65) tmp = t_0; elseif (z <= 8.6e-13) tmp = x / z; elseif (z <= 1.35e+105) tmp = t_1; else tmp = -x; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -3.2e+77], (-x), If[LessEqual[z, -2.55e-79], t$95$1, If[LessEqual[z, -2.5e-93], N[(x / z), $MachinePrecision], If[LessEqual[z, -1.65e-267], t$95$0, If[LessEqual[z, 1.55e-229], N[(x / z), $MachinePrecision], If[LessEqual[z, 1.4e-208], t$95$0, If[LessEqual[z, 3.25e-159], N[(x * N[(1.0 / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 6.3e-65], t$95$0, If[LessEqual[z, 8.6e-13], N[(x / z), $MachinePrecision], If[LessEqual[z, 1.35e+105], t$95$1, (-x)]]]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y \cdot \frac{x}{z}\\
t_1 := x \cdot \frac{y}{z}\\
\mathbf{if}\;z \leq -3.2 \cdot 10^{+77}:\\
\;\;\;\;-x\\
\mathbf{elif}\;z \leq -2.55 \cdot 10^{-79}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -2.5 \cdot 10^{-93}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{elif}\;z \leq -1.65 \cdot 10^{-267}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 1.55 \cdot 10^{-229}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{elif}\;z \leq 1.4 \cdot 10^{-208}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 3.25 \cdot 10^{-159}:\\
\;\;\;\;x \cdot \frac{1}{z}\\
\mathbf{elif}\;z \leq 6.3 \cdot 10^{-65}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 8.6 \cdot 10^{-13}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{elif}\;z \leq 1.35 \cdot 10^{+105}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;-x\\
\end{array}
\end{array}
if z < -3.2000000000000002e77 or 1.35000000000000008e105 < z Initial program 65.6%
Taylor expanded in z around inf 80.8%
mul-1-neg80.8%
Simplified80.8%
if -3.2000000000000002e77 < z < -2.55e-79 or 8.5999999999999997e-13 < z < 1.35000000000000008e105Initial program 91.6%
Taylor expanded in y around inf 62.9%
associate-/l*69.4%
Simplified69.4%
clear-num69.3%
associate-/r/69.3%
clear-num69.3%
Applied egg-rr69.3%
if -2.55e-79 < z < -2.49999999999999997e-93 or -1.65000000000000002e-267 < z < 1.55e-229 or 6.2999999999999997e-65 < z < 8.5999999999999997e-13Initial program 100.0%
Taylor expanded in y around 0 87.0%
Taylor expanded in z around 0 86.6%
if -2.49999999999999997e-93 < z < -1.65000000000000002e-267 or 1.55e-229 < z < 1.40000000000000001e-208 or 3.2500000000000001e-159 < z < 6.2999999999999997e-65Initial program 99.8%
Taylor expanded in y around inf 70.9%
associate-/l*57.6%
associate-/r/74.1%
Simplified74.1%
if 1.40000000000000001e-208 < z < 3.2500000000000001e-159Initial program 100.0%
Taylor expanded in y around 0 93.5%
*-un-lft-identity93.5%
times-frac93.5%
add-sqr-sqrt33.0%
sqrt-unprod23.0%
sqr-neg23.0%
sqrt-unprod0.3%
add-sqr-sqrt0.6%
div-inv0.6%
metadata-eval0.6%
*-commutative0.6%
*-un-lft-identity0.6%
add-sqr-sqrt0.3%
sqrt-unprod23.0%
sqr-neg23.0%
sqrt-unprod33.0%
add-sqr-sqrt93.5%
Applied egg-rr93.5%
Taylor expanded in z around 0 93.5%
Final simplification78.2%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* y (/ x z))))
(if (<= y -5.6e+36)
t_0
(if (<= y -7.2e-130)
(- x)
(if (<= y -1.45e-162)
(/ x z)
(if (<= y -4.1e-199)
(- x)
(if (<= y -2.25e-267)
(/ x z)
(if (<= y 2.75e-266)
(- x)
(if (<= y 4.2e-95)
(/ x z)
(if (<= y 5.2e-78) (- x) (if (<= y 1.0) (/ x z) t_0)))))))))))
double code(double x, double y, double z) {
double t_0 = y * (x / z);
double tmp;
if (y <= -5.6e+36) {
tmp = t_0;
} else if (y <= -7.2e-130) {
tmp = -x;
} else if (y <= -1.45e-162) {
tmp = x / z;
} else if (y <= -4.1e-199) {
tmp = -x;
} else if (y <= -2.25e-267) {
tmp = x / z;
} else if (y <= 2.75e-266) {
tmp = -x;
} else if (y <= 4.2e-95) {
tmp = x / z;
} else if (y <= 5.2e-78) {
tmp = -x;
} else if (y <= 1.0) {
tmp = x / z;
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = y * (x / z)
if (y <= (-5.6d+36)) then
tmp = t_0
else if (y <= (-7.2d-130)) then
tmp = -x
else if (y <= (-1.45d-162)) then
tmp = x / z
else if (y <= (-4.1d-199)) then
tmp = -x
else if (y <= (-2.25d-267)) then
tmp = x / z
else if (y <= 2.75d-266) then
tmp = -x
else if (y <= 4.2d-95) then
tmp = x / z
else if (y <= 5.2d-78) then
tmp = -x
else if (y <= 1.0d0) then
tmp = x / z
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = y * (x / z);
double tmp;
if (y <= -5.6e+36) {
tmp = t_0;
} else if (y <= -7.2e-130) {
tmp = -x;
} else if (y <= -1.45e-162) {
tmp = x / z;
} else if (y <= -4.1e-199) {
tmp = -x;
} else if (y <= -2.25e-267) {
tmp = x / z;
} else if (y <= 2.75e-266) {
tmp = -x;
} else if (y <= 4.2e-95) {
tmp = x / z;
} else if (y <= 5.2e-78) {
tmp = -x;
} else if (y <= 1.0) {
tmp = x / z;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = y * (x / z) tmp = 0 if y <= -5.6e+36: tmp = t_0 elif y <= -7.2e-130: tmp = -x elif y <= -1.45e-162: tmp = x / z elif y <= -4.1e-199: tmp = -x elif y <= -2.25e-267: tmp = x / z elif y <= 2.75e-266: tmp = -x elif y <= 4.2e-95: tmp = x / z elif y <= 5.2e-78: tmp = -x elif y <= 1.0: tmp = x / z else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(y * Float64(x / z)) tmp = 0.0 if (y <= -5.6e+36) tmp = t_0; elseif (y <= -7.2e-130) tmp = Float64(-x); elseif (y <= -1.45e-162) tmp = Float64(x / z); elseif (y <= -4.1e-199) tmp = Float64(-x); elseif (y <= -2.25e-267) tmp = Float64(x / z); elseif (y <= 2.75e-266) tmp = Float64(-x); elseif (y <= 4.2e-95) tmp = Float64(x / z); elseif (y <= 5.2e-78) tmp = Float64(-x); elseif (y <= 1.0) tmp = Float64(x / z); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = y * (x / z); tmp = 0.0; if (y <= -5.6e+36) tmp = t_0; elseif (y <= -7.2e-130) tmp = -x; elseif (y <= -1.45e-162) tmp = x / z; elseif (y <= -4.1e-199) tmp = -x; elseif (y <= -2.25e-267) tmp = x / z; elseif (y <= 2.75e-266) tmp = -x; elseif (y <= 4.2e-95) tmp = x / z; elseif (y <= 5.2e-78) tmp = -x; elseif (y <= 1.0) tmp = x / z; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -5.6e+36], t$95$0, If[LessEqual[y, -7.2e-130], (-x), If[LessEqual[y, -1.45e-162], N[(x / z), $MachinePrecision], If[LessEqual[y, -4.1e-199], (-x), If[LessEqual[y, -2.25e-267], N[(x / z), $MachinePrecision], If[LessEqual[y, 2.75e-266], (-x), If[LessEqual[y, 4.2e-95], N[(x / z), $MachinePrecision], If[LessEqual[y, 5.2e-78], (-x), If[LessEqual[y, 1.0], N[(x / z), $MachinePrecision], t$95$0]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y \cdot \frac{x}{z}\\
\mathbf{if}\;y \leq -5.6 \cdot 10^{+36}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq -7.2 \cdot 10^{-130}:\\
\;\;\;\;-x\\
\mathbf{elif}\;y \leq -1.45 \cdot 10^{-162}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{elif}\;y \leq -4.1 \cdot 10^{-199}:\\
\;\;\;\;-x\\
\mathbf{elif}\;y \leq -2.25 \cdot 10^{-267}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{elif}\;y \leq 2.75 \cdot 10^{-266}:\\
\;\;\;\;-x\\
\mathbf{elif}\;y \leq 4.2 \cdot 10^{-95}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{elif}\;y \leq 5.2 \cdot 10^{-78}:\\
\;\;\;\;-x\\
\mathbf{elif}\;y \leq 1:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -5.6000000000000001e36 or 1 < y Initial program 85.5%
Taylor expanded in y around inf 76.6%
associate-/l*76.8%
associate-/r/80.4%
Simplified80.4%
if -5.6000000000000001e36 < y < -7.2000000000000003e-130 or -1.4500000000000001e-162 < y < -4.10000000000000022e-199 or -2.25e-267 < y < 2.75000000000000013e-266 or 4.2e-95 < y < 5.2000000000000002e-78Initial program 79.4%
Taylor expanded in z around inf 68.0%
mul-1-neg68.0%
Simplified68.0%
if -7.2000000000000003e-130 < y < -1.4500000000000001e-162 or -4.10000000000000022e-199 < y < -2.25e-267 or 2.75000000000000013e-266 < y < 4.2e-95 or 5.2000000000000002e-78 < y < 1Initial program 95.7%
Taylor expanded in y around 0 95.3%
Taylor expanded in z around 0 72.7%
Final simplification75.0%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* x (+ -1.0 (/ y z)))))
(if (<= y -3.0)
t_0
(if (<= y 1.0) (- (/ x z) x) (if (<= y 8.8e+192) t_0 (* y (/ x z)))))))
double code(double x, double y, double z) {
double t_0 = x * (-1.0 + (y / z));
double tmp;
if (y <= -3.0) {
tmp = t_0;
} else if (y <= 1.0) {
tmp = (x / z) - x;
} else if (y <= 8.8e+192) {
tmp = t_0;
} else {
tmp = y * (x / z);
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = x * ((-1.0d0) + (y / z))
if (y <= (-3.0d0)) then
tmp = t_0
else if (y <= 1.0d0) then
tmp = (x / z) - x
else if (y <= 8.8d+192) then
tmp = t_0
else
tmp = y * (x / z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = x * (-1.0 + (y / z));
double tmp;
if (y <= -3.0) {
tmp = t_0;
} else if (y <= 1.0) {
tmp = (x / z) - x;
} else if (y <= 8.8e+192) {
tmp = t_0;
} else {
tmp = y * (x / z);
}
return tmp;
}
def code(x, y, z): t_0 = x * (-1.0 + (y / z)) tmp = 0 if y <= -3.0: tmp = t_0 elif y <= 1.0: tmp = (x / z) - x elif y <= 8.8e+192: tmp = t_0 else: tmp = y * (x / z) return tmp
function code(x, y, z) t_0 = Float64(x * Float64(-1.0 + Float64(y / z))) tmp = 0.0 if (y <= -3.0) tmp = t_0; elseif (y <= 1.0) tmp = Float64(Float64(x / z) - x); elseif (y <= 8.8e+192) tmp = t_0; else tmp = Float64(y * Float64(x / z)); end return tmp end
function tmp_2 = code(x, y, z) t_0 = x * (-1.0 + (y / z)); tmp = 0.0; if (y <= -3.0) tmp = t_0; elseif (y <= 1.0) tmp = (x / z) - x; elseif (y <= 8.8e+192) tmp = t_0; else tmp = y * (x / z); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x * N[(-1.0 + N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -3.0], t$95$0, If[LessEqual[y, 1.0], N[(N[(x / z), $MachinePrecision] - x), $MachinePrecision], If[LessEqual[y, 8.8e+192], t$95$0, N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \left(-1 + \frac{y}{z}\right)\\
\mathbf{if}\;y \leq -3:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 1:\\
\;\;\;\;\frac{x}{z} - x\\
\mathbf{elif}\;y \leq 8.8 \cdot 10^{+192}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x}{z}\\
\end{array}
\end{array}
if y < -3 or 1 < y < 8.8000000000000003e192Initial program 82.2%
Taylor expanded in x around 0 82.2%
associate--l+82.2%
+-commutative82.2%
associate-*r/94.3%
+-commutative94.3%
associate--l+94.3%
div-sub94.3%
sub-neg94.3%
*-inverses94.3%
metadata-eval94.3%
Simplified94.3%
Taylor expanded in y around inf 93.7%
if -3 < y < 1Initial program 88.4%
Taylor expanded in x around 0 88.4%
associate--l+88.4%
+-commutative88.4%
associate-*r/99.7%
+-commutative99.7%
associate--l+99.7%
div-sub99.7%
sub-neg99.7%
*-inverses99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in y around 0 99.1%
sub-neg99.1%
metadata-eval99.1%
distribute-rgt-in99.1%
associate-*l/99.3%
*-lft-identity99.3%
neg-mul-199.3%
unsub-neg99.3%
Simplified99.3%
if 8.8000000000000003e192 < y Initial program 95.7%
Taylor expanded in y around inf 94.4%
associate-/l*83.5%
associate-/r/98.2%
Simplified98.2%
Final simplification97.0%
(FPCore (x y z) :precision binary64 (if (or (<= z -5e-14) (not (<= z 9.5e-17))) (* x (+ -1.0 (/ (+ 1.0 y) z))) (/ (+ x (* x y)) z)))
double code(double x, double y, double z) {
double tmp;
if ((z <= -5e-14) || !(z <= 9.5e-17)) {
tmp = x * (-1.0 + ((1.0 + y) / z));
} else {
tmp = (x + (x * y)) / z;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((z <= (-5d-14)) .or. (.not. (z <= 9.5d-17))) then
tmp = x * ((-1.0d0) + ((1.0d0 + y) / z))
else
tmp = (x + (x * y)) / z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -5e-14) || !(z <= 9.5e-17)) {
tmp = x * (-1.0 + ((1.0 + y) / z));
} else {
tmp = (x + (x * y)) / z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -5e-14) or not (z <= 9.5e-17): tmp = x * (-1.0 + ((1.0 + y) / z)) else: tmp = (x + (x * y)) / z return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -5e-14) || !(z <= 9.5e-17)) tmp = Float64(x * Float64(-1.0 + Float64(Float64(1.0 + y) / z))); else tmp = Float64(Float64(x + Float64(x * y)) / z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -5e-14) || ~((z <= 9.5e-17))) tmp = x * (-1.0 + ((1.0 + y) / z)); else tmp = (x + (x * y)) / z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -5e-14], N[Not[LessEqual[z, 9.5e-17]], $MachinePrecision]], N[(x * N[(-1.0 + N[(N[(1.0 + y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x + N[(x * y), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5 \cdot 10^{-14} \lor \neg \left(z \leq 9.5 \cdot 10^{-17}\right):\\
\;\;\;\;x \cdot \left(-1 + \frac{1 + y}{z}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x + x \cdot y}{z}\\
\end{array}
\end{array}
if z < -5.0000000000000002e-14 or 9.50000000000000029e-17 < z Initial program 73.8%
Taylor expanded in x around 0 73.8%
associate--l+73.8%
+-commutative73.8%
associate-*r/99.8%
+-commutative99.8%
associate--l+99.8%
div-sub99.8%
sub-neg99.8%
*-inverses99.8%
metadata-eval99.8%
Simplified99.8%
if -5.0000000000000002e-14 < z < 9.50000000000000029e-17Initial program 99.9%
distribute-lft-in99.9%
fma-def99.9%
*-rgt-identity99.9%
Simplified99.9%
Taylor expanded in z around 0 99.9%
Final simplification99.9%
(FPCore (x y z) :precision binary64 (if (or (<= y -3.0) (not (<= y 1.0))) (- (/ x (/ z y)) x) (- (/ x z) x)))
double code(double x, double y, double z) {
double tmp;
if ((y <= -3.0) || !(y <= 1.0)) {
tmp = (x / (z / y)) - x;
} else {
tmp = (x / z) - x;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((y <= (-3.0d0)) .or. (.not. (y <= 1.0d0))) then
tmp = (x / (z / y)) - x
else
tmp = (x / z) - x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -3.0) || !(y <= 1.0)) {
tmp = (x / (z / y)) - x;
} else {
tmp = (x / z) - x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -3.0) or not (y <= 1.0): tmp = (x / (z / y)) - x else: tmp = (x / z) - x return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -3.0) || !(y <= 1.0)) tmp = Float64(Float64(x / Float64(z / y)) - x); else tmp = Float64(Float64(x / z) - x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -3.0) || ~((y <= 1.0))) tmp = (x / (z / y)) - x; else tmp = (x / z) - x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -3.0], N[Not[LessEqual[y, 1.0]], $MachinePrecision]], N[(N[(x / N[(z / y), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision], N[(N[(x / z), $MachinePrecision] - x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3 \lor \neg \left(y \leq 1\right):\\
\;\;\;\;\frac{x}{\frac{z}{y}} - x\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z} - x\\
\end{array}
\end{array}
if y < -3 or 1 < y Initial program 84.8%
Taylor expanded in x around 0 84.8%
associate--l+84.8%
+-commutative84.8%
associate-*r/91.6%
+-commutative91.6%
associate--l+91.6%
div-sub91.6%
sub-neg91.6%
*-inverses91.6%
metadata-eval91.6%
Simplified91.6%
distribute-rgt-in91.6%
neg-mul-191.6%
unsub-neg91.6%
clear-num91.5%
associate-*l/92.5%
*-un-lft-identity92.5%
Applied egg-rr92.5%
Taylor expanded in y around inf 92.0%
if -3 < y < 1Initial program 88.4%
Taylor expanded in x around 0 88.4%
associate--l+88.4%
+-commutative88.4%
associate-*r/99.7%
+-commutative99.7%
associate--l+99.7%
div-sub99.7%
sub-neg99.7%
*-inverses99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in y around 0 99.1%
sub-neg99.1%
metadata-eval99.1%
distribute-rgt-in99.1%
associate-*l/99.3%
*-lft-identity99.3%
neg-mul-199.3%
unsub-neg99.3%
Simplified99.3%
Final simplification95.7%
(FPCore (x y z) :precision binary64 (if (<= z -1.0) (* x (+ -1.0 (/ y z))) (if (<= z 1.0) (/ (+ x (* x y)) z) (- (/ x (/ z y)) x))))
double code(double x, double y, double z) {
double tmp;
if (z <= -1.0) {
tmp = x * (-1.0 + (y / z));
} else if (z <= 1.0) {
tmp = (x + (x * y)) / z;
} else {
tmp = (x / (z / y)) - x;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (z <= (-1.0d0)) then
tmp = x * ((-1.0d0) + (y / z))
else if (z <= 1.0d0) then
tmp = (x + (x * y)) / z
else
tmp = (x / (z / y)) - x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -1.0) {
tmp = x * (-1.0 + (y / z));
} else if (z <= 1.0) {
tmp = (x + (x * y)) / z;
} else {
tmp = (x / (z / y)) - x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1.0: tmp = x * (-1.0 + (y / z)) elif z <= 1.0: tmp = (x + (x * y)) / z else: tmp = (x / (z / y)) - x return tmp
function code(x, y, z) tmp = 0.0 if (z <= -1.0) tmp = Float64(x * Float64(-1.0 + Float64(y / z))); elseif (z <= 1.0) tmp = Float64(Float64(x + Float64(x * y)) / z); else tmp = Float64(Float64(x / Float64(z / y)) - x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -1.0) tmp = x * (-1.0 + (y / z)); elseif (z <= 1.0) tmp = (x + (x * y)) / z; else tmp = (x / (z / y)) - x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -1.0], N[(x * N[(-1.0 + N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.0], N[(N[(x + N[(x * y), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], N[(N[(x / N[(z / y), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1:\\
\;\;\;\;x \cdot \left(-1 + \frac{y}{z}\right)\\
\mathbf{elif}\;z \leq 1:\\
\;\;\;\;\frac{x + x \cdot y}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{z}{y}} - x\\
\end{array}
\end{array}
if z < -1Initial program 69.8%
Taylor expanded in x around 0 69.8%
associate--l+69.8%
+-commutative69.8%
associate-*r/99.9%
+-commutative99.9%
associate--l+99.9%
div-sub99.9%
sub-neg99.9%
*-inverses99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in y around inf 99.3%
if -1 < z < 1Initial program 99.9%
distribute-lft-in99.9%
fma-def99.9%
*-rgt-identity99.9%
Simplified99.9%
Taylor expanded in z around 0 98.9%
if 1 < z Initial program 73.2%
Taylor expanded in x around 0 73.2%
associate--l+73.2%
+-commutative73.2%
associate-*r/99.8%
+-commutative99.8%
associate--l+99.8%
div-sub99.8%
sub-neg99.8%
*-inverses99.8%
metadata-eval99.8%
Simplified99.8%
distribute-rgt-in99.8%
neg-mul-199.8%
unsub-neg99.8%
clear-num99.8%
associate-*l/99.9%
*-un-lft-identity99.9%
Applied egg-rr99.9%
Taylor expanded in y around inf 98.3%
Final simplification98.8%
(FPCore (x y z) :precision binary64 (if (or (<= y -1.45e+34) (not (<= y 1.1e+117))) (* y (/ x z)) (- (/ x z) x)))
double code(double x, double y, double z) {
double tmp;
if ((y <= -1.45e+34) || !(y <= 1.1e+117)) {
tmp = y * (x / z);
} else {
tmp = (x / z) - x;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((y <= (-1.45d+34)) .or. (.not. (y <= 1.1d+117))) then
tmp = y * (x / z)
else
tmp = (x / z) - x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -1.45e+34) || !(y <= 1.1e+117)) {
tmp = y * (x / z);
} else {
tmp = (x / z) - x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -1.45e+34) or not (y <= 1.1e+117): tmp = y * (x / z) else: tmp = (x / z) - x return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -1.45e+34) || !(y <= 1.1e+117)) tmp = Float64(y * Float64(x / z)); else tmp = Float64(Float64(x / z) - x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -1.45e+34) || ~((y <= 1.1e+117))) tmp = y * (x / z); else tmp = (x / z) - x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -1.45e+34], N[Not[LessEqual[y, 1.1e+117]], $MachinePrecision]], N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision], N[(N[(x / z), $MachinePrecision] - x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.45 \cdot 10^{+34} \lor \neg \left(y \leq 1.1 \cdot 10^{+117}\right):\\
\;\;\;\;y \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z} - x\\
\end{array}
\end{array}
if y < -1.4500000000000001e34 or 1.10000000000000007e117 < y Initial program 84.9%
Taylor expanded in y around inf 77.5%
associate-/l*77.7%
associate-/r/82.6%
Simplified82.6%
if -1.4500000000000001e34 < y < 1.10000000000000007e117Initial program 87.9%
Taylor expanded in x around 0 87.9%
associate--l+87.9%
+-commutative87.9%
associate-*r/99.8%
+-commutative99.8%
associate--l+99.8%
div-sub99.8%
sub-neg99.8%
*-inverses99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in y around 0 95.3%
sub-neg95.3%
metadata-eval95.3%
distribute-rgt-in95.3%
associate-*l/95.6%
*-lft-identity95.6%
neg-mul-195.6%
unsub-neg95.6%
Simplified95.6%
Final simplification90.1%
(FPCore (x y z) :precision binary64 (if (<= y -2.3e+34) (/ y (/ z x)) (if (<= y 2.2e+116) (- (/ x z) x) (* y (/ x z)))))
double code(double x, double y, double z) {
double tmp;
if (y <= -2.3e+34) {
tmp = y / (z / x);
} else if (y <= 2.2e+116) {
tmp = (x / z) - x;
} else {
tmp = y * (x / z);
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (y <= (-2.3d+34)) then
tmp = y / (z / x)
else if (y <= 2.2d+116) then
tmp = (x / z) - x
else
tmp = y * (x / z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -2.3e+34) {
tmp = y / (z / x);
} else if (y <= 2.2e+116) {
tmp = (x / z) - x;
} else {
tmp = y * (x / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -2.3e+34: tmp = y / (z / x) elif y <= 2.2e+116: tmp = (x / z) - x else: tmp = y * (x / z) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -2.3e+34) tmp = Float64(y / Float64(z / x)); elseif (y <= 2.2e+116) tmp = Float64(Float64(x / z) - x); else tmp = Float64(y * Float64(x / z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -2.3e+34) tmp = y / (z / x); elseif (y <= 2.2e+116) tmp = (x / z) - x; else tmp = y * (x / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -2.3e+34], N[(y / N[(z / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.2e+116], N[(N[(x / z), $MachinePrecision] - x), $MachinePrecision], N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.3 \cdot 10^{+34}:\\
\;\;\;\;\frac{y}{\frac{z}{x}}\\
\mathbf{elif}\;y \leq 2.2 \cdot 10^{+116}:\\
\;\;\;\;\frac{x}{z} - x\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x}{z}\\
\end{array}
\end{array}
if y < -2.2999999999999998e34Initial program 81.0%
Taylor expanded in x around 0 81.0%
associate--l+81.0%
+-commutative81.0%
associate-*r/94.1%
+-commutative94.1%
associate--l+94.1%
div-sub94.1%
sub-neg94.1%
*-inverses94.1%
metadata-eval94.1%
Simplified94.1%
Taylor expanded in y around inf 70.7%
*-commutative70.7%
associate-/l*79.1%
Simplified79.1%
if -2.2999999999999998e34 < y < 2.2e116Initial program 87.9%
Taylor expanded in x around 0 87.9%
associate--l+87.9%
+-commutative87.9%
associate-*r/99.8%
+-commutative99.8%
associate--l+99.8%
div-sub99.8%
sub-neg99.8%
*-inverses99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in y around 0 95.3%
sub-neg95.3%
metadata-eval95.3%
distribute-rgt-in95.3%
associate-*l/95.6%
*-lft-identity95.6%
neg-mul-195.6%
unsub-neg95.6%
Simplified95.6%
if 2.2e116 < y Initial program 90.8%
Taylor expanded in y around inf 87.8%
associate-/l*79.7%
associate-/r/87.9%
Simplified87.9%
Final simplification90.1%
(FPCore (x y z) :precision binary64 (if (<= y -1.2e+37) (/ y (/ z x)) (if (<= y 4.8e+16) (- (/ x z) x) (/ (* x y) z))))
double code(double x, double y, double z) {
double tmp;
if (y <= -1.2e+37) {
tmp = y / (z / x);
} else if (y <= 4.8e+16) {
tmp = (x / z) - x;
} else {
tmp = (x * y) / z;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (y <= (-1.2d+37)) then
tmp = y / (z / x)
else if (y <= 4.8d+16) then
tmp = (x / z) - x
else
tmp = (x * y) / z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -1.2e+37) {
tmp = y / (z / x);
} else if (y <= 4.8e+16) {
tmp = (x / z) - x;
} else {
tmp = (x * y) / z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -1.2e+37: tmp = y / (z / x) elif y <= 4.8e+16: tmp = (x / z) - x else: tmp = (x * y) / z return tmp
function code(x, y, z) tmp = 0.0 if (y <= -1.2e+37) tmp = Float64(y / Float64(z / x)); elseif (y <= 4.8e+16) tmp = Float64(Float64(x / z) - x); else tmp = Float64(Float64(x * y) / z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -1.2e+37) tmp = y / (z / x); elseif (y <= 4.8e+16) tmp = (x / z) - x; else tmp = (x * y) / z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -1.2e+37], N[(y / N[(z / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4.8e+16], N[(N[(x / z), $MachinePrecision] - x), $MachinePrecision], N[(N[(x * y), $MachinePrecision] / z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.2 \cdot 10^{+37}:\\
\;\;\;\;\frac{y}{\frac{z}{x}}\\
\mathbf{elif}\;y \leq 4.8 \cdot 10^{+16}:\\
\;\;\;\;\frac{x}{z} - x\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot y}{z}\\
\end{array}
\end{array}
if y < -1.2e37Initial program 81.0%
Taylor expanded in x around 0 81.0%
associate--l+81.0%
+-commutative81.0%
associate-*r/94.1%
+-commutative94.1%
associate--l+94.1%
div-sub94.1%
sub-neg94.1%
*-inverses94.1%
metadata-eval94.1%
Simplified94.1%
Taylor expanded in y around inf 70.7%
*-commutative70.7%
associate-/l*79.1%
Simplified79.1%
if -1.2e37 < y < 4.8e16Initial program 87.3%
Taylor expanded in x around 0 87.3%
associate--l+87.3%
+-commutative87.3%
associate-*r/99.8%
+-commutative99.8%
associate--l+99.8%
div-sub99.8%
sub-neg99.8%
*-inverses99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in y around 0 96.4%
sub-neg96.4%
metadata-eval96.4%
distribute-rgt-in96.4%
associate-*l/96.6%
*-lft-identity96.6%
neg-mul-196.6%
unsub-neg96.6%
Simplified96.6%
if 4.8e16 < y Initial program 92.1%
Taylor expanded in y around inf 87.6%
Final simplification90.4%
(FPCore (x y z) :precision binary64 (if (<= x 35000000000000.0) (- (/ (* x (+ 1.0 y)) z) x) (- (/ x (/ z (+ 1.0 y))) x)))
double code(double x, double y, double z) {
double tmp;
if (x <= 35000000000000.0) {
tmp = ((x * (1.0 + y)) / z) - x;
} else {
tmp = (x / (z / (1.0 + y))) - x;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (x <= 35000000000000.0d0) then
tmp = ((x * (1.0d0 + y)) / z) - x
else
tmp = (x / (z / (1.0d0 + y))) - x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= 35000000000000.0) {
tmp = ((x * (1.0 + y)) / z) - x;
} else {
tmp = (x / (z / (1.0 + y))) - x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= 35000000000000.0: tmp = ((x * (1.0 + y)) / z) - x else: tmp = (x / (z / (1.0 + y))) - x return tmp
function code(x, y, z) tmp = 0.0 if (x <= 35000000000000.0) tmp = Float64(Float64(Float64(x * Float64(1.0 + y)) / z) - x); else tmp = Float64(Float64(x / Float64(z / Float64(1.0 + y))) - x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= 35000000000000.0) tmp = ((x * (1.0 + y)) / z) - x; else tmp = (x / (z / (1.0 + y))) - x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, 35000000000000.0], N[(N[(N[(x * N[(1.0 + y), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision] - x), $MachinePrecision], N[(N[(x / N[(z / N[(1.0 + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 35000000000000:\\
\;\;\;\;\frac{x \cdot \left(1 + y\right)}{z} - x\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{z}{1 + y}} - x\\
\end{array}
\end{array}
if x < 3.5e13Initial program 92.4%
Taylor expanded in z around 0 95.9%
if 3.5e13 < x Initial program 70.1%
Taylor expanded in x around 0 70.1%
associate--l+70.1%
+-commutative70.1%
associate-*r/99.8%
+-commutative99.8%
associate--l+99.8%
div-sub99.8%
sub-neg99.8%
*-inverses99.8%
metadata-eval99.8%
Simplified99.8%
distribute-rgt-in99.8%
neg-mul-199.8%
unsub-neg99.8%
clear-num99.9%
associate-*l/100.0%
*-un-lft-identity100.0%
Applied egg-rr100.0%
Final simplification97.0%
(FPCore (x y z) :precision binary64 (if (<= x 6e-54) (/ (* x (+ 1.0 (- y z))) z) (- (/ x (/ z (+ 1.0 y))) x)))
double code(double x, double y, double z) {
double tmp;
if (x <= 6e-54) {
tmp = (x * (1.0 + (y - z))) / z;
} else {
tmp = (x / (z / (1.0 + y))) - x;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (x <= 6d-54) then
tmp = (x * (1.0d0 + (y - z))) / z
else
tmp = (x / (z / (1.0d0 + y))) - x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= 6e-54) {
tmp = (x * (1.0 + (y - z))) / z;
} else {
tmp = (x / (z / (1.0 + y))) - x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= 6e-54: tmp = (x * (1.0 + (y - z))) / z else: tmp = (x / (z / (1.0 + y))) - x return tmp
function code(x, y, z) tmp = 0.0 if (x <= 6e-54) tmp = Float64(Float64(x * Float64(1.0 + Float64(y - z))) / z); else tmp = Float64(Float64(x / Float64(z / Float64(1.0 + y))) - x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= 6e-54) tmp = (x * (1.0 + (y - z))) / z; else tmp = (x / (z / (1.0 + y))) - x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, 6e-54], N[(N[(x * N[(1.0 + N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], N[(N[(x / N[(z / N[(1.0 + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 6 \cdot 10^{-54}:\\
\;\;\;\;\frac{x \cdot \left(1 + \left(y - z\right)\right)}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{z}{1 + y}} - x\\
\end{array}
\end{array}
if x < 6.00000000000000018e-54Initial program 92.0%
if 6.00000000000000018e-54 < x Initial program 74.0%
Taylor expanded in x around 0 74.0%
associate--l+74.0%
+-commutative74.0%
associate-*r/99.8%
+-commutative99.8%
associate--l+99.8%
div-sub99.8%
sub-neg99.8%
*-inverses99.8%
metadata-eval99.8%
Simplified99.8%
distribute-rgt-in99.8%
neg-mul-199.8%
unsub-neg99.8%
clear-num99.8%
associate-*l/100.0%
*-un-lft-identity100.0%
Applied egg-rr100.0%
Final simplification94.4%
(FPCore (x y z) :precision binary64 (if (or (<= z -0.014) (not (<= z 1.0))) (- x) (/ x z)))
double code(double x, double y, double z) {
double tmp;
if ((z <= -0.014) || !(z <= 1.0)) {
tmp = -x;
} else {
tmp = x / z;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((z <= (-0.014d0)) .or. (.not. (z <= 1.0d0))) then
tmp = -x
else
tmp = x / z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -0.014) || !(z <= 1.0)) {
tmp = -x;
} else {
tmp = x / z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -0.014) or not (z <= 1.0): tmp = -x else: tmp = x / z return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -0.014) || !(z <= 1.0)) tmp = Float64(-x); else tmp = Float64(x / z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -0.014) || ~((z <= 1.0))) tmp = -x; else tmp = x / z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -0.014], N[Not[LessEqual[z, 1.0]], $MachinePrecision]], (-x), N[(x / z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.014 \lor \neg \left(z \leq 1\right):\\
\;\;\;\;-x\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z}\\
\end{array}
\end{array}
if z < -0.0140000000000000003 or 1 < z Initial program 72.1%
Taylor expanded in z around inf 65.6%
mul-1-neg65.6%
Simplified65.6%
if -0.0140000000000000003 < z < 1Initial program 99.9%
Taylor expanded in y around 0 57.8%
Taylor expanded in z around 0 56.8%
Final simplification61.0%
(FPCore (x y z) :precision binary64 (- x))
double code(double x, double y, double z) {
return -x;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = -x
end function
public static double code(double x, double y, double z) {
return -x;
}
def code(x, y, z): return -x
function code(x, y, z) return Float64(-x) end
function tmp = code(x, y, z) tmp = -x; end
code[x_, y_, z_] := (-x)
\begin{array}{l}
\\
-x
\end{array}
Initial program 86.6%
Taylor expanded in z around inf 32.8%
mul-1-neg32.8%
Simplified32.8%
Final simplification32.8%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (- (* (+ 1.0 y) (/ x z)) x)))
(if (< x -2.71483106713436e-162)
t_0
(if (< x 3.874108816439546e-197)
(* (* x (+ (- y z) 1.0)) (/ 1.0 z))
t_0))))
double code(double x, double y, double z) {
double t_0 = ((1.0 + y) * (x / z)) - x;
double tmp;
if (x < -2.71483106713436e-162) {
tmp = t_0;
} else if (x < 3.874108816439546e-197) {
tmp = (x * ((y - z) + 1.0)) * (1.0 / z);
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = ((1.0d0 + y) * (x / z)) - x
if (x < (-2.71483106713436d-162)) then
tmp = t_0
else if (x < 3.874108816439546d-197) then
tmp = (x * ((y - z) + 1.0d0)) * (1.0d0 / z)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = ((1.0 + y) * (x / z)) - x;
double tmp;
if (x < -2.71483106713436e-162) {
tmp = t_0;
} else if (x < 3.874108816439546e-197) {
tmp = (x * ((y - z) + 1.0)) * (1.0 / z);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = ((1.0 + y) * (x / z)) - x tmp = 0 if x < -2.71483106713436e-162: tmp = t_0 elif x < 3.874108816439546e-197: tmp = (x * ((y - z) + 1.0)) * (1.0 / z) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(Float64(Float64(1.0 + y) * Float64(x / z)) - x) tmp = 0.0 if (x < -2.71483106713436e-162) tmp = t_0; elseif (x < 3.874108816439546e-197) tmp = Float64(Float64(x * Float64(Float64(y - z) + 1.0)) * Float64(1.0 / z)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = ((1.0 + y) * (x / z)) - x; tmp = 0.0; if (x < -2.71483106713436e-162) tmp = t_0; elseif (x < 3.874108816439546e-197) tmp = (x * ((y - z) + 1.0)) * (1.0 / z); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(N[(1.0 + y), $MachinePrecision] * N[(x / z), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision]}, If[Less[x, -2.71483106713436e-162], t$95$0, If[Less[x, 3.874108816439546e-197], N[(N[(x * N[(N[(y - z), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] * N[(1.0 / z), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(1 + y\right) \cdot \frac{x}{z} - x\\
\mathbf{if}\;x < -2.71483106713436 \cdot 10^{-162}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x < 3.874108816439546 \cdot 10^{-197}:\\
\;\;\;\;\left(x \cdot \left(\left(y - z\right) + 1\right)\right) \cdot \frac{1}{z}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
herbie shell --seed 2024041
(FPCore (x y z)
:name "Diagrams.TwoD.Segment.Bernstein:evaluateBernstein from diagrams-lib-1.3.0.3"
:precision binary64
:herbie-target
(if (< x -2.71483106713436e-162) (- (* (+ 1.0 y) (/ x z)) x) (if (< x 3.874108816439546e-197) (* (* x (+ (- y z) 1.0)) (/ 1.0 z)) (- (* (+ 1.0 y) (/ x z)) x)))
(/ (* x (+ (- y z) 1.0)) z))