
(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 -1.6e+58) (not (<= x 1.56e-16))) (- x t_0) (- (cos y) t_0))))
double code(double x, double y, double z) {
double t_0 = z * sin(y);
double tmp;
if ((x <= -1.6e+58) || !(x <= 1.56e-16)) {
tmp = x - 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 <= (-1.6d+58)) .or. (.not. (x <= 1.56d-16))) then
tmp = x - 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 <= -1.6e+58) || !(x <= 1.56e-16)) {
tmp = x - 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 <= -1.6e+58) or not (x <= 1.56e-16): tmp = x - 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 <= -1.6e+58) || !(x <= 1.56e-16)) tmp = Float64(x - 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 <= -1.6e+58) || ~((x <= 1.56e-16))) tmp = x - 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, -1.6e+58], N[Not[LessEqual[x, 1.56e-16]], $MachinePrecision]], N[(x - 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 -1.6 \cdot 10^{+58} \lor \neg \left(x \leq 1.56 \cdot 10^{-16}\right):\\
\;\;\;\;x - t\_0\\
\mathbf{else}:\\
\;\;\;\;\cos y - t\_0\\
\end{array}
\end{array}
if x < -1.60000000000000008e58 or 1.55999999999999996e-16 < x Initial program 99.9%
Taylor expanded in x around inf 99.9%
Taylor expanded in x around inf 96.8%
if -1.60000000000000008e58 < x < 1.55999999999999996e-16Initial program 99.9%
Taylor expanded in x around 0 97.6%
Final simplification97.3%
(FPCore (x y z) :precision binary64 (if (or (<= z -6.5e+32) (not (<= z 2.35e-10))) (- x (* z (sin y))) (+ x (cos y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -6.5e+32) || !(z <= 2.35e-10)) {
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 <= (-6.5d+32)) .or. (.not. (z <= 2.35d-10))) 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 <= -6.5e+32) || !(z <= 2.35e-10)) {
tmp = x - (z * Math.sin(y));
} else {
tmp = x + Math.cos(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -6.5e+32) or not (z <= 2.35e-10): tmp = x - (z * math.sin(y)) else: tmp = x + math.cos(y) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -6.5e+32) || !(z <= 2.35e-10)) 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 <= -6.5e+32) || ~((z <= 2.35e-10))) tmp = x - (z * sin(y)); else tmp = x + cos(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -6.5e+32], N[Not[LessEqual[z, 2.35e-10]], $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 -6.5 \cdot 10^{+32} \lor \neg \left(z \leq 2.35 \cdot 10^{-10}\right):\\
\;\;\;\;x - z \cdot \sin y\\
\mathbf{else}:\\
\;\;\;\;x + \cos y\\
\end{array}
\end{array}
if z < -6.4999999999999994e32 or 2.3500000000000002e-10 < z Initial program 99.8%
Taylor expanded in x around inf 99.8%
Taylor expanded in x around inf 82.8%
if -6.4999999999999994e32 < z < 2.3500000000000002e-10Initial program 100.0%
Taylor expanded in z around 0 99.6%
+-commutative99.6%
Simplified99.6%
Final simplification91.3%
(FPCore (x y z) :precision binary64 (if (or (<= z -2.4e+127) (not (<= z 1.95e+124))) (* z (- (sin y))) (+ x (cos y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -2.4e+127) || !(z <= 1.95e+124)) {
tmp = 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 <= (-2.4d+127)) .or. (.not. (z <= 1.95d+124))) then
tmp = 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 <= -2.4e+127) || !(z <= 1.95e+124)) {
tmp = z * -Math.sin(y);
} else {
tmp = x + Math.cos(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -2.4e+127) or not (z <= 1.95e+124): tmp = z * -math.sin(y) else: tmp = x + math.cos(y) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -2.4e+127) || !(z <= 1.95e+124)) tmp = Float64(z * Float64(-sin(y))); else tmp = Float64(x + cos(y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -2.4e+127) || ~((z <= 1.95e+124))) tmp = z * -sin(y); else tmp = x + cos(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -2.4e+127], N[Not[LessEqual[z, 1.95e+124]], $MachinePrecision]], N[(z * (-N[Sin[y], $MachinePrecision])), $MachinePrecision], N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.4 \cdot 10^{+127} \lor \neg \left(z \leq 1.95 \cdot 10^{+124}\right):\\
\;\;\;\;z \cdot \left(-\sin y\right)\\
\mathbf{else}:\\
\;\;\;\;x + \cos y\\
\end{array}
\end{array}
if z < -2.4000000000000002e127 or 1.95e124 < z Initial program 99.8%
Taylor expanded in z around inf 71.2%
associate-*r*71.2%
neg-mul-171.2%
*-commutative71.2%
Simplified71.2%
if -2.4000000000000002e127 < z < 1.95e124Initial program 100.0%
Taylor expanded in z around 0 91.0%
+-commutative91.0%
Simplified91.0%
Final simplification85.2%
(FPCore (x y z) :precision binary64 (if (or (<= y -0.03) (not (<= y 1.2))) (+ x (cos y)) (+ 1.0 (+ x (* y (- (* y (- (* 0.16666666666666666 (* y z)) 0.5)) z))))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -0.03) || !(y <= 1.2)) {
tmp = x + cos(y);
} else {
tmp = 1.0 + (x + (y * ((y * ((0.16666666666666666 * (y * z)) - 0.5)) - 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 <= (-0.03d0)) .or. (.not. (y <= 1.2d0))) then
tmp = x + cos(y)
else
tmp = 1.0d0 + (x + (y * ((y * ((0.16666666666666666d0 * (y * z)) - 0.5d0)) - z)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -0.03) || !(y <= 1.2)) {
tmp = x + Math.cos(y);
} else {
tmp = 1.0 + (x + (y * ((y * ((0.16666666666666666 * (y * z)) - 0.5)) - z)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -0.03) or not (y <= 1.2): tmp = x + math.cos(y) else: tmp = 1.0 + (x + (y * ((y * ((0.16666666666666666 * (y * z)) - 0.5)) - z))) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -0.03) || !(y <= 1.2)) tmp = Float64(x + cos(y)); else tmp = Float64(1.0 + Float64(x + Float64(y * Float64(Float64(y * Float64(Float64(0.16666666666666666 * Float64(y * z)) - 0.5)) - z)))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -0.03) || ~((y <= 1.2))) tmp = x + cos(y); else tmp = 1.0 + (x + (y * ((y * ((0.16666666666666666 * (y * z)) - 0.5)) - z))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -0.03], N[Not[LessEqual[y, 1.2]], $MachinePrecision]], N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(x + N[(y * N[(N[(y * N[(N[(0.16666666666666666 * N[(y * z), $MachinePrecision]), $MachinePrecision] - 0.5), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -0.03 \lor \neg \left(y \leq 1.2\right):\\
\;\;\;\;x + \cos y\\
\mathbf{else}:\\
\;\;\;\;1 + \left(x + y \cdot \left(y \cdot \left(0.16666666666666666 \cdot \left(y \cdot z\right) - 0.5\right) - z\right)\right)\\
\end{array}
\end{array}
if y < -0.029999999999999999 or 1.19999999999999996 < y Initial program 99.8%
Taylor expanded in z around 0 61.9%
+-commutative61.9%
Simplified61.9%
if -0.029999999999999999 < y < 1.19999999999999996Initial program 100.0%
Taylor expanded in y around 0 99.4%
Final simplification79.6%
(FPCore (x y z) :precision binary64 (if (<= x -1.65e+32) x (if (<= x 8.1e-84) (cos y) (+ x 1.0))))
double code(double x, double y, double z) {
double tmp;
if (x <= -1.65e+32) {
tmp = x;
} else if (x <= 8.1e-84) {
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) :: tmp
if (x <= (-1.65d+32)) then
tmp = x
else if (x <= 8.1d-84) 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 tmp;
if (x <= -1.65e+32) {
tmp = x;
} else if (x <= 8.1e-84) {
tmp = Math.cos(y);
} else {
tmp = x + 1.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -1.65e+32: tmp = x elif x <= 8.1e-84: tmp = math.cos(y) else: tmp = x + 1.0 return tmp
function code(x, y, z) tmp = 0.0 if (x <= -1.65e+32) tmp = x; elseif (x <= 8.1e-84) tmp = cos(y); else tmp = Float64(x + 1.0); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -1.65e+32) tmp = x; elseif (x <= 8.1e-84) tmp = cos(y); else tmp = x + 1.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -1.65e+32], x, If[LessEqual[x, 8.1e-84], N[Cos[y], $MachinePrecision], N[(x + 1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.65 \cdot 10^{+32}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 8.1 \cdot 10^{-84}:\\
\;\;\;\;\cos y\\
\mathbf{else}:\\
\;\;\;\;x + 1\\
\end{array}
\end{array}
if x < -1.6500000000000001e32Initial program 100.0%
Taylor expanded in x around inf 86.0%
if -1.6500000000000001e32 < x < 8.0999999999999997e-84Initial program 99.9%
Taylor expanded in x around 0 98.9%
add-sqr-sqrt52.1%
pow252.1%
Applied egg-rr52.1%
Taylor expanded in z around 0 62.8%
if 8.0999999999999997e-84 < x Initial program 99.9%
Taylor expanded in y around 0 73.1%
+-commutative73.1%
Simplified73.1%
(FPCore (x y z) :precision binary64 (if (or (<= y -6e+21) (not (<= y 2.05e-68))) (+ x 1.0) (+ 1.0 (+ x (* y (- (* y -0.5) z))))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -6e+21) || !(y <= 2.05e-68)) {
tmp = x + 1.0;
} else {
tmp = 1.0 + (x + (y * ((y * -0.5) - 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 <= (-6d+21)) .or. (.not. (y <= 2.05d-68))) then
tmp = x + 1.0d0
else
tmp = 1.0d0 + (x + (y * ((y * (-0.5d0)) - z)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -6e+21) || !(y <= 2.05e-68)) {
tmp = x + 1.0;
} else {
tmp = 1.0 + (x + (y * ((y * -0.5) - z)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -6e+21) or not (y <= 2.05e-68): tmp = x + 1.0 else: tmp = 1.0 + (x + (y * ((y * -0.5) - z))) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -6e+21) || !(y <= 2.05e-68)) tmp = Float64(x + 1.0); else tmp = Float64(1.0 + Float64(x + Float64(y * Float64(Float64(y * -0.5) - z)))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -6e+21) || ~((y <= 2.05e-68))) tmp = x + 1.0; else tmp = 1.0 + (x + (y * ((y * -0.5) - z))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -6e+21], N[Not[LessEqual[y, 2.05e-68]], $MachinePrecision]], N[(x + 1.0), $MachinePrecision], N[(1.0 + N[(x + N[(y * N[(N[(y * -0.5), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -6 \cdot 10^{+21} \lor \neg \left(y \leq 2.05 \cdot 10^{-68}\right):\\
\;\;\;\;x + 1\\
\mathbf{else}:\\
\;\;\;\;1 + \left(x + y \cdot \left(y \cdot -0.5 - z\right)\right)\\
\end{array}
\end{array}
if y < -6e21 or 2.05000000000000011e-68 < y Initial program 99.9%
Taylor expanded in y around 0 40.1%
+-commutative40.1%
Simplified40.1%
if -6e21 < y < 2.05000000000000011e-68Initial program 100.0%
Taylor expanded in y around 0 96.3%
Final simplification66.4%
(FPCore (x y z) :precision binary64 (if (or (<= z -1.16e+83) (not (<= z 1.25e+94))) (+ x (- 1.0 (* y z))) (+ x 1.0)))
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.16e+83) || !(z <= 1.25e+94)) {
tmp = x + (1.0 - (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.16d+83)) .or. (.not. (z <= 1.25d+94))) then
tmp = x + (1.0d0 - (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.16e+83) || !(z <= 1.25e+94)) {
tmp = x + (1.0 - (y * z));
} else {
tmp = x + 1.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -1.16e+83) or not (z <= 1.25e+94): tmp = x + (1.0 - (y * z)) else: tmp = x + 1.0 return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -1.16e+83) || !(z <= 1.25e+94)) tmp = Float64(x + Float64(1.0 - Float64(y * z))); else tmp = Float64(x + 1.0); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -1.16e+83) || ~((z <= 1.25e+94))) tmp = x + (1.0 - (y * z)); else tmp = x + 1.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -1.16e+83], N[Not[LessEqual[z, 1.25e+94]], $MachinePrecision]], N[(x + N[(1.0 - N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + 1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.16 \cdot 10^{+83} \lor \neg \left(z \leq 1.25 \cdot 10^{+94}\right):\\
\;\;\;\;x + \left(1 - y \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x + 1\\
\end{array}
\end{array}
if z < -1.1600000000000001e83 or 1.25000000000000003e94 < z Initial program 99.8%
Taylor expanded in y around 0 52.0%
associate-+r+52.0%
+-commutative52.0%
associate-+l+52.0%
mul-1-neg52.0%
unsub-neg52.0%
Simplified52.0%
if -1.1600000000000001e83 < z < 1.25000000000000003e94Initial program 100.0%
Taylor expanded in y around 0 72.7%
+-commutative72.7%
Simplified72.7%
Final simplification64.9%
(FPCore (x y z) :precision binary64 (if (<= x -1.65e+32) x (if (<= x 9.5e-127) (- 1.0 (* y z)) (+ x 1.0))))
double code(double x, double y, double z) {
double tmp;
if (x <= -1.65e+32) {
tmp = x;
} else if (x <= 9.5e-127) {
tmp = 1.0 - (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 (x <= (-1.65d+32)) then
tmp = x
else if (x <= 9.5d-127) then
tmp = 1.0d0 - (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 (x <= -1.65e+32) {
tmp = x;
} else if (x <= 9.5e-127) {
tmp = 1.0 - (y * z);
} else {
tmp = x + 1.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -1.65e+32: tmp = x elif x <= 9.5e-127: tmp = 1.0 - (y * z) else: tmp = x + 1.0 return tmp
function code(x, y, z) tmp = 0.0 if (x <= -1.65e+32) tmp = x; elseif (x <= 9.5e-127) tmp = Float64(1.0 - Float64(y * z)); else tmp = Float64(x + 1.0); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -1.65e+32) tmp = x; elseif (x <= 9.5e-127) tmp = 1.0 - (y * z); else tmp = x + 1.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -1.65e+32], x, If[LessEqual[x, 9.5e-127], N[(1.0 - N[(y * z), $MachinePrecision]), $MachinePrecision], N[(x + 1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.65 \cdot 10^{+32}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 9.5 \cdot 10^{-127}:\\
\;\;\;\;1 - y \cdot z\\
\mathbf{else}:\\
\;\;\;\;x + 1\\
\end{array}
\end{array}
if x < -1.6500000000000001e32Initial program 100.0%
Taylor expanded in x around inf 86.0%
if -1.6500000000000001e32 < x < 9.4999999999999997e-127Initial program 99.9%
Taylor expanded in x around 0 98.8%
Taylor expanded in y around 0 50.6%
mul-1-neg50.6%
unsub-neg50.6%
Simplified50.6%
if 9.4999999999999997e-127 < x Initial program 99.9%
Taylor expanded in y around 0 70.1%
+-commutative70.1%
Simplified70.1%
(FPCore (x y z) :precision binary64 (if (<= x -1.25e+60) x (if (<= x 7.5e-125) 1.0 x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -1.25e+60) {
tmp = x;
} else if (x <= 7.5e-125) {
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.25d+60)) then
tmp = x
else if (x <= 7.5d-125) 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.25e+60) {
tmp = x;
} else if (x <= 7.5e-125) {
tmp = 1.0;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -1.25e+60: tmp = x elif x <= 7.5e-125: tmp = 1.0 else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -1.25e+60) tmp = x; elseif (x <= 7.5e-125) tmp = 1.0; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -1.25e+60) tmp = x; elseif (x <= 7.5e-125) tmp = 1.0; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -1.25e+60], x, If[LessEqual[x, 7.5e-125], 1.0, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.25 \cdot 10^{+60}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 7.5 \cdot 10^{-125}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -1.24999999999999994e60 or 7.5e-125 < x Initial program 99.9%
Taylor expanded in x around inf 72.0%
if -1.24999999999999994e60 < x < 7.5e-125Initial program 99.9%
Taylor expanded in x around 0 96.6%
Taylor expanded in y around 0 41.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 59.9%
+-commutative59.9%
Simplified59.9%
(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 63.1%
Taylor expanded in y around 0 24.0%
herbie shell --seed 2024107
(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))))