
(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.15e-11) (not (<= z 2e-43))) (* x (/ (+ (- y z) 1.0) z)) (* (+ y 1.0) (/ x z))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -2.15e-11) || !(z <= 2e-43)) {
tmp = x * (((y - z) + 1.0) / 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 <= (-2.15d-11)) .or. (.not. (z <= 2d-43))) then
tmp = x * (((y - z) + 1.0d0) / 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 <= -2.15e-11) || !(z <= 2e-43)) {
tmp = x * (((y - z) + 1.0) / z);
} else {
tmp = (y + 1.0) * (x / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -2.15e-11) or not (z <= 2e-43): tmp = x * (((y - z) + 1.0) / z) else: tmp = (y + 1.0) * (x / z) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -2.15e-11) || !(z <= 2e-43)) tmp = Float64(x * Float64(Float64(Float64(y - z) + 1.0) / 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 <= -2.15e-11) || ~((z <= 2e-43))) tmp = x * (((y - z) + 1.0) / z); else tmp = (y + 1.0) * (x / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -2.15e-11], N[Not[LessEqual[z, 2e-43]], $MachinePrecision]], N[(x * N[(N[(N[(y - z), $MachinePrecision] + 1.0), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], N[(N[(y + 1.0), $MachinePrecision] * N[(x / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.15 \cdot 10^{-11} \lor \neg \left(z \leq 2 \cdot 10^{-43}\right):\\
\;\;\;\;x \cdot \frac{\left(y - z\right) + 1}{z}\\
\mathbf{else}:\\
\;\;\;\;\left(y + 1\right) \cdot \frac{x}{z}\\
\end{array}
\end{array}
if z < -2.15000000000000001e-11 or 2.00000000000000015e-43 < z Initial program 73.6%
associate-/l*99.9%
Simplified99.9%
if -2.15000000000000001e-11 < z < 2.00000000000000015e-43Initial program 99.9%
associate-/l*93.5%
Simplified93.5%
Taylor expanded in z around 0 99.9%
associate-/l*93.5%
Simplified93.5%
Taylor expanded in x around 0 99.9%
*-commutative99.9%
associate-*r/99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y z) :precision binary64 (if (<= x 5e-64) (/ (fma x (- y z) x) z) (* x (/ (+ (- y z) 1.0) z))))
double code(double x, double y, double z) {
double tmp;
if (x <= 5e-64) {
tmp = fma(x, (y - z), x) / z;
} else {
tmp = x * (((y - z) + 1.0) / z);
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (x <= 5e-64) tmp = Float64(fma(x, Float64(y - z), x) / z); else tmp = Float64(x * Float64(Float64(Float64(y - z) + 1.0) / z)); end return tmp end
code[x_, y_, z_] := If[LessEqual[x, 5e-64], N[(N[(x * N[(y - z), $MachinePrecision] + x), $MachinePrecision] / z), $MachinePrecision], N[(x * N[(N[(N[(y - z), $MachinePrecision] + 1.0), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 5 \cdot 10^{-64}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x, y - z, x\right)}{z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{\left(y - z\right) + 1}{z}\\
\end{array}
\end{array}
if x < 5.00000000000000033e-64Initial program 90.3%
distribute-lft-in90.4%
fma-define90.3%
*-rgt-identity90.3%
Simplified90.3%
if 5.00000000000000033e-64 < x Initial program 81.1%
associate-/l*99.8%
Simplified99.8%
Final simplification93.3%
(FPCore (x y z)
:precision binary64
(if (<= z -1.66e-22)
(- x)
(if (<= z -2.8e-147)
(/ x z)
(if (<= z -2.5e-231) (* x (/ y z)) (if (<= z 1.0) (/ x z) (- x))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -1.66e-22) {
tmp = -x;
} else if (z <= -2.8e-147) {
tmp = x / z;
} else if (z <= -2.5e-231) {
tmp = x * (y / z);
} else if (z <= 1.0) {
tmp = x / z;
} 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) :: tmp
if (z <= (-1.66d-22)) then
tmp = -x
else if (z <= (-2.8d-147)) then
tmp = x / z
else if (z <= (-2.5d-231)) then
tmp = x * (y / z)
else if (z <= 1.0d0) then
tmp = x / z
else
tmp = -x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -1.66e-22) {
tmp = -x;
} else if (z <= -2.8e-147) {
tmp = x / z;
} else if (z <= -2.5e-231) {
tmp = x * (y / z);
} else if (z <= 1.0) {
tmp = x / z;
} else {
tmp = -x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1.66e-22: tmp = -x elif z <= -2.8e-147: tmp = x / z elif z <= -2.5e-231: tmp = x * (y / z) elif z <= 1.0: tmp = x / z else: tmp = -x return tmp
function code(x, y, z) tmp = 0.0 if (z <= -1.66e-22) tmp = Float64(-x); elseif (z <= -2.8e-147) tmp = Float64(x / z); elseif (z <= -2.5e-231) tmp = Float64(x * Float64(y / z)); elseif (z <= 1.0) tmp = Float64(x / z); else tmp = Float64(-x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -1.66e-22) tmp = -x; elseif (z <= -2.8e-147) tmp = x / z; elseif (z <= -2.5e-231) tmp = x * (y / z); elseif (z <= 1.0) tmp = x / z; else tmp = -x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -1.66e-22], (-x), If[LessEqual[z, -2.8e-147], N[(x / z), $MachinePrecision], If[LessEqual[z, -2.5e-231], N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.0], N[(x / z), $MachinePrecision], (-x)]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.66 \cdot 10^{-22}:\\
\;\;\;\;-x\\
\mathbf{elif}\;z \leq -2.8 \cdot 10^{-147}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{elif}\;z \leq -2.5 \cdot 10^{-231}:\\
\;\;\;\;x \cdot \frac{y}{z}\\
\mathbf{elif}\;z \leq 1:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;-x\\
\end{array}
\end{array}
if z < -1.65999999999999997e-22 or 1 < z Initial program 72.8%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in z around inf 80.9%
mul-1-neg80.9%
Simplified80.9%
if -1.65999999999999997e-22 < z < -2.8e-147 or -2.50000000000000012e-231 < z < 1Initial program 99.9%
associate-/l*92.5%
Simplified92.5%
Taylor expanded in y around 0 62.9%
associate-/l*62.7%
Simplified62.7%
Taylor expanded in z around 0 61.6%
if -2.8e-147 < z < -2.50000000000000012e-231Initial program 99.9%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in y around inf 69.5%
associate-/l*69.4%
Simplified69.4%
Final simplification71.1%
(FPCore (x y z) :precision binary64 (if (<= z -1.6e+51) (- x) (if (<= z 6.9e-130) (* y (/ x z)) (if (<= z 1.0) (/ x z) (- x)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -1.6e+51) {
tmp = -x;
} else if (z <= 6.9e-130) {
tmp = y * (x / z);
} else if (z <= 1.0) {
tmp = x / z;
} 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) :: tmp
if (z <= (-1.6d+51)) then
tmp = -x
else if (z <= 6.9d-130) then
tmp = y * (x / z)
else if (z <= 1.0d0) then
tmp = x / z
else
tmp = -x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -1.6e+51) {
tmp = -x;
} else if (z <= 6.9e-130) {
tmp = y * (x / z);
} else if (z <= 1.0) {
tmp = x / z;
} else {
tmp = -x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1.6e+51: tmp = -x elif z <= 6.9e-130: tmp = y * (x / z) elif z <= 1.0: tmp = x / z else: tmp = -x return tmp
function code(x, y, z) tmp = 0.0 if (z <= -1.6e+51) tmp = Float64(-x); elseif (z <= 6.9e-130) tmp = Float64(y * Float64(x / z)); elseif (z <= 1.0) tmp = Float64(x / z); else tmp = Float64(-x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -1.6e+51) tmp = -x; elseif (z <= 6.9e-130) tmp = y * (x / z); elseif (z <= 1.0) tmp = x / z; else tmp = -x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -1.6e+51], (-x), If[LessEqual[z, 6.9e-130], N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.0], N[(x / z), $MachinePrecision], (-x)]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.6 \cdot 10^{+51}:\\
\;\;\;\;-x\\
\mathbf{elif}\;z \leq 6.9 \cdot 10^{-130}:\\
\;\;\;\;y \cdot \frac{x}{z}\\
\mathbf{elif}\;z \leq 1:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;-x\\
\end{array}
\end{array}
if z < -1.6000000000000001e51 or 1 < z Initial program 70.8%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in z around inf 86.5%
mul-1-neg86.5%
Simplified86.5%
if -1.6000000000000001e51 < z < 6.90000000000000035e-130Initial program 99.1%
associate-/l*93.8%
Simplified93.8%
Taylor expanded in y around inf 57.1%
*-commutative57.1%
associate-*r/62.4%
Simplified62.4%
if 6.90000000000000035e-130 < z < 1Initial program 99.8%
associate-/l*95.9%
Simplified95.9%
Taylor expanded in y around 0 71.5%
associate-/l*71.4%
Simplified71.4%
Taylor expanded in z around 0 65.4%
Final simplification72.7%
(FPCore (x y z) :precision binary64 (if (<= z -1.1e+52) (- x) (if (<= z 6.2e-10) (* x (/ (+ y 1.0) z)) (- (/ x z) x))))
double code(double x, double y, double z) {
double tmp;
if (z <= -1.1e+52) {
tmp = -x;
} else if (z <= 6.2e-10) {
tmp = x * ((y + 1.0) / 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 (z <= (-1.1d+52)) then
tmp = -x
else if (z <= 6.2d-10) then
tmp = x * ((y + 1.0d0) / 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 (z <= -1.1e+52) {
tmp = -x;
} else if (z <= 6.2e-10) {
tmp = x * ((y + 1.0) / z);
} else {
tmp = (x / z) - x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1.1e+52: tmp = -x elif z <= 6.2e-10: tmp = x * ((y + 1.0) / z) else: tmp = (x / z) - x return tmp
function code(x, y, z) tmp = 0.0 if (z <= -1.1e+52) tmp = Float64(-x); elseif (z <= 6.2e-10) tmp = Float64(x * Float64(Float64(y + 1.0) / z)); else tmp = Float64(Float64(x / z) - x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -1.1e+52) tmp = -x; elseif (z <= 6.2e-10) tmp = x * ((y + 1.0) / z); else tmp = (x / z) - x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -1.1e+52], (-x), If[LessEqual[z, 6.2e-10], N[(x * N[(N[(y + 1.0), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], N[(N[(x / z), $MachinePrecision] - x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.1 \cdot 10^{+52}:\\
\;\;\;\;-x\\
\mathbf{elif}\;z \leq 6.2 \cdot 10^{-10}:\\
\;\;\;\;x \cdot \frac{y + 1}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z} - x\\
\end{array}
\end{array}
if z < -1.1e52Initial program 63.8%
associate-/l*100.0%
Simplified100.0%
Taylor expanded in z around inf 90.9%
mul-1-neg90.9%
Simplified90.9%
if -1.1e52 < z < 6.2000000000000003e-10Initial program 99.2%
associate-/l*94.0%
Simplified94.0%
Taylor expanded in z around 0 96.2%
associate-/l*90.9%
Simplified90.9%
if 6.2000000000000003e-10 < z Initial program 76.9%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in x around 0 76.9%
associate--l+76.9%
+-commutative76.9%
associate-*l/83.9%
+-commutative83.9%
Simplified83.9%
Taylor expanded in y around 0 64.9%
associate-/l*85.4%
div-sub85.4%
*-rgt-identity85.4%
associate-*r/85.2%
rgt-mult-inverse85.4%
sub-neg85.4%
metadata-eval85.4%
distribute-rgt-in85.4%
associate-*l/85.4%
*-lft-identity85.4%
neg-mul-185.4%
unsub-neg85.4%
Simplified85.4%
Final simplification89.5%
(FPCore (x y z) :precision binary64 (if (<= z -6.4e+62) (- x) (if (<= z 6.2e-10) (* (+ y 1.0) (/ x z)) (- (/ x z) x))))
double code(double x, double y, double z) {
double tmp;
if (z <= -6.4e+62) {
tmp = -x;
} else if (z <= 6.2e-10) {
tmp = (y + 1.0) * (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 (z <= (-6.4d+62)) then
tmp = -x
else if (z <= 6.2d-10) then
tmp = (y + 1.0d0) * (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 (z <= -6.4e+62) {
tmp = -x;
} else if (z <= 6.2e-10) {
tmp = (y + 1.0) * (x / z);
} else {
tmp = (x / z) - x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -6.4e+62: tmp = -x elif z <= 6.2e-10: tmp = (y + 1.0) * (x / z) else: tmp = (x / z) - x return tmp
function code(x, y, z) tmp = 0.0 if (z <= -6.4e+62) tmp = Float64(-x); elseif (z <= 6.2e-10) tmp = Float64(Float64(y + 1.0) * 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 (z <= -6.4e+62) tmp = -x; elseif (z <= 6.2e-10) tmp = (y + 1.0) * (x / z); else tmp = (x / z) - x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -6.4e+62], (-x), If[LessEqual[z, 6.2e-10], N[(N[(y + 1.0), $MachinePrecision] * N[(x / z), $MachinePrecision]), $MachinePrecision], N[(N[(x / z), $MachinePrecision] - x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.4 \cdot 10^{+62}:\\
\;\;\;\;-x\\
\mathbf{elif}\;z \leq 6.2 \cdot 10^{-10}:\\
\;\;\;\;\left(y + 1\right) \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z} - x\\
\end{array}
\end{array}
if z < -6.39999999999999968e62Initial program 63.8%
associate-/l*100.0%
Simplified100.0%
Taylor expanded in z around inf 90.9%
mul-1-neg90.9%
Simplified90.9%
if -6.39999999999999968e62 < z < 6.2000000000000003e-10Initial program 99.2%
associate-/l*94.0%
Simplified94.0%
Taylor expanded in z around 0 96.2%
associate-/l*90.9%
Simplified90.9%
Taylor expanded in x around 0 96.2%
*-commutative96.2%
associate-*r/96.9%
Simplified96.9%
if 6.2000000000000003e-10 < z Initial program 76.9%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in x around 0 76.9%
associate--l+76.9%
+-commutative76.9%
associate-*l/83.9%
+-commutative83.9%
Simplified83.9%
Taylor expanded in y around 0 64.9%
associate-/l*85.4%
div-sub85.4%
*-rgt-identity85.4%
associate-*r/85.2%
rgt-mult-inverse85.4%
sub-neg85.4%
metadata-eval85.4%
distribute-rgt-in85.4%
associate-*l/85.4%
*-lft-identity85.4%
neg-mul-185.4%
unsub-neg85.4%
Simplified85.4%
Final simplification92.9%
(FPCore (x y z) :precision binary64 (if (or (<= y -3.8e+37) (not (<= y 4.6e+145))) (* y (/ x z)) (- (/ x z) x)))
double code(double x, double y, double z) {
double tmp;
if ((y <= -3.8e+37) || !(y <= 4.6e+145)) {
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 <= (-3.8d+37)) .or. (.not. (y <= 4.6d+145))) 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 <= -3.8e+37) || !(y <= 4.6e+145)) {
tmp = y * (x / z);
} else {
tmp = (x / z) - x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -3.8e+37) or not (y <= 4.6e+145): tmp = y * (x / z) else: tmp = (x / z) - x return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -3.8e+37) || !(y <= 4.6e+145)) 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 <= -3.8e+37) || ~((y <= 4.6e+145))) tmp = y * (x / z); else tmp = (x / z) - x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -3.8e+37], N[Not[LessEqual[y, 4.6e+145]], $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 -3.8 \cdot 10^{+37} \lor \neg \left(y \leq 4.6 \cdot 10^{+145}\right):\\
\;\;\;\;y \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z} - x\\
\end{array}
\end{array}
if y < -3.7999999999999999e37 or 4.6e145 < y Initial program 89.7%
associate-/l*89.6%
Simplified89.6%
Taylor expanded in y around inf 75.1%
*-commutative75.1%
associate-*r/74.0%
Simplified74.0%
if -3.7999999999999999e37 < y < 4.6e145Initial program 86.4%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in x around 0 86.4%
associate--l+86.4%
+-commutative86.4%
associate-*l/92.8%
+-commutative92.8%
Simplified92.8%
Taylor expanded in y around 0 78.0%
associate-/l*90.9%
div-sub90.9%
*-rgt-identity90.9%
associate-*r/90.7%
rgt-mult-inverse90.9%
sub-neg90.9%
metadata-eval90.9%
distribute-rgt-in90.9%
associate-*l/91.0%
*-lft-identity91.0%
neg-mul-191.0%
unsub-neg91.0%
Simplified91.0%
Final simplification85.5%
(FPCore (x y z) :precision binary64 (if (or (<= y -3e+37) (not (<= y 4.6e+145))) (/ (* x y) z) (- (/ x z) x)))
double code(double x, double y, double z) {
double tmp;
if ((y <= -3e+37) || !(y <= 4.6e+145)) {
tmp = (x * y) / 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 <= (-3d+37)) .or. (.not. (y <= 4.6d+145))) then
tmp = (x * y) / 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 <= -3e+37) || !(y <= 4.6e+145)) {
tmp = (x * y) / z;
} else {
tmp = (x / z) - x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -3e+37) or not (y <= 4.6e+145): tmp = (x * y) / z else: tmp = (x / z) - x return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -3e+37) || !(y <= 4.6e+145)) tmp = Float64(Float64(x * y) / z); else tmp = Float64(Float64(x / z) - x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -3e+37) || ~((y <= 4.6e+145))) tmp = (x * y) / z; else tmp = (x / z) - x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -3e+37], N[Not[LessEqual[y, 4.6e+145]], $MachinePrecision]], N[(N[(x * y), $MachinePrecision] / z), $MachinePrecision], N[(N[(x / z), $MachinePrecision] - x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3 \cdot 10^{+37} \lor \neg \left(y \leq 4.6 \cdot 10^{+145}\right):\\
\;\;\;\;\frac{x \cdot y}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z} - x\\
\end{array}
\end{array}
if y < -3.00000000000000022e37 or 4.6e145 < y Initial program 89.7%
associate-/l*89.6%
Simplified89.6%
Taylor expanded in y around inf 75.1%
if -3.00000000000000022e37 < y < 4.6e145Initial program 86.4%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in x around 0 86.4%
associate--l+86.4%
+-commutative86.4%
associate-*l/92.8%
+-commutative92.8%
Simplified92.8%
Taylor expanded in y around 0 78.0%
associate-/l*90.9%
div-sub90.9%
*-rgt-identity90.9%
associate-*r/90.7%
rgt-mult-inverse90.9%
sub-neg90.9%
metadata-eval90.9%
distribute-rgt-in90.9%
associate-*l/91.0%
*-lft-identity91.0%
neg-mul-191.0%
unsub-neg91.0%
Simplified91.0%
Final simplification85.8%
(FPCore (x y z) :precision binary64 (let* ((t_0 (+ (- y z) 1.0))) (if (<= x 2e-64) (/ (* x t_0) z) (* x (/ t_0 z)))))
double code(double x, double y, double z) {
double t_0 = (y - z) + 1.0;
double tmp;
if (x <= 2e-64) {
tmp = (x * t_0) / z;
} else {
tmp = x * (t_0 / 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 = (y - z) + 1.0d0
if (x <= 2d-64) then
tmp = (x * t_0) / z
else
tmp = x * (t_0 / z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = (y - z) + 1.0;
double tmp;
if (x <= 2e-64) {
tmp = (x * t_0) / z;
} else {
tmp = x * (t_0 / z);
}
return tmp;
}
def code(x, y, z): t_0 = (y - z) + 1.0 tmp = 0 if x <= 2e-64: tmp = (x * t_0) / z else: tmp = x * (t_0 / z) return tmp
function code(x, y, z) t_0 = Float64(Float64(y - z) + 1.0) tmp = 0.0 if (x <= 2e-64) tmp = Float64(Float64(x * t_0) / z); else tmp = Float64(x * Float64(t_0 / z)); end return tmp end
function tmp_2 = code(x, y, z) t_0 = (y - z) + 1.0; tmp = 0.0; if (x <= 2e-64) tmp = (x * t_0) / z; else tmp = x * (t_0 / z); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(y - z), $MachinePrecision] + 1.0), $MachinePrecision]}, If[LessEqual[x, 2e-64], N[(N[(x * t$95$0), $MachinePrecision] / z), $MachinePrecision], N[(x * N[(t$95$0 / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(y - z\right) + 1\\
\mathbf{if}\;x \leq 2 \cdot 10^{-64}:\\
\;\;\;\;\frac{x \cdot t\_0}{z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{t\_0}{z}\\
\end{array}
\end{array}
if x < 1.99999999999999993e-64Initial program 90.3%
if 1.99999999999999993e-64 < x Initial program 81.1%
associate-/l*99.8%
Simplified99.8%
Final simplification93.3%
(FPCore (x y z) :precision binary64 (if (or (<= z -1.66e-22) (not (<= z 1.0))) (- x) (/ x z)))
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.66e-22) || !(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 <= (-1.66d-22)) .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 <= -1.66e-22) || !(z <= 1.0)) {
tmp = -x;
} else {
tmp = x / z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -1.66e-22) or not (z <= 1.0): tmp = -x else: tmp = x / z return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -1.66e-22) || !(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 <= -1.66e-22) || ~((z <= 1.0))) tmp = -x; else tmp = x / z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -1.66e-22], N[Not[LessEqual[z, 1.0]], $MachinePrecision]], (-x), N[(x / z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.66 \cdot 10^{-22} \lor \neg \left(z \leq 1\right):\\
\;\;\;\;-x\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z}\\
\end{array}
\end{array}
if z < -1.65999999999999997e-22 or 1 < z Initial program 72.8%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in z around inf 80.9%
mul-1-neg80.9%
Simplified80.9%
if -1.65999999999999997e-22 < z < 1Initial program 99.9%
associate-/l*93.7%
Simplified93.7%
Taylor expanded in y around 0 58.8%
associate-/l*58.6%
Simplified58.6%
Taylor expanded in z around 0 57.7%
Final simplification68.3%
(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 87.5%
associate-/l*96.5%
Simplified96.5%
Taylor expanded in z around inf 38.6%
mul-1-neg38.6%
Simplified38.6%
Final simplification38.6%
(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 x end
function tmp = code(x, y, z) tmp = x; end
code[x_, y_, z_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 87.5%
Taylor expanded in z around inf 27.5%
associate-*r*27.5%
mul-1-neg27.5%
Simplified27.5%
associate-/l*38.6%
*-inverses38.6%
*-commutative38.6%
*-un-lft-identity38.6%
neg-sub038.6%
sub-neg38.6%
add-sqr-sqrt19.5%
sqrt-unprod17.1%
sqr-neg17.1%
sqrt-unprod1.6%
add-sqr-sqrt3.0%
Applied egg-rr3.0%
+-lft-identity3.0%
Simplified3.0%
Final simplification3.0%
(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 2024079
(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))