
(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 12 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 -2.4e-16) (not (<= z 2.2e-16))) (* x (+ (/ (+ y 1.0) z) -1.0)) (* (+ y 1.0) (/ x z))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -2.4e-16) || !(z <= 2.2e-16)) {
tmp = x * (((y + 1.0) / z) + -1.0);
} else {
tmp = (y + 1.0) * (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 <= (-2.4d-16)) .or. (.not. (z <= 2.2d-16))) then
tmp = x * (((y + 1.0d0) / z) + (-1.0d0))
else
tmp = (y + 1.0d0) * (x / z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -2.4e-16) || !(z <= 2.2e-16)) {
tmp = x * (((y + 1.0) / z) + -1.0);
} else {
tmp = (y + 1.0) * (x / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -2.4e-16) or not (z <= 2.2e-16): tmp = x * (((y + 1.0) / z) + -1.0) else: tmp = (y + 1.0) * (x / z) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -2.4e-16) || !(z <= 2.2e-16)) tmp = Float64(x * Float64(Float64(Float64(y + 1.0) / z) + -1.0)); else tmp = Float64(Float64(y + 1.0) * Float64(x / z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -2.4e-16) || ~((z <= 2.2e-16))) tmp = x * (((y + 1.0) / z) + -1.0); else tmp = (y + 1.0) * (x / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -2.4e-16], N[Not[LessEqual[z, 2.2e-16]], $MachinePrecision]], N[(x * N[(N[(N[(y + 1.0), $MachinePrecision] / z), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision], N[(N[(y + 1.0), $MachinePrecision] * N[(x / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.4 \cdot 10^{-16} \lor \neg \left(z \leq 2.2 \cdot 10^{-16}\right):\\
\;\;\;\;x \cdot \left(\frac{y + 1}{z} + -1\right)\\
\mathbf{else}:\\
\;\;\;\;\left(y + 1\right) \cdot \frac{x}{z}\\
\end{array}
\end{array}
if z < -2.40000000000000005e-16 or 2.2e-16 < z Initial program 80.4%
associate-/l*99.9%
+-commutative99.9%
associate-+r-99.9%
div-sub99.9%
*-inverses99.9%
sub-neg99.9%
metadata-eval99.9%
+-commutative99.9%
Simplified99.9%
if -2.40000000000000005e-16 < z < 2.2e-16Initial program 99.9%
associate-/l*92.1%
+-commutative92.1%
associate-+r-92.1%
div-sub92.1%
*-inverses92.1%
sub-neg92.1%
metadata-eval92.1%
+-commutative92.1%
Simplified92.1%
Taylor expanded in z around 0 99.9%
+-commutative99.9%
associate-*l/100.0%
+-commutative100.0%
Simplified100.0%
Final simplification99.9%
(FPCore (x y z)
:precision binary64
(if (<= y -1850.0)
(* x (/ y z))
(if (<= y -6.2e-111)
(- x)
(if (<= y 4.9e-100) (/ x z) (if (<= y 1.95e+32) (- x) (* y (/ x z)))))))
double code(double x, double y, double z) {
double tmp;
if (y <= -1850.0) {
tmp = x * (y / z);
} else if (y <= -6.2e-111) {
tmp = -x;
} else if (y <= 4.9e-100) {
tmp = x / z;
} else if (y <= 1.95e+32) {
tmp = -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 <= (-1850.0d0)) then
tmp = x * (y / z)
else if (y <= (-6.2d-111)) then
tmp = -x
else if (y <= 4.9d-100) then
tmp = x / z
else if (y <= 1.95d+32) then
tmp = -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 <= -1850.0) {
tmp = x * (y / z);
} else if (y <= -6.2e-111) {
tmp = -x;
} else if (y <= 4.9e-100) {
tmp = x / z;
} else if (y <= 1.95e+32) {
tmp = -x;
} else {
tmp = y * (x / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -1850.0: tmp = x * (y / z) elif y <= -6.2e-111: tmp = -x elif y <= 4.9e-100: tmp = x / z elif y <= 1.95e+32: tmp = -x else: tmp = y * (x / z) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -1850.0) tmp = Float64(x * Float64(y / z)); elseif (y <= -6.2e-111) tmp = Float64(-x); elseif (y <= 4.9e-100) tmp = Float64(x / z); elseif (y <= 1.95e+32) tmp = Float64(-x); else tmp = Float64(y * Float64(x / z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -1850.0) tmp = x * (y / z); elseif (y <= -6.2e-111) tmp = -x; elseif (y <= 4.9e-100) tmp = x / z; elseif (y <= 1.95e+32) tmp = -x; else tmp = y * (x / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -1850.0], N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -6.2e-111], (-x), If[LessEqual[y, 4.9e-100], N[(x / z), $MachinePrecision], If[LessEqual[y, 1.95e+32], (-x), N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1850:\\
\;\;\;\;x \cdot \frac{y}{z}\\
\mathbf{elif}\;y \leq -6.2 \cdot 10^{-111}:\\
\;\;\;\;-x\\
\mathbf{elif}\;y \leq 4.9 \cdot 10^{-100}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{elif}\;y \leq 1.95 \cdot 10^{+32}:\\
\;\;\;\;-x\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x}{z}\\
\end{array}
\end{array}
if y < -1850Initial program 92.6%
associate-/l*94.0%
+-commutative94.0%
associate-+r-94.0%
div-sub94.0%
*-inverses94.0%
sub-neg94.0%
metadata-eval94.0%
+-commutative94.0%
Simplified94.0%
Taylor expanded in y around inf 81.3%
associate-/l*79.3%
Simplified79.3%
if -1850 < y < -6.20000000000000029e-111 or 4.9000000000000003e-100 < y < 1.95e32Initial program 85.3%
associate-/l*99.9%
+-commutative99.9%
associate-+r-99.9%
div-sub99.9%
*-inverses99.9%
sub-neg99.9%
metadata-eval99.9%
+-commutative99.9%
Simplified99.9%
Taylor expanded in z around inf 66.7%
neg-mul-166.7%
Simplified66.7%
if -6.20000000000000029e-111 < y < 4.9000000000000003e-100Initial program 93.0%
associate-/l*99.8%
+-commutative99.8%
associate-+r-99.8%
div-sub99.8%
*-inverses99.8%
sub-neg99.8%
metadata-eval99.8%
+-commutative99.8%
Simplified99.8%
Taylor expanded in z around 0 66.1%
Taylor expanded in y around 0 66.1%
if 1.95e32 < y Initial program 90.8%
associate-/l*87.3%
+-commutative87.3%
associate-+r-87.3%
div-sub87.3%
*-inverses87.3%
sub-neg87.3%
metadata-eval87.3%
+-commutative87.3%
Simplified87.3%
Taylor expanded in y around inf 81.6%
associate-/l*73.9%
Simplified73.9%
clear-num73.8%
div-inv73.9%
Applied egg-rr73.9%
associate-/r/84.6%
Applied egg-rr84.6%
Final simplification73.3%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* x (/ y z))))
(if (<= y -175.0)
t_0
(if (<= y -5.8e-108)
(- x)
(if (<= y 3e-100) (/ x z) (if (<= y 8.2e+39) (- x) t_0))))))
double code(double x, double y, double z) {
double t_0 = x * (y / z);
double tmp;
if (y <= -175.0) {
tmp = t_0;
} else if (y <= -5.8e-108) {
tmp = -x;
} else if (y <= 3e-100) {
tmp = x / z;
} else if (y <= 8.2e+39) {
tmp = -x;
} 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 = x * (y / z)
if (y <= (-175.0d0)) then
tmp = t_0
else if (y <= (-5.8d-108)) then
tmp = -x
else if (y <= 3d-100) then
tmp = x / z
else if (y <= 8.2d+39) then
tmp = -x
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = x * (y / z);
double tmp;
if (y <= -175.0) {
tmp = t_0;
} else if (y <= -5.8e-108) {
tmp = -x;
} else if (y <= 3e-100) {
tmp = x / z;
} else if (y <= 8.2e+39) {
tmp = -x;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = x * (y / z) tmp = 0 if y <= -175.0: tmp = t_0 elif y <= -5.8e-108: tmp = -x elif y <= 3e-100: tmp = x / z elif y <= 8.2e+39: tmp = -x else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(x * Float64(y / z)) tmp = 0.0 if (y <= -175.0) tmp = t_0; elseif (y <= -5.8e-108) tmp = Float64(-x); elseif (y <= 3e-100) tmp = Float64(x / z); elseif (y <= 8.2e+39) tmp = Float64(-x); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = x * (y / z); tmp = 0.0; if (y <= -175.0) tmp = t_0; elseif (y <= -5.8e-108) tmp = -x; elseif (y <= 3e-100) tmp = x / z; elseif (y <= 8.2e+39) tmp = -x; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -175.0], t$95$0, If[LessEqual[y, -5.8e-108], (-x), If[LessEqual[y, 3e-100], N[(x / z), $MachinePrecision], If[LessEqual[y, 8.2e+39], (-x), t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \frac{y}{z}\\
\mathbf{if}\;y \leq -175:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq -5.8 \cdot 10^{-108}:\\
\;\;\;\;-x\\
\mathbf{elif}\;y \leq 3 \cdot 10^{-100}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{elif}\;y \leq 8.2 \cdot 10^{+39}:\\
\;\;\;\;-x\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -175 or 8.20000000000000008e39 < y Initial program 91.8%
associate-/l*91.0%
+-commutative91.0%
associate-+r-91.0%
div-sub91.0%
*-inverses91.0%
sub-neg91.0%
metadata-eval91.0%
+-commutative91.0%
Simplified91.0%
Taylor expanded in y around inf 81.4%
associate-/l*76.9%
Simplified76.9%
if -175 < y < -5.8000000000000002e-108 or 3.0000000000000001e-100 < y < 8.20000000000000008e39Initial program 85.3%
associate-/l*99.9%
+-commutative99.9%
associate-+r-99.9%
div-sub99.9%
*-inverses99.9%
sub-neg99.9%
metadata-eval99.9%
+-commutative99.9%
Simplified99.9%
Taylor expanded in z around inf 66.7%
neg-mul-166.7%
Simplified66.7%
if -5.8000000000000002e-108 < y < 3.0000000000000001e-100Initial program 93.0%
associate-/l*99.8%
+-commutative99.8%
associate-+r-99.8%
div-sub99.8%
*-inverses99.8%
sub-neg99.8%
metadata-eval99.8%
+-commutative99.8%
Simplified99.8%
Taylor expanded in z around 0 66.1%
Taylor expanded in y around 0 66.1%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* x (+ -1.0 (/ y z)))))
(if (<= y -80.0)
t_0
(if (<= y 7e-8) (- (/ x z) x) (if (<= y 4.3e+195) t_0 (/ y (/ z x)))))))
double code(double x, double y, double z) {
double t_0 = x * (-1.0 + (y / z));
double tmp;
if (y <= -80.0) {
tmp = t_0;
} else if (y <= 7e-8) {
tmp = (x / z) - x;
} else if (y <= 4.3e+195) {
tmp = t_0;
} else {
tmp = y / (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) :: t_0
real(8) :: tmp
t_0 = x * ((-1.0d0) + (y / z))
if (y <= (-80.0d0)) then
tmp = t_0
else if (y <= 7d-8) then
tmp = (x / z) - x
else if (y <= 4.3d+195) then
tmp = t_0
else
tmp = y / (z / x)
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 <= -80.0) {
tmp = t_0;
} else if (y <= 7e-8) {
tmp = (x / z) - x;
} else if (y <= 4.3e+195) {
tmp = t_0;
} else {
tmp = y / (z / x);
}
return tmp;
}
def code(x, y, z): t_0 = x * (-1.0 + (y / z)) tmp = 0 if y <= -80.0: tmp = t_0 elif y <= 7e-8: tmp = (x / z) - x elif y <= 4.3e+195: tmp = t_0 else: tmp = y / (z / x) return tmp
function code(x, y, z) t_0 = Float64(x * Float64(-1.0 + Float64(y / z))) tmp = 0.0 if (y <= -80.0) tmp = t_0; elseif (y <= 7e-8) tmp = Float64(Float64(x / z) - x); elseif (y <= 4.3e+195) tmp = t_0; else tmp = Float64(y / Float64(z / x)); end return tmp end
function tmp_2 = code(x, y, z) t_0 = x * (-1.0 + (y / z)); tmp = 0.0; if (y <= -80.0) tmp = t_0; elseif (y <= 7e-8) tmp = (x / z) - x; elseif (y <= 4.3e+195) tmp = t_0; else tmp = y / (z / x); 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, -80.0], t$95$0, If[LessEqual[y, 7e-8], N[(N[(x / z), $MachinePrecision] - x), $MachinePrecision], If[LessEqual[y, 4.3e+195], t$95$0, N[(y / N[(z / x), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \left(-1 + \frac{y}{z}\right)\\
\mathbf{if}\;y \leq -80:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 7 \cdot 10^{-8}:\\
\;\;\;\;\frac{x}{z} - x\\
\mathbf{elif}\;y \leq 4.3 \cdot 10^{+195}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{\frac{z}{x}}\\
\end{array}
\end{array}
if y < -80 or 7.00000000000000048e-8 < y < 4.29999999999999981e195Initial program 90.8%
associate-/l*95.3%
+-commutative95.3%
associate-+r-95.3%
div-sub95.3%
*-inverses95.3%
sub-neg95.3%
metadata-eval95.3%
+-commutative95.3%
Simplified95.3%
Taylor expanded in y around inf 94.1%
if -80 < y < 7.00000000000000048e-8Initial program 89.7%
associate-/l*99.8%
+-commutative99.8%
associate-+r-99.8%
div-sub99.8%
*-inverses99.8%
sub-neg99.8%
metadata-eval99.8%
+-commutative99.8%
Simplified99.8%
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 4.29999999999999981e195 < y Initial program 95.8%
associate-/l*75.6%
+-commutative75.6%
associate-+r-75.6%
div-sub75.6%
*-inverses75.6%
sub-neg75.6%
metadata-eval75.6%
+-commutative75.6%
Simplified75.6%
Taylor expanded in y around inf 95.8%
associate-/l*75.6%
Simplified75.6%
*-commutative75.6%
div-inv75.6%
associate-*l*95.6%
associate-/r/95.6%
un-div-inv95.8%
Applied egg-rr95.8%
Final simplification96.9%
(FPCore (x y z) :precision binary64 (if (or (<= z -0.92) (not (<= z 1.0))) (* x (+ -1.0 (/ y z))) (* (+ y 1.0) (/ x z))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -0.92) || !(z <= 1.0)) {
tmp = x * (-1.0 + (y / z));
} else {
tmp = (y + 1.0) * (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.92d0)) .or. (.not. (z <= 1.0d0))) then
tmp = x * ((-1.0d0) + (y / z))
else
tmp = (y + 1.0d0) * (x / z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -0.92) || !(z <= 1.0)) {
tmp = x * (-1.0 + (y / z));
} else {
tmp = (y + 1.0) * (x / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -0.92) or not (z <= 1.0): tmp = x * (-1.0 + (y / z)) else: tmp = (y + 1.0) * (x / z) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -0.92) || !(z <= 1.0)) tmp = Float64(x * Float64(-1.0 + Float64(y / z))); else tmp = Float64(Float64(y + 1.0) * Float64(x / z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -0.92) || ~((z <= 1.0))) tmp = x * (-1.0 + (y / z)); else tmp = (y + 1.0) * (x / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -0.92], N[Not[LessEqual[z, 1.0]], $MachinePrecision]], N[(x * N[(-1.0 + N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y + 1.0), $MachinePrecision] * N[(x / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.92 \lor \neg \left(z \leq 1\right):\\
\;\;\;\;x \cdot \left(-1 + \frac{y}{z}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(y + 1\right) \cdot \frac{x}{z}\\
\end{array}
\end{array}
if z < -0.92000000000000004 or 1 < z Initial program 79.6%
associate-/l*99.9%
+-commutative99.9%
associate-+r-99.9%
div-sub99.9%
*-inverses99.9%
sub-neg99.9%
metadata-eval99.9%
+-commutative99.9%
Simplified99.9%
Taylor expanded in y around inf 98.9%
if -0.92000000000000004 < z < 1Initial program 99.9%
associate-/l*92.4%
+-commutative92.4%
associate-+r-92.4%
div-sub92.4%
*-inverses92.4%
sub-neg92.4%
metadata-eval92.4%
+-commutative92.4%
Simplified92.4%
Taylor expanded in z around 0 99.4%
+-commutative99.4%
associate-*l/99.4%
+-commutative99.4%
Simplified99.4%
Final simplification99.2%
(FPCore (x y z) :precision binary64 (if (<= y -6600.0) (/ (* x y) z) (if (<= y 3.5e+43) (- (/ x z) x) (* y (/ x z)))))
double code(double x, double y, double z) {
double tmp;
if (y <= -6600.0) {
tmp = (x * y) / z;
} else if (y <= 3.5e+43) {
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 <= (-6600.0d0)) then
tmp = (x * y) / z
else if (y <= 3.5d+43) 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 <= -6600.0) {
tmp = (x * y) / z;
} else if (y <= 3.5e+43) {
tmp = (x / z) - x;
} else {
tmp = y * (x / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -6600.0: tmp = (x * y) / z elif y <= 3.5e+43: tmp = (x / z) - x else: tmp = y * (x / z) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -6600.0) tmp = Float64(Float64(x * y) / z); elseif (y <= 3.5e+43) 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 <= -6600.0) tmp = (x * y) / z; elseif (y <= 3.5e+43) tmp = (x / z) - x; else tmp = y * (x / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -6600.0], N[(N[(x * y), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[y, 3.5e+43], N[(N[(x / z), $MachinePrecision] - x), $MachinePrecision], N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -6600:\\
\;\;\;\;\frac{x \cdot y}{z}\\
\mathbf{elif}\;y \leq 3.5 \cdot 10^{+43}:\\
\;\;\;\;\frac{x}{z} - x\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x}{z}\\
\end{array}
\end{array}
if y < -6600Initial program 92.6%
associate-/l*94.0%
+-commutative94.0%
associate-+r-94.0%
div-sub94.0%
*-inverses94.0%
sub-neg94.0%
metadata-eval94.0%
+-commutative94.0%
Simplified94.0%
Taylor expanded in y around inf 81.3%
if -6600 < y < 3.5000000000000001e43Initial program 89.8%
associate-/l*99.8%
+-commutative99.8%
associate-+r-99.8%
div-sub99.8%
*-inverses99.8%
sub-neg99.8%
metadata-eval99.8%
+-commutative99.8%
Simplified99.8%
Taylor expanded in y around 0 99.2%
sub-neg99.2%
metadata-eval99.2%
distribute-rgt-in99.2%
associate-*l/99.3%
*-lft-identity99.3%
neg-mul-199.3%
unsub-neg99.3%
Simplified99.3%
if 3.5000000000000001e43 < y Initial program 90.8%
associate-/l*87.3%
+-commutative87.3%
associate-+r-87.3%
div-sub87.3%
*-inverses87.3%
sub-neg87.3%
metadata-eval87.3%
+-commutative87.3%
Simplified87.3%
Taylor expanded in y around inf 81.6%
associate-/l*73.9%
Simplified73.9%
clear-num73.8%
div-inv73.9%
Applied egg-rr73.9%
associate-/r/84.6%
Applied egg-rr84.6%
Final simplification91.7%
(FPCore (x y z) :precision binary64 (if (<= y -3700.0) (/ x (/ z y)) (if (<= y 7e+34) (- (/ x z) x) (* y (/ x z)))))
double code(double x, double y, double z) {
double tmp;
if (y <= -3700.0) {
tmp = x / (z / y);
} else if (y <= 7e+34) {
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 <= (-3700.0d0)) then
tmp = x / (z / y)
else if (y <= 7d+34) 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 <= -3700.0) {
tmp = x / (z / y);
} else if (y <= 7e+34) {
tmp = (x / z) - x;
} else {
tmp = y * (x / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -3700.0: tmp = x / (z / y) elif y <= 7e+34: tmp = (x / z) - x else: tmp = y * (x / z) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -3700.0) tmp = Float64(x / Float64(z / y)); elseif (y <= 7e+34) 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 <= -3700.0) tmp = x / (z / y); elseif (y <= 7e+34) tmp = (x / z) - x; else tmp = y * (x / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -3700.0], N[(x / N[(z / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 7e+34], N[(N[(x / z), $MachinePrecision] - x), $MachinePrecision], N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3700:\\
\;\;\;\;\frac{x}{\frac{z}{y}}\\
\mathbf{elif}\;y \leq 7 \cdot 10^{+34}:\\
\;\;\;\;\frac{x}{z} - x\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x}{z}\\
\end{array}
\end{array}
if y < -3700Initial program 92.6%
associate-/l*94.0%
+-commutative94.0%
associate-+r-94.0%
div-sub94.0%
*-inverses94.0%
sub-neg94.0%
metadata-eval94.0%
+-commutative94.0%
Simplified94.0%
Taylor expanded in y around inf 81.3%
associate-/l*79.3%
Simplified79.3%
clear-num79.3%
div-inv79.3%
Applied egg-rr79.3%
if -3700 < y < 6.99999999999999996e34Initial program 89.8%
associate-/l*99.8%
+-commutative99.8%
associate-+r-99.8%
div-sub99.8%
*-inverses99.8%
sub-neg99.8%
metadata-eval99.8%
+-commutative99.8%
Simplified99.8%
Taylor expanded in y around 0 99.2%
sub-neg99.2%
metadata-eval99.2%
distribute-rgt-in99.2%
associate-*l/99.3%
*-lft-identity99.3%
neg-mul-199.3%
unsub-neg99.3%
Simplified99.3%
if 6.99999999999999996e34 < y Initial program 90.8%
associate-/l*87.3%
+-commutative87.3%
associate-+r-87.3%
div-sub87.3%
*-inverses87.3%
sub-neg87.3%
metadata-eval87.3%
+-commutative87.3%
Simplified87.3%
Taylor expanded in y around inf 81.6%
associate-/l*73.9%
Simplified73.9%
clear-num73.8%
div-inv73.9%
Applied egg-rr73.9%
associate-/r/84.6%
Applied egg-rr84.6%
Final simplification91.3%
(FPCore (x y z) :precision binary64 (if (<= y -6600.0) (* x (/ y z)) (if (<= y 7.4e+37) (- (/ x z) x) (* y (/ x z)))))
double code(double x, double y, double z) {
double tmp;
if (y <= -6600.0) {
tmp = x * (y / z);
} else if (y <= 7.4e+37) {
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 <= (-6600.0d0)) then
tmp = x * (y / z)
else if (y <= 7.4d+37) 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 <= -6600.0) {
tmp = x * (y / z);
} else if (y <= 7.4e+37) {
tmp = (x / z) - x;
} else {
tmp = y * (x / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -6600.0: tmp = x * (y / z) elif y <= 7.4e+37: tmp = (x / z) - x else: tmp = y * (x / z) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -6600.0) tmp = Float64(x * Float64(y / z)); elseif (y <= 7.4e+37) 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 <= -6600.0) tmp = x * (y / z); elseif (y <= 7.4e+37) tmp = (x / z) - x; else tmp = y * (x / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -6600.0], N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 7.4e+37], N[(N[(x / z), $MachinePrecision] - x), $MachinePrecision], N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -6600:\\
\;\;\;\;x \cdot \frac{y}{z}\\
\mathbf{elif}\;y \leq 7.4 \cdot 10^{+37}:\\
\;\;\;\;\frac{x}{z} - x\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x}{z}\\
\end{array}
\end{array}
if y < -6600Initial program 92.6%
associate-/l*94.0%
+-commutative94.0%
associate-+r-94.0%
div-sub94.0%
*-inverses94.0%
sub-neg94.0%
metadata-eval94.0%
+-commutative94.0%
Simplified94.0%
Taylor expanded in y around inf 81.3%
associate-/l*79.3%
Simplified79.3%
if -6600 < y < 7.3999999999999999e37Initial program 89.8%
associate-/l*99.8%
+-commutative99.8%
associate-+r-99.8%
div-sub99.8%
*-inverses99.8%
sub-neg99.8%
metadata-eval99.8%
+-commutative99.8%
Simplified99.8%
Taylor expanded in y around 0 99.2%
sub-neg99.2%
metadata-eval99.2%
distribute-rgt-in99.2%
associate-*l/99.3%
*-lft-identity99.3%
neg-mul-199.3%
unsub-neg99.3%
Simplified99.3%
if 7.3999999999999999e37 < y Initial program 90.8%
associate-/l*87.3%
+-commutative87.3%
associate-+r-87.3%
div-sub87.3%
*-inverses87.3%
sub-neg87.3%
metadata-eval87.3%
+-commutative87.3%
Simplified87.3%
Taylor expanded in y around inf 81.6%
associate-/l*73.9%
Simplified73.9%
clear-num73.8%
div-inv73.9%
Applied egg-rr73.9%
associate-/r/84.6%
Applied egg-rr84.6%
Final simplification91.2%
(FPCore (x y z) :precision binary64 (if (<= x 1.2e-73) (/ (* x (+ (- y z) 1.0)) z) (- (/ x (/ z (+ y 1.0))) x)))
double code(double x, double y, double z) {
double tmp;
if (x <= 1.2e-73) {
tmp = (x * ((y - z) + 1.0)) / z;
} else {
tmp = (x / (z / (y + 1.0))) - 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 <= 1.2d-73) then
tmp = (x * ((y - z) + 1.0d0)) / z
else
tmp = (x / (z / (y + 1.0d0))) - x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= 1.2e-73) {
tmp = (x * ((y - z) + 1.0)) / z;
} else {
tmp = (x / (z / (y + 1.0))) - x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= 1.2e-73: tmp = (x * ((y - z) + 1.0)) / z else: tmp = (x / (z / (y + 1.0))) - x return tmp
function code(x, y, z) tmp = 0.0 if (x <= 1.2e-73) tmp = Float64(Float64(x * Float64(Float64(y - z) + 1.0)) / z); else tmp = Float64(Float64(x / Float64(z / Float64(y + 1.0))) - x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= 1.2e-73) tmp = (x * ((y - z) + 1.0)) / z; else tmp = (x / (z / (y + 1.0))) - x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, 1.2e-73], N[(N[(x * N[(N[(y - z), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], N[(N[(x / N[(z / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.2 \cdot 10^{-73}:\\
\;\;\;\;\frac{x \cdot \left(\left(y - z\right) + 1\right)}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{z}{y + 1}} - x\\
\end{array}
\end{array}
if x < 1.20000000000000003e-73Initial program 94.7%
if 1.20000000000000003e-73 < x Initial program 80.9%
associate-/l*99.9%
+-commutative99.9%
associate-+r-99.9%
div-sub99.9%
*-inverses99.9%
sub-neg99.9%
metadata-eval99.9%
+-commutative99.9%
Simplified99.9%
distribute-lft-in99.9%
clear-num99.8%
un-div-inv99.9%
*-commutative99.9%
mul-1-neg99.9%
Applied egg-rr99.9%
Final simplification96.2%
(FPCore (x y z) :precision binary64 (if (<= x 2e+30) (/ (* x (+ (- y z) 1.0)) z) (* x (+ (/ (+ y 1.0) z) -1.0))))
double code(double x, double y, double z) {
double tmp;
if (x <= 2e+30) {
tmp = (x * ((y - z) + 1.0)) / z;
} else {
tmp = x * (((y + 1.0) / z) + -1.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) :: tmp
if (x <= 2d+30) then
tmp = (x * ((y - z) + 1.0d0)) / z
else
tmp = x * (((y + 1.0d0) / z) + (-1.0d0))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= 2e+30) {
tmp = (x * ((y - z) + 1.0)) / z;
} else {
tmp = x * (((y + 1.0) / z) + -1.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= 2e+30: tmp = (x * ((y - z) + 1.0)) / z else: tmp = x * (((y + 1.0) / z) + -1.0) return tmp
function code(x, y, z) tmp = 0.0 if (x <= 2e+30) tmp = Float64(Float64(x * Float64(Float64(y - z) + 1.0)) / z); else tmp = Float64(x * Float64(Float64(Float64(y + 1.0) / z) + -1.0)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= 2e+30) tmp = (x * ((y - z) + 1.0)) / z; else tmp = x * (((y + 1.0) / z) + -1.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, 2e+30], N[(N[(x * N[(N[(y - z), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], N[(x * N[(N[(N[(y + 1.0), $MachinePrecision] / z), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2 \cdot 10^{+30}:\\
\;\;\;\;\frac{x \cdot \left(\left(y - z\right) + 1\right)}{z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(\frac{y + 1}{z} + -1\right)\\
\end{array}
\end{array}
if x < 2e30Initial program 95.1%
if 2e30 < x Initial program 74.8%
associate-/l*99.9%
+-commutative99.9%
associate-+r-99.9%
div-sub99.9%
*-inverses99.9%
sub-neg99.9%
metadata-eval99.9%
+-commutative99.9%
Simplified99.9%
(FPCore (x y z) :precision binary64 (if (or (<= z -5.4e-18) (not (<= z 1.0))) (- x) (/ x z)))
double code(double x, double y, double z) {
double tmp;
if ((z <= -5.4e-18) || !(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 <= (-5.4d-18)) .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 <= -5.4e-18) || !(z <= 1.0)) {
tmp = -x;
} else {
tmp = x / z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -5.4e-18) or not (z <= 1.0): tmp = -x else: tmp = x / z return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -5.4e-18) || !(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 <= -5.4e-18) || ~((z <= 1.0))) tmp = -x; else tmp = x / z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -5.4e-18], N[Not[LessEqual[z, 1.0]], $MachinePrecision]], (-x), N[(x / z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.4 \cdot 10^{-18} \lor \neg \left(z \leq 1\right):\\
\;\;\;\;-x\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z}\\
\end{array}
\end{array}
if z < -5.39999999999999977e-18 or 1 < z Initial program 79.7%
associate-/l*99.9%
+-commutative99.9%
associate-+r-99.9%
div-sub99.9%
*-inverses99.9%
sub-neg99.9%
metadata-eval99.9%
+-commutative99.9%
Simplified99.9%
Taylor expanded in z around inf 70.2%
neg-mul-170.2%
Simplified70.2%
if -5.39999999999999977e-18 < z < 1Initial program 99.9%
associate-/l*92.3%
+-commutative92.3%
associate-+r-92.3%
div-sub92.3%
*-inverses92.3%
sub-neg92.3%
metadata-eval92.3%
+-commutative92.3%
Simplified92.3%
Taylor expanded in z around 0 99.4%
Taylor expanded in y around 0 55.2%
Final simplification62.1%
(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 90.7%
associate-/l*95.8%
+-commutative95.8%
associate-+r-95.8%
div-sub95.8%
*-inverses95.8%
sub-neg95.8%
metadata-eval95.8%
+-commutative95.8%
Simplified95.8%
Taylor expanded in z around inf 33.6%
neg-mul-133.6%
Simplified33.6%
(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 2024098
(FPCore (x y z)
:name "Diagrams.TwoD.Segment.Bernstein:evaluateBernstein from diagrams-lib-1.3.0.3"
:precision binary64
:alt
(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))