
(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 100.0%
Final simplification100.0%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (sin y))))
(if (or (<= x -9.2e-10) (not (<= x 1.35e-6)))
(- (+ 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 <= -9.2e-10) || !(x <= 1.35e-6)) {
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 <= (-9.2d-10)) .or. (.not. (x <= 1.35d-6))) 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 <= -9.2e-10) || !(x <= 1.35e-6)) {
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 <= -9.2e-10) or not (x <= 1.35e-6): 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 <= -9.2e-10) || !(x <= 1.35e-6)) 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 <= -9.2e-10) || ~((x <= 1.35e-6))) 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, -9.2e-10], N[Not[LessEqual[x, 1.35e-6]], $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 -9.2 \cdot 10^{-10} \lor \neg \left(x \leq 1.35 \cdot 10^{-6}\right):\\
\;\;\;\;\left(x + 1\right) - t_0\\
\mathbf{else}:\\
\;\;\;\;\cos y - t_0\\
\end{array}
\end{array}
if x < -9.20000000000000028e-10 or 1.34999999999999999e-6 < x Initial program 100.0%
Taylor expanded in y around 0 97.9%
+-commutative97.9%
Simplified97.9%
if -9.20000000000000028e-10 < x < 1.34999999999999999e-6Initial program 99.9%
Taylor expanded in x around 0 99.4%
Final simplification98.6%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (- (+ x 1.0) (* z (sin y)))))
(if (<= z -2.4e-12)
t_0
(if (<= z -2.8e-49)
(cos y)
(if (or (<= z -1.22e-90) (not (<= z 7.2e-148)))
t_0
(- (+ x (cos y)) (* y z)))))))
double code(double x, double y, double z) {
double t_0 = (x + 1.0) - (z * sin(y));
double tmp;
if (z <= -2.4e-12) {
tmp = t_0;
} else if (z <= -2.8e-49) {
tmp = cos(y);
} else if ((z <= -1.22e-90) || !(z <= 7.2e-148)) {
tmp = t_0;
} else {
tmp = (x + cos(y)) - (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) :: t_0
real(8) :: tmp
t_0 = (x + 1.0d0) - (z * sin(y))
if (z <= (-2.4d-12)) then
tmp = t_0
else if (z <= (-2.8d-49)) then
tmp = cos(y)
else if ((z <= (-1.22d-90)) .or. (.not. (z <= 7.2d-148))) then
tmp = t_0
else
tmp = (x + cos(y)) - (y * z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = (x + 1.0) - (z * Math.sin(y));
double tmp;
if (z <= -2.4e-12) {
tmp = t_0;
} else if (z <= -2.8e-49) {
tmp = Math.cos(y);
} else if ((z <= -1.22e-90) || !(z <= 7.2e-148)) {
tmp = t_0;
} else {
tmp = (x + Math.cos(y)) - (y * z);
}
return tmp;
}
def code(x, y, z): t_0 = (x + 1.0) - (z * math.sin(y)) tmp = 0 if z <= -2.4e-12: tmp = t_0 elif z <= -2.8e-49: tmp = math.cos(y) elif (z <= -1.22e-90) or not (z <= 7.2e-148): tmp = t_0 else: tmp = (x + math.cos(y)) - (y * z) return tmp
function code(x, y, z) t_0 = Float64(Float64(x + 1.0) - Float64(z * sin(y))) tmp = 0.0 if (z <= -2.4e-12) tmp = t_0; elseif (z <= -2.8e-49) tmp = cos(y); elseif ((z <= -1.22e-90) || !(z <= 7.2e-148)) tmp = t_0; else tmp = Float64(Float64(x + cos(y)) - Float64(y * z)); end return tmp end
function tmp_2 = code(x, y, z) t_0 = (x + 1.0) - (z * sin(y)); tmp = 0.0; if (z <= -2.4e-12) tmp = t_0; elseif (z <= -2.8e-49) tmp = cos(y); elseif ((z <= -1.22e-90) || ~((z <= 7.2e-148))) tmp = t_0; else tmp = (x + cos(y)) - (y * z); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(x + 1.0), $MachinePrecision] - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -2.4e-12], t$95$0, If[LessEqual[z, -2.8e-49], N[Cos[y], $MachinePrecision], If[Or[LessEqual[z, -1.22e-90], N[Not[LessEqual[z, 7.2e-148]], $MachinePrecision]], t$95$0, N[(N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision] - N[(y * z), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(x + 1\right) - z \cdot \sin y\\
\mathbf{if}\;z \leq -2.4 \cdot 10^{-12}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq -2.8 \cdot 10^{-49}:\\
\;\;\;\;\cos y\\
\mathbf{elif}\;z \leq -1.22 \cdot 10^{-90} \lor \neg \left(z \leq 7.2 \cdot 10^{-148}\right):\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\left(x + \cos y\right) - y \cdot z\\
\end{array}
\end{array}
if z < -2.39999999999999987e-12 or -2.79999999999999997e-49 < z < -1.2199999999999999e-90 or 7.1999999999999997e-148 < z Initial program 99.9%
Taylor expanded in y around 0 95.2%
+-commutative95.2%
Simplified95.2%
if -2.39999999999999987e-12 < z < -2.79999999999999997e-49Initial program 100.0%
Taylor expanded in x around 0 100.0%
Taylor expanded in z around 0 100.0%
if -1.2199999999999999e-90 < z < 7.1999999999999997e-148Initial program 100.0%
Taylor expanded in y around 0 88.5%
Final simplification93.4%
(FPCore (x y z)
:precision binary64
(if (<= x -1.0)
x
(if (<= x 1.5e-72)
(cos y)
(if (<= x 35000000000000.0) (* (sin y) (- z)) x))))
double code(double x, double y, double z) {
double tmp;
if (x <= -1.0) {
tmp = x;
} else if (x <= 1.5e-72) {
tmp = cos(y);
} else if (x <= 35000000000000.0) {
tmp = sin(y) * -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 (x <= (-1.0d0)) then
tmp = x
else if (x <= 1.5d-72) then
tmp = cos(y)
else if (x <= 35000000000000.0d0) then
tmp = sin(y) * -z
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -1.0) {
tmp = x;
} else if (x <= 1.5e-72) {
tmp = Math.cos(y);
} else if (x <= 35000000000000.0) {
tmp = Math.sin(y) * -z;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -1.0: tmp = x elif x <= 1.5e-72: tmp = math.cos(y) elif x <= 35000000000000.0: tmp = math.sin(y) * -z else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -1.0) tmp = x; elseif (x <= 1.5e-72) tmp = cos(y); elseif (x <= 35000000000000.0) tmp = Float64(sin(y) * Float64(-z)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -1.0) tmp = x; elseif (x <= 1.5e-72) tmp = cos(y); elseif (x <= 35000000000000.0) tmp = sin(y) * -z; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -1.0], x, If[LessEqual[x, 1.5e-72], N[Cos[y], $MachinePrecision], If[LessEqual[x, 35000000000000.0], N[(N[Sin[y], $MachinePrecision] * (-z)), $MachinePrecision], x]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 1.5 \cdot 10^{-72}:\\
\;\;\;\;\cos y\\
\mathbf{elif}\;x \leq 35000000000000:\\
\;\;\;\;\sin y \cdot \left(-z\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -1 or 3.5e13 < x Initial program 100.0%
Taylor expanded in x around inf 98.1%
Taylor expanded in x around inf 89.4%
if -1 < x < 1.5e-72Initial program 99.9%
Taylor expanded in x around 0 97.5%
Taylor expanded in z around 0 71.4%
if 1.5e-72 < x < 3.5e13Initial program 99.8%
Taylor expanded in x around inf 63.5%
Taylor expanded in x around 0 60.3%
associate-*r*60.3%
neg-mul-160.3%
Simplified60.3%
Final simplification80.3%
(FPCore (x y z) :precision binary64 (if (or (<= y -0.0028) (not (<= y 1e+35))) (- x (* z (sin y))) (- (+ 1.0 (+ x (* -0.5 (* y y)))) (* y z))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -0.0028) || !(y <= 1e+35)) {
tmp = x - (z * sin(y));
} else {
tmp = (1.0 + (x + (-0.5 * (y * y)))) - (y * z);
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((y <= (-0.0028d0)) .or. (.not. (y <= 1d+35))) then
tmp = x - (z * sin(y))
else
tmp = (1.0d0 + (x + ((-0.5d0) * (y * y)))) - (y * z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -0.0028) || !(y <= 1e+35)) {
tmp = x - (z * Math.sin(y));
} else {
tmp = (1.0 + (x + (-0.5 * (y * y)))) - (y * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -0.0028) or not (y <= 1e+35): tmp = x - (z * math.sin(y)) else: tmp = (1.0 + (x + (-0.5 * (y * y)))) - (y * z) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -0.0028) || !(y <= 1e+35)) tmp = Float64(x - Float64(z * sin(y))); else tmp = Float64(Float64(1.0 + Float64(x + Float64(-0.5 * Float64(y * y)))) - Float64(y * z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -0.0028) || ~((y <= 1e+35))) tmp = x - (z * sin(y)); else tmp = (1.0 + (x + (-0.5 * (y * y)))) - (y * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -0.0028], N[Not[LessEqual[y, 1e+35]], $MachinePrecision]], N[(x - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(x + N[(-0.5 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(y * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -0.0028 \lor \neg \left(y \leq 10^{+35}\right):\\
\;\;\;\;x - z \cdot \sin y\\
\mathbf{else}:\\
\;\;\;\;\left(1 + \left(x + -0.5 \cdot \left(y \cdot y\right)\right)\right) - y \cdot z\\
\end{array}
\end{array}
if y < -0.00279999999999999997 or 9.9999999999999997e34 < y Initial program 99.9%
Taylor expanded in x around inf 71.2%
if -0.00279999999999999997 < y < 9.9999999999999997e34Initial program 100.0%
Taylor expanded in y around 0 98.1%
unpow298.1%
Simplified98.1%
Taylor expanded in y around 0 97.9%
Final simplification86.9%
(FPCore (x y z) :precision binary64 (- (+ x 1.0) (* z (sin y))))
double code(double x, double y, double z) {
return (x + 1.0) - (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 + 1.0d0) - (z * sin(y))
end function
public static double code(double x, double y, double z) {
return (x + 1.0) - (z * Math.sin(y));
}
def code(x, y, z): return (x + 1.0) - (z * math.sin(y))
function code(x, y, z) return Float64(Float64(x + 1.0) - Float64(z * sin(y))) end
function tmp = code(x, y, z) tmp = (x + 1.0) - (z * sin(y)); end
code[x_, y_, z_] := N[(N[(x + 1.0), $MachinePrecision] - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x + 1\right) - z \cdot \sin y
\end{array}
Initial program 100.0%
Taylor expanded in y around 0 87.1%
+-commutative87.1%
Simplified87.1%
Final simplification87.1%
(FPCore (x y z) :precision binary64 (if (<= x -1.0) x (if (<= x 0.92) (cos y) x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -1.0) {
tmp = x;
} else if (x <= 0.92) {
tmp = cos(y);
} 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.0d0)) then
tmp = x
else if (x <= 0.92d0) then
tmp = cos(y)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -1.0) {
tmp = x;
} else if (x <= 0.92) {
tmp = Math.cos(y);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -1.0: tmp = x elif x <= 0.92: tmp = math.cos(y) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -1.0) tmp = x; elseif (x <= 0.92) tmp = cos(y); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -1.0) tmp = x; elseif (x <= 0.92) tmp = cos(y); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -1.0], x, If[LessEqual[x, 0.92], N[Cos[y], $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 0.92:\\
\;\;\;\;\cos y\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -1 or 0.92000000000000004 < x Initial program 100.0%
Taylor expanded in x around inf 97.7%
Taylor expanded in x around inf 88.4%
if -1 < x < 0.92000000000000004Initial program 99.9%
Taylor expanded in x around 0 97.3%
Taylor expanded in z around 0 67.0%
Final simplification78.6%
(FPCore (x y z) :precision binary64 (if (<= y -2.75e+41) x (if (<= y 1e+35) (- (+ 1.0 (+ x (* -0.5 (* y y)))) (* y z)) x)))
double code(double x, double y, double z) {
double tmp;
if (y <= -2.75e+41) {
tmp = x;
} else if (y <= 1e+35) {
tmp = (1.0 + (x + (-0.5 * (y * y)))) - (y * 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 (y <= (-2.75d+41)) then
tmp = x
else if (y <= 1d+35) then
tmp = (1.0d0 + (x + ((-0.5d0) * (y * y)))) - (y * z)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -2.75e+41) {
tmp = x;
} else if (y <= 1e+35) {
tmp = (1.0 + (x + (-0.5 * (y * y)))) - (y * z);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -2.75e+41: tmp = x elif y <= 1e+35: tmp = (1.0 + (x + (-0.5 * (y * y)))) - (y * z) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (y <= -2.75e+41) tmp = x; elseif (y <= 1e+35) tmp = Float64(Float64(1.0 + Float64(x + Float64(-0.5 * Float64(y * y)))) - Float64(y * z)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -2.75e+41) tmp = x; elseif (y <= 1e+35) tmp = (1.0 + (x + (-0.5 * (y * y)))) - (y * z); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -2.75e+41], x, If[LessEqual[y, 1e+35], N[(N[(1.0 + N[(x + N[(-0.5 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(y * z), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.75 \cdot 10^{+41}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 10^{+35}:\\
\;\;\;\;\left(1 + \left(x + -0.5 \cdot \left(y \cdot y\right)\right)\right) - y \cdot z\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -2.7500000000000002e41 or 9.9999999999999997e34 < y Initial program 99.9%
Taylor expanded in x around inf 69.7%
Taylor expanded in x around inf 41.7%
if -2.7500000000000002e41 < y < 9.9999999999999997e34Initial program 100.0%
Taylor expanded in y around 0 97.5%
unpow297.5%
Simplified97.5%
Taylor expanded in y around 0 96.8%
Final simplification75.1%
(FPCore (x y z) :precision binary64 (if (<= y -6.5e+76) x (if (<= y 8.5e-6) (- (+ x 1.0) (* y z)) x)))
double code(double x, double y, double z) {
double tmp;
if (y <= -6.5e+76) {
tmp = x;
} else if (y <= 8.5e-6) {
tmp = (x + 1.0) - (y * 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 (y <= (-6.5d+76)) then
tmp = x
else if (y <= 8.5d-6) then
tmp = (x + 1.0d0) - (y * z)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -6.5e+76) {
tmp = x;
} else if (y <= 8.5e-6) {
tmp = (x + 1.0) - (y * z);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -6.5e+76: tmp = x elif y <= 8.5e-6: tmp = (x + 1.0) - (y * z) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (y <= -6.5e+76) tmp = x; elseif (y <= 8.5e-6) tmp = Float64(Float64(x + 1.0) - Float64(y * z)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -6.5e+76) tmp = x; elseif (y <= 8.5e-6) tmp = (x + 1.0) - (y * z); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -6.5e+76], x, If[LessEqual[y, 8.5e-6], N[(N[(x + 1.0), $MachinePrecision] - N[(y * z), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -6.5 \cdot 10^{+76}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 8.5 \cdot 10^{-6}:\\
\;\;\;\;\left(x + 1\right) - y \cdot z\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -6.5000000000000005e76 or 8.4999999999999999e-6 < y Initial program 99.9%
Taylor expanded in x around inf 68.8%
Taylor expanded in x around inf 42.8%
if -6.5000000000000005e76 < y < 8.4999999999999999e-6Initial program 100.0%
Taylor expanded in y around 0 99.1%
+-commutative99.1%
Simplified99.1%
Taylor expanded in y around 0 97.2%
Final simplification74.9%
(FPCore (x y z) :precision binary64 (if (<= x -16.0) x (if (<= x 35000000000000.0) (- 1.0 (* y z)) x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -16.0) {
tmp = x;
} else if (x <= 35000000000000.0) {
tmp = 1.0 - (y * 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 (x <= (-16.0d0)) then
tmp = x
else if (x <= 35000000000000.0d0) then
tmp = 1.0d0 - (y * z)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -16.0) {
tmp = x;
} else if (x <= 35000000000000.0) {
tmp = 1.0 - (y * z);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -16.0: tmp = x elif x <= 35000000000000.0: tmp = 1.0 - (y * z) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -16.0) tmp = x; elseif (x <= 35000000000000.0) tmp = Float64(1.0 - Float64(y * z)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -16.0) tmp = x; elseif (x <= 35000000000000.0) tmp = 1.0 - (y * z); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -16.0], x, If[LessEqual[x, 35000000000000.0], N[(1.0 - N[(y * z), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -16:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 35000000000000:\\
\;\;\;\;1 - y \cdot z\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -16 or 3.5e13 < x Initial program 100.0%
Taylor expanded in x around inf 98.1%
Taylor expanded in x around inf 89.4%
if -16 < x < 3.5e13Initial program 99.9%
Taylor expanded in x around 0 96.6%
Taylor expanded in y around 0 51.5%
+-commutative51.5%
mul-1-neg51.5%
*-commutative51.5%
Simplified51.5%
Final simplification71.7%
(FPCore (x y z) :precision binary64 (if (<= x -0.98) x (if (<= x 1.2) 1.0 x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -0.98) {
tmp = x;
} else if (x <= 1.2) {
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 <= (-0.98d0)) then
tmp = x
else if (x <= 1.2d0) 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 <= -0.98) {
tmp = x;
} else if (x <= 1.2) {
tmp = 1.0;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -0.98: tmp = x elif x <= 1.2: tmp = 1.0 else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -0.98) tmp = x; elseif (x <= 1.2) tmp = 1.0; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -0.98) tmp = x; elseif (x <= 1.2) tmp = 1.0; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -0.98], x, If[LessEqual[x, 1.2], 1.0, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.98:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 1.2:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -0.97999999999999998 or 1.19999999999999996 < x Initial program 100.0%
Taylor expanded in x around inf 97.7%
Taylor expanded in x around inf 88.4%
if -0.97999999999999998 < x < 1.19999999999999996Initial program 99.9%
Taylor expanded in x around 0 97.3%
Taylor expanded in y around 0 41.9%
Final simplification67.1%
(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 100.0%
Taylor expanded in x around 0 51.1%
Taylor expanded in y around 0 20.6%
Final simplification20.6%
herbie shell --seed 2023293
(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))))