
(FPCore (x y z) :precision binary64 (- (+ x (cos y)) (* z (sin y))))
double code(double x, double y, double z) {
return (x + cos(y)) - (z * sin(y));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (x + cos(y)) - (z * sin(y))
end function
public static double code(double x, double y, double z) {
return (x + Math.cos(y)) - (z * Math.sin(y));
}
def code(x, y, z): return (x + math.cos(y)) - (z * math.sin(y))
function code(x, y, z) return Float64(Float64(x + cos(y)) - Float64(z * sin(y))) end
function tmp = code(x, y, z) tmp = (x + cos(y)) - (z * sin(y)); end
code[x_, y_, z_] := N[(N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision] - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x + \cos y\right) - z \cdot \sin y
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (- (+ x (cos y)) (* z (sin y))))
double code(double x, double y, double z) {
return (x + cos(y)) - (z * sin(y));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (x + cos(y)) - (z * sin(y))
end function
public static double code(double x, double y, double z) {
return (x + Math.cos(y)) - (z * Math.sin(y));
}
def code(x, y, z): return (x + math.cos(y)) - (z * math.sin(y))
function code(x, y, z) return Float64(Float64(x + cos(y)) - Float64(z * sin(y))) end
function tmp = code(x, y, z) tmp = (x + cos(y)) - (z * sin(y)); end
code[x_, y_, z_] := N[(N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision] - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x + \cos y\right) - z \cdot \sin y
\end{array}
(FPCore (x y z) :precision binary64 (- (+ x (cos y)) (* z (sin y))))
double code(double x, double y, double z) {
return (x + cos(y)) - (z * sin(y));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (x + cos(y)) - (z * sin(y))
end function
public static double code(double x, double y, double z) {
return (x + Math.cos(y)) - (z * Math.sin(y));
}
def code(x, y, z): return (x + math.cos(y)) - (z * math.sin(y))
function code(x, y, z) return Float64(Float64(x + cos(y)) - Float64(z * sin(y))) end
function tmp = code(x, y, z) tmp = (x + cos(y)) - (z * sin(y)); end
code[x_, y_, z_] := N[(N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision] - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x + \cos y\right) - z \cdot \sin y
\end{array}
Initial program 99.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (sin y))))
(if (or (<= x -7.5e-22) (not (<= x 0.00029)))
(- (+ x 1.0) t_0)
(- (cos y) t_0))))
double code(double x, double y, double z) {
double t_0 = z * sin(y);
double tmp;
if ((x <= -7.5e-22) || !(x <= 0.00029)) {
tmp = (x + 1.0) - t_0;
} else {
tmp = cos(y) - 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 = z * sin(y)
if ((x <= (-7.5d-22)) .or. (.not. (x <= 0.00029d0))) then
tmp = (x + 1.0d0) - t_0
else
tmp = cos(y) - t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = z * Math.sin(y);
double tmp;
if ((x <= -7.5e-22) || !(x <= 0.00029)) {
tmp = (x + 1.0) - t_0;
} else {
tmp = Math.cos(y) - t_0;
}
return tmp;
}
def code(x, y, z): t_0 = z * math.sin(y) tmp = 0 if (x <= -7.5e-22) or not (x <= 0.00029): tmp = (x + 1.0) - t_0 else: tmp = math.cos(y) - t_0 return tmp
function code(x, y, z) t_0 = Float64(z * sin(y)) tmp = 0.0 if ((x <= -7.5e-22) || !(x <= 0.00029)) tmp = Float64(Float64(x + 1.0) - t_0); else tmp = Float64(cos(y) - t_0); end return tmp end
function tmp_2 = code(x, y, z) t_0 = z * sin(y); tmp = 0.0; if ((x <= -7.5e-22) || ~((x <= 0.00029))) tmp = (x + 1.0) - t_0; else tmp = cos(y) - t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[x, -7.5e-22], N[Not[LessEqual[x, 0.00029]], $MachinePrecision]], N[(N[(x + 1.0), $MachinePrecision] - t$95$0), $MachinePrecision], N[(N[Cos[y], $MachinePrecision] - t$95$0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \sin y\\
\mathbf{if}\;x \leq -7.5 \cdot 10^{-22} \lor \neg \left(x \leq 0.00029\right):\\
\;\;\;\;\left(x + 1\right) - t\_0\\
\mathbf{else}:\\
\;\;\;\;\cos y - t\_0\\
\end{array}
\end{array}
if x < -7.49999999999999978e-22 or 2.9e-4 < x Initial program 99.9%
Taylor expanded in y around 0 99.8%
+-commutative99.8%
Simplified99.8%
if -7.49999999999999978e-22 < x < 2.9e-4Initial program 99.9%
Taylor expanded in x around 0 99.7%
Final simplification99.7%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (- 1.0 (* y z))))
(if (<= x -0.08)
(+ x 1.0)
(if (<= x -2.6e-195)
t_0
(if (<= x 2.25e-212)
(cos y)
(if (<= x 2.6e-137) t_0 (if (<= x 1.6e-9) (cos y) (+ x 1.0))))))))
double code(double x, double y, double z) {
double t_0 = 1.0 - (y * z);
double tmp;
if (x <= -0.08) {
tmp = x + 1.0;
} else if (x <= -2.6e-195) {
tmp = t_0;
} else if (x <= 2.25e-212) {
tmp = cos(y);
} else if (x <= 2.6e-137) {
tmp = t_0;
} else if (x <= 1.6e-9) {
tmp = cos(y);
} else {
tmp = x + 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) :: t_0
real(8) :: tmp
t_0 = 1.0d0 - (y * z)
if (x <= (-0.08d0)) then
tmp = x + 1.0d0
else if (x <= (-2.6d-195)) then
tmp = t_0
else if (x <= 2.25d-212) then
tmp = cos(y)
else if (x <= 2.6d-137) then
tmp = t_0
else if (x <= 1.6d-9) then
tmp = cos(y)
else
tmp = x + 1.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = 1.0 - (y * z);
double tmp;
if (x <= -0.08) {
tmp = x + 1.0;
} else if (x <= -2.6e-195) {
tmp = t_0;
} else if (x <= 2.25e-212) {
tmp = Math.cos(y);
} else if (x <= 2.6e-137) {
tmp = t_0;
} else if (x <= 1.6e-9) {
tmp = Math.cos(y);
} else {
tmp = x + 1.0;
}
return tmp;
}
def code(x, y, z): t_0 = 1.0 - (y * z) tmp = 0 if x <= -0.08: tmp = x + 1.0 elif x <= -2.6e-195: tmp = t_0 elif x <= 2.25e-212: tmp = math.cos(y) elif x <= 2.6e-137: tmp = t_0 elif x <= 1.6e-9: tmp = math.cos(y) else: tmp = x + 1.0 return tmp
function code(x, y, z) t_0 = Float64(1.0 - Float64(y * z)) tmp = 0.0 if (x <= -0.08) tmp = Float64(x + 1.0); elseif (x <= -2.6e-195) tmp = t_0; elseif (x <= 2.25e-212) tmp = cos(y); elseif (x <= 2.6e-137) tmp = t_0; elseif (x <= 1.6e-9) tmp = cos(y); else tmp = Float64(x + 1.0); end return tmp end
function tmp_2 = code(x, y, z) t_0 = 1.0 - (y * z); tmp = 0.0; if (x <= -0.08) tmp = x + 1.0; elseif (x <= -2.6e-195) tmp = t_0; elseif (x <= 2.25e-212) tmp = cos(y); elseif (x <= 2.6e-137) tmp = t_0; elseif (x <= 1.6e-9) tmp = cos(y); else tmp = x + 1.0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(1.0 - N[(y * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -0.08], N[(x + 1.0), $MachinePrecision], If[LessEqual[x, -2.6e-195], t$95$0, If[LessEqual[x, 2.25e-212], N[Cos[y], $MachinePrecision], If[LessEqual[x, 2.6e-137], t$95$0, If[LessEqual[x, 1.6e-9], N[Cos[y], $MachinePrecision], N[(x + 1.0), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 - y \cdot z\\
\mathbf{if}\;x \leq -0.08:\\
\;\;\;\;x + 1\\
\mathbf{elif}\;x \leq -2.6 \cdot 10^{-195}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 2.25 \cdot 10^{-212}:\\
\;\;\;\;\cos y\\
\mathbf{elif}\;x \leq 2.6 \cdot 10^{-137}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 1.6 \cdot 10^{-9}:\\
\;\;\;\;\cos y\\
\mathbf{else}:\\
\;\;\;\;x + 1\\
\end{array}
\end{array}
if x < -0.0800000000000000017 or 1.60000000000000006e-9 < x Initial program 99.9%
Taylor expanded in y around 0 70.8%
Taylor expanded in y around 0 86.1%
+-commutative86.1%
Simplified86.1%
if -0.0800000000000000017 < x < -2.6000000000000002e-195 or 2.2499999999999999e-212 < x < 2.6e-137Initial program 99.9%
Taylor expanded in x around 0 99.9%
Taylor expanded in y around 0 62.4%
mul-1-neg62.4%
*-commutative62.4%
unsub-neg62.4%
Simplified62.4%
if -2.6000000000000002e-195 < x < 2.2499999999999999e-212 or 2.6e-137 < x < 1.60000000000000006e-9Initial program 100.0%
Taylor expanded in x around 0 99.5%
Taylor expanded in z around 0 77.2%
Final simplification77.9%
(FPCore (x y z) :precision binary64 (if (or (<= z -1.7e-12) (not (<= z 4.5e+18))) (- (+ x 1.0) (* z (sin y))) (+ x (cos y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.7e-12) || !(z <= 4.5e+18)) {
tmp = (x + 1.0) - (z * sin(y));
} else {
tmp = x + cos(y);
}
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.7d-12)) .or. (.not. (z <= 4.5d+18))) then
tmp = (x + 1.0d0) - (z * sin(y))
else
tmp = x + cos(y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -1.7e-12) || !(z <= 4.5e+18)) {
tmp = (x + 1.0) - (z * Math.sin(y));
} else {
tmp = x + Math.cos(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -1.7e-12) or not (z <= 4.5e+18): tmp = (x + 1.0) - (z * math.sin(y)) else: tmp = x + math.cos(y) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -1.7e-12) || !(z <= 4.5e+18)) tmp = Float64(Float64(x + 1.0) - Float64(z * sin(y))); else tmp = Float64(x + cos(y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -1.7e-12) || ~((z <= 4.5e+18))) tmp = (x + 1.0) - (z * sin(y)); else tmp = x + cos(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -1.7e-12], N[Not[LessEqual[z, 4.5e+18]], $MachinePrecision]], N[(N[(x + 1.0), $MachinePrecision] - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.7 \cdot 10^{-12} \lor \neg \left(z \leq 4.5 \cdot 10^{+18}\right):\\
\;\;\;\;\left(x + 1\right) - z \cdot \sin y\\
\mathbf{else}:\\
\;\;\;\;x + \cos y\\
\end{array}
\end{array}
if z < -1.7e-12 or 4.5e18 < z Initial program 99.8%
Taylor expanded in y around 0 99.8%
+-commutative99.8%
Simplified99.8%
if -1.7e-12 < z < 4.5e18Initial program 100.0%
Taylor expanded in y around 0 78.5%
Taylor expanded in z around 0 99.4%
Final simplification99.6%
(FPCore (x y z) :precision binary64 (if (or (<= z -4.8e+16) (not (<= z 8e+117))) (- x (* z (sin y))) (+ x (cos y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -4.8e+16) || !(z <= 8e+117)) {
tmp = x - (z * sin(y));
} else {
tmp = x + cos(y);
}
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 <= (-4.8d+16)) .or. (.not. (z <= 8d+117))) then
tmp = x - (z * sin(y))
else
tmp = x + cos(y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -4.8e+16) || !(z <= 8e+117)) {
tmp = x - (z * Math.sin(y));
} else {
tmp = x + Math.cos(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -4.8e+16) or not (z <= 8e+117): tmp = x - (z * math.sin(y)) else: tmp = x + math.cos(y) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -4.8e+16) || !(z <= 8e+117)) tmp = Float64(x - Float64(z * sin(y))); else tmp = Float64(x + cos(y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -4.8e+16) || ~((z <= 8e+117))) tmp = x - (z * sin(y)); else tmp = x + cos(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -4.8e+16], N[Not[LessEqual[z, 8e+117]], $MachinePrecision]], N[(x - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.8 \cdot 10^{+16} \lor \neg \left(z \leq 8 \cdot 10^{+117}\right):\\
\;\;\;\;x - z \cdot \sin y\\
\mathbf{else}:\\
\;\;\;\;x + \cos y\\
\end{array}
\end{array}
if z < -4.8e16 or 8.0000000000000004e117 < z Initial program 99.8%
Taylor expanded in x around inf 87.4%
if -4.8e16 < z < 8.0000000000000004e117Initial program 100.0%
Taylor expanded in y around 0 78.0%
Taylor expanded in z around 0 97.1%
Final simplification93.3%
(FPCore (x y z) :precision binary64 (if (or (<= z -4.5e+174) (not (<= z 1.85e+163))) (* (sin y) (- z)) (+ x (cos y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -4.5e+174) || !(z <= 1.85e+163)) {
tmp = sin(y) * -z;
} else {
tmp = x + cos(y);
}
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 <= (-4.5d+174)) .or. (.not. (z <= 1.85d+163))) then
tmp = sin(y) * -z
else
tmp = x + cos(y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -4.5e+174) || !(z <= 1.85e+163)) {
tmp = Math.sin(y) * -z;
} else {
tmp = x + Math.cos(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -4.5e+174) or not (z <= 1.85e+163): tmp = math.sin(y) * -z else: tmp = x + math.cos(y) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -4.5e+174) || !(z <= 1.85e+163)) tmp = Float64(sin(y) * Float64(-z)); else tmp = Float64(x + cos(y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -4.5e+174) || ~((z <= 1.85e+163))) tmp = sin(y) * -z; else tmp = x + cos(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -4.5e+174], N[Not[LessEqual[z, 1.85e+163]], $MachinePrecision]], N[(N[Sin[y], $MachinePrecision] * (-z)), $MachinePrecision], N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.5 \cdot 10^{+174} \lor \neg \left(z \leq 1.85 \cdot 10^{+163}\right):\\
\;\;\;\;\sin y \cdot \left(-z\right)\\
\mathbf{else}:\\
\;\;\;\;x + \cos y\\
\end{array}
\end{array}
if z < -4.50000000000000042e174 or 1.84999999999999996e163 < z Initial program 99.7%
Taylor expanded in x around inf 93.6%
Taylor expanded in x around 0 82.3%
mul-1-neg82.3%
*-commutative82.3%
distribute-rgt-neg-in82.3%
Simplified82.3%
if -4.50000000000000042e174 < z < 1.84999999999999996e163Initial program 100.0%
Taylor expanded in y around 0 75.4%
Taylor expanded in z around 0 88.9%
Final simplification87.5%
(FPCore (x y z) :precision binary64 (if (or (<= z -2.5e+212) (not (<= z 9.6e+161))) (- x (* y z)) (+ x (cos y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -2.5e+212) || !(z <= 9.6e+161)) {
tmp = x - (y * z);
} else {
tmp = x + cos(y);
}
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.5d+212)) .or. (.not. (z <= 9.6d+161))) then
tmp = x - (y * z)
else
tmp = x + cos(y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -2.5e+212) || !(z <= 9.6e+161)) {
tmp = x - (y * z);
} else {
tmp = x + Math.cos(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -2.5e+212) or not (z <= 9.6e+161): tmp = x - (y * z) else: tmp = x + math.cos(y) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -2.5e+212) || !(z <= 9.6e+161)) tmp = Float64(x - Float64(y * z)); else tmp = Float64(x + cos(y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -2.5e+212) || ~((z <= 9.6e+161))) tmp = x - (y * z); else tmp = x + cos(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -2.5e+212], N[Not[LessEqual[z, 9.6e+161]], $MachinePrecision]], N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision], N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.5 \cdot 10^{+212} \lor \neg \left(z \leq 9.6 \cdot 10^{+161}\right):\\
\;\;\;\;x - y \cdot z\\
\mathbf{else}:\\
\;\;\;\;x + \cos y\\
\end{array}
\end{array}
if z < -2.49999999999999996e212 or 9.5999999999999996e161 < z Initial program 99.7%
Taylor expanded in x around inf 94.9%
Taylor expanded in y around 0 46.6%
associate-*r*46.6%
neg-mul-146.6%
cancel-sign-sub-inv46.6%
*-commutative46.6%
Simplified46.6%
if -2.49999999999999996e212 < z < 9.5999999999999996e161Initial program 100.0%
Taylor expanded in y around 0 73.7%
Taylor expanded in z around 0 87.3%
Final simplification79.5%
(FPCore (x y z) :precision binary64 (if (or (<= x -0.08) (not (<= x 2.3e-18))) (+ x 1.0) (- 1.0 (* y z))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -0.08) || !(x <= 2.3e-18)) {
tmp = x + 1.0;
} else {
tmp = 1.0 - (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 ((x <= (-0.08d0)) .or. (.not. (x <= 2.3d-18))) then
tmp = x + 1.0d0
else
tmp = 1.0d0 - (y * z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -0.08) || !(x <= 2.3e-18)) {
tmp = x + 1.0;
} else {
tmp = 1.0 - (y * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -0.08) or not (x <= 2.3e-18): tmp = x + 1.0 else: tmp = 1.0 - (y * z) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -0.08) || !(x <= 2.3e-18)) tmp = Float64(x + 1.0); else tmp = Float64(1.0 - Float64(y * z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -0.08) || ~((x <= 2.3e-18))) tmp = x + 1.0; else tmp = 1.0 - (y * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -0.08], N[Not[LessEqual[x, 2.3e-18]], $MachinePrecision]], N[(x + 1.0), $MachinePrecision], N[(1.0 - N[(y * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.08 \lor \neg \left(x \leq 2.3 \cdot 10^{-18}\right):\\
\;\;\;\;x + 1\\
\mathbf{else}:\\
\;\;\;\;1 - y \cdot z\\
\end{array}
\end{array}
if x < -0.0800000000000000017 or 2.3000000000000001e-18 < x Initial program 99.9%
Taylor expanded in y around 0 71.2%
Taylor expanded in y around 0 85.6%
+-commutative85.6%
Simplified85.6%
if -0.0800000000000000017 < x < 2.3000000000000001e-18Initial program 99.9%
Taylor expanded in x around 0 99.9%
Taylor expanded in y around 0 58.7%
mul-1-neg58.7%
*-commutative58.7%
unsub-neg58.7%
Simplified58.7%
Final simplification72.1%
(FPCore (x y z) :precision binary64 (if (<= x -1.55e-9) x (if (<= x 1.0) 1.0 x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -1.55e-9) {
tmp = x;
} else if (x <= 1.0) {
tmp = 1.0;
} 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 (x <= (-1.55d-9)) then
tmp = x
else if (x <= 1.0d0) then
tmp = 1.0d0
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -1.55e-9) {
tmp = x;
} else if (x <= 1.0) {
tmp = 1.0;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -1.55e-9: tmp = x elif x <= 1.0: tmp = 1.0 else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -1.55e-9) tmp = x; elseif (x <= 1.0) tmp = 1.0; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -1.55e-9) tmp = x; elseif (x <= 1.0) tmp = 1.0; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -1.55e-9], x, If[LessEqual[x, 1.0], 1.0, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.55 \cdot 10^{-9}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 1:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -1.55000000000000002e-9 or 1 < x Initial program 99.9%
Taylor expanded in x around inf 98.7%
Taylor expanded in x around inf 83.7%
if -1.55000000000000002e-9 < x < 1Initial program 99.9%
Taylor expanded in x around 0 99.7%
Taylor expanded in y around 0 44.9%
(FPCore (x y z) :precision binary64 (if (<= z -1.25e+215) (* y (- z)) (+ x 1.0)))
double code(double x, double y, double z) {
double tmp;
if (z <= -1.25e+215) {
tmp = y * -z;
} else {
tmp = x + 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 (z <= (-1.25d+215)) then
tmp = y * -z
else
tmp = x + 1.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -1.25e+215) {
tmp = y * -z;
} else {
tmp = x + 1.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1.25e+215: tmp = y * -z else: tmp = x + 1.0 return tmp
function code(x, y, z) tmp = 0.0 if (z <= -1.25e+215) tmp = Float64(y * Float64(-z)); else tmp = Float64(x + 1.0); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -1.25e+215) tmp = y * -z; else tmp = x + 1.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -1.25e+215], N[(y * (-z)), $MachinePrecision], N[(x + 1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.25 \cdot 10^{+215}:\\
\;\;\;\;y \cdot \left(-z\right)\\
\mathbf{else}:\\
\;\;\;\;x + 1\\
\end{array}
\end{array}
if z < -1.25e215Initial program 99.6%
Taylor expanded in y around 0 52.8%
Taylor expanded in y around inf 40.8%
associate-*r*40.8%
neg-mul-140.8%
*-commutative40.8%
Simplified40.8%
if -1.25e215 < z Initial program 99.9%
Taylor expanded in y around 0 71.0%
Taylor expanded in y around 0 69.6%
+-commutative69.6%
Simplified69.6%
Final simplification67.1%
(FPCore (x y z) :precision binary64 (+ x 1.0))
double code(double x, double y, double z) {
return x + 1.0;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x + 1.0d0
end function
public static double code(double x, double y, double z) {
return x + 1.0;
}
def code(x, y, z): return x + 1.0
function code(x, y, z) return Float64(x + 1.0) end
function tmp = code(x, y, z) tmp = x + 1.0; end
code[x_, y_, z_] := N[(x + 1.0), $MachinePrecision]
\begin{array}{l}
\\
x + 1
\end{array}
Initial program 99.9%
Taylor expanded in y around 0 69.4%
Taylor expanded in y around 0 64.6%
+-commutative64.6%
Simplified64.6%
(FPCore (x y z) :precision binary64 1.0)
double code(double x, double y, double z) {
return 1.0;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = 1.0d0
end function
public static double code(double x, double y, double z) {
return 1.0;
}
def code(x, y, z): return 1.0
function code(x, y, z) return 1.0 end
function tmp = code(x, y, z) tmp = 1.0; end
code[x_, y_, z_] := 1.0
\begin{array}{l}
\\
1
\end{array}
Initial program 99.9%
Taylor expanded in x around 0 59.1%
Taylor expanded in y around 0 24.1%
herbie shell --seed 2024103
(FPCore (x y z)
:name "Graphics.Rasterific.Svg.PathConverter:segmentToBezier from rasterific-svg-0.2.3.1, B"
:precision binary64
(- (+ x (cos y)) (* z (sin y))))