
(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%
Final simplification99.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (sin y))))
(if (or (<= x -2.5e-9) (not (<= x 1.52e-16)))
(- (+ 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 <= -2.5e-9) || !(x <= 1.52e-16)) {
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 <= (-2.5d-9)) .or. (.not. (x <= 1.52d-16))) 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 <= -2.5e-9) || !(x <= 1.52e-16)) {
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 <= -2.5e-9) or not (x <= 1.52e-16): 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 <= -2.5e-9) || !(x <= 1.52e-16)) 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 <= -2.5e-9) || ~((x <= 1.52e-16))) 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, -2.5e-9], N[Not[LessEqual[x, 1.52e-16]], $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 -2.5 \cdot 10^{-9} \lor \neg \left(x \leq 1.52 \cdot 10^{-16}\right):\\
\;\;\;\;\left(x + 1\right) - t\_0\\
\mathbf{else}:\\
\;\;\;\;\cos y - t\_0\\
\end{array}
\end{array}
if x < -2.5000000000000001e-9 or 1.52e-16 < x Initial program 99.9%
Taylor expanded in y around 0 97.9%
+-commutative97.9%
Simplified97.9%
if -2.5000000000000001e-9 < x < 1.52e-16Initial program 99.9%
Taylor expanded in x around 0 99.8%
Final simplification98.8%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (sin y) (- z))))
(if (<= y -4.4e+264)
(+ x 1.0)
(if (<= y -5e+101)
t_0
(if (<= y -3.3e-5)
(+ x 1.0)
(if (<= y 2e+63) (- (+ x 1.0) (* y z)) t_0))))))
double code(double x, double y, double z) {
double t_0 = sin(y) * -z;
double tmp;
if (y <= -4.4e+264) {
tmp = x + 1.0;
} else if (y <= -5e+101) {
tmp = t_0;
} else if (y <= -3.3e-5) {
tmp = x + 1.0;
} else if (y <= 2e+63) {
tmp = (x + 1.0) - (y * 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 = sin(y) * -z
if (y <= (-4.4d+264)) then
tmp = x + 1.0d0
else if (y <= (-5d+101)) then
tmp = t_0
else if (y <= (-3.3d-5)) then
tmp = x + 1.0d0
else if (y <= 2d+63) then
tmp = (x + 1.0d0) - (y * z)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = Math.sin(y) * -z;
double tmp;
if (y <= -4.4e+264) {
tmp = x + 1.0;
} else if (y <= -5e+101) {
tmp = t_0;
} else if (y <= -3.3e-5) {
tmp = x + 1.0;
} else if (y <= 2e+63) {
tmp = (x + 1.0) - (y * z);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = math.sin(y) * -z tmp = 0 if y <= -4.4e+264: tmp = x + 1.0 elif y <= -5e+101: tmp = t_0 elif y <= -3.3e-5: tmp = x + 1.0 elif y <= 2e+63: tmp = (x + 1.0) - (y * z) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(sin(y) * Float64(-z)) tmp = 0.0 if (y <= -4.4e+264) tmp = Float64(x + 1.0); elseif (y <= -5e+101) tmp = t_0; elseif (y <= -3.3e-5) tmp = Float64(x + 1.0); elseif (y <= 2e+63) tmp = Float64(Float64(x + 1.0) - Float64(y * z)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = sin(y) * -z; tmp = 0.0; if (y <= -4.4e+264) tmp = x + 1.0; elseif (y <= -5e+101) tmp = t_0; elseif (y <= -3.3e-5) tmp = x + 1.0; elseif (y <= 2e+63) tmp = (x + 1.0) - (y * z); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[Sin[y], $MachinePrecision] * (-z)), $MachinePrecision]}, If[LessEqual[y, -4.4e+264], N[(x + 1.0), $MachinePrecision], If[LessEqual[y, -5e+101], t$95$0, If[LessEqual[y, -3.3e-5], N[(x + 1.0), $MachinePrecision], If[LessEqual[y, 2e+63], N[(N[(x + 1.0), $MachinePrecision] - N[(y * z), $MachinePrecision]), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin y \cdot \left(-z\right)\\
\mathbf{if}\;y \leq -4.4 \cdot 10^{+264}:\\
\;\;\;\;x + 1\\
\mathbf{elif}\;y \leq -5 \cdot 10^{+101}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq -3.3 \cdot 10^{-5}:\\
\;\;\;\;x + 1\\
\mathbf{elif}\;y \leq 2 \cdot 10^{+63}:\\
\;\;\;\;\left(x + 1\right) - y \cdot z\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -4.4e264 or -4.99999999999999989e101 < y < -3.3000000000000003e-5Initial program 99.9%
Taylor expanded in y around 0 78.7%
+-commutative78.7%
Simplified78.7%
Taylor expanded in z around 0 62.6%
if -4.4e264 < y < -4.99999999999999989e101 or 2.00000000000000012e63 < y Initial program 99.8%
Taylor expanded in y around 0 72.2%
+-commutative72.2%
Simplified72.2%
Taylor expanded in z around inf 49.1%
associate-*r*49.1%
neg-mul-149.1%
*-commutative49.1%
Simplified49.1%
if -3.3000000000000003e-5 < y < 2.00000000000000012e63Initial program 100.0%
Taylor expanded in y around 0 96.5%
Taylor expanded in y around 0 94.7%
+-commutative98.2%
Simplified94.7%
Final simplification74.5%
(FPCore (x y z) :precision binary64 (if (or (<= z -1.2e-103) (not (<= z 3.2e-171))) (- (+ x 1.0) (* z (sin y))) (- (+ x (cos y)) (* y z))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.2e-103) || !(z <= 3.2e-171)) {
tmp = (x + 1.0) - (z * sin(y));
} 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) :: tmp
if ((z <= (-1.2d-103)) .or. (.not. (z <= 3.2d-171))) then
tmp = (x + 1.0d0) - (z * sin(y))
else
tmp = (x + cos(y)) - (y * z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -1.2e-103) || !(z <= 3.2e-171)) {
tmp = (x + 1.0) - (z * Math.sin(y));
} else {
tmp = (x + Math.cos(y)) - (y * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -1.2e-103) or not (z <= 3.2e-171): tmp = (x + 1.0) - (z * math.sin(y)) else: tmp = (x + math.cos(y)) - (y * z) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -1.2e-103) || !(z <= 3.2e-171)) tmp = Float64(Float64(x + 1.0) - Float64(z * sin(y))); else tmp = Float64(Float64(x + cos(y)) - Float64(y * z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -1.2e-103) || ~((z <= 3.2e-171))) tmp = (x + 1.0) - (z * sin(y)); else tmp = (x + cos(y)) - (y * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -1.2e-103], N[Not[LessEqual[z, 3.2e-171]], $MachinePrecision]], N[(N[(x + 1.0), $MachinePrecision] - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision] - N[(y * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.2 \cdot 10^{-103} \lor \neg \left(z \leq 3.2 \cdot 10^{-171}\right):\\
\;\;\;\;\left(x + 1\right) - z \cdot \sin y\\
\mathbf{else}:\\
\;\;\;\;\left(x + \cos y\right) - y \cdot z\\
\end{array}
\end{array}
if z < -1.2000000000000001e-103 or 3.2000000000000001e-171 < z Initial program 99.9%
Taylor expanded in y around 0 92.6%
+-commutative92.6%
Simplified92.6%
if -1.2000000000000001e-103 < z < 3.2000000000000001e-171Initial program 100.0%
Taylor expanded in y around 0 86.2%
Final simplification90.9%
(FPCore (x y z) :precision binary64 (let* ((t_0 (* z (sin y)))) (if (or (<= x -1.2) (not (<= x 1.1))) (- x t_0) (- 1.0 t_0))))
double code(double x, double y, double z) {
double t_0 = z * sin(y);
double tmp;
if ((x <= -1.2) || !(x <= 1.1)) {
tmp = x - t_0;
} else {
tmp = 1.0 - 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.2d0)) .or. (.not. (x <= 1.1d0))) then
tmp = x - t_0
else
tmp = 1.0d0 - 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.2) || !(x <= 1.1)) {
tmp = x - t_0;
} else {
tmp = 1.0 - t_0;
}
return tmp;
}
def code(x, y, z): t_0 = z * math.sin(y) tmp = 0 if (x <= -1.2) or not (x <= 1.1): tmp = x - t_0 else: tmp = 1.0 - t_0 return tmp
function code(x, y, z) t_0 = Float64(z * sin(y)) tmp = 0.0 if ((x <= -1.2) || !(x <= 1.1)) tmp = Float64(x - t_0); else tmp = Float64(1.0 - t_0); end return tmp end
function tmp_2 = code(x, y, z) t_0 = z * sin(y); tmp = 0.0; if ((x <= -1.2) || ~((x <= 1.1))) tmp = x - t_0; else tmp = 1.0 - 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.2], N[Not[LessEqual[x, 1.1]], $MachinePrecision]], N[(x - t$95$0), $MachinePrecision], N[(1.0 - t$95$0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \sin y\\
\mathbf{if}\;x \leq -1.2 \lor \neg \left(x \leq 1.1\right):\\
\;\;\;\;x - t\_0\\
\mathbf{else}:\\
\;\;\;\;1 - t\_0\\
\end{array}
\end{array}
if x < -1.19999999999999996 or 1.1000000000000001 < x Initial program 100.0%
Taylor expanded in x around inf 98.4%
if -1.19999999999999996 < x < 1.1000000000000001Initial program 99.9%
Taylor expanded in y around 0 72.9%
+-commutative72.9%
Simplified72.9%
Taylor expanded in x around 0 71.5%
*-commutative71.5%
Simplified71.5%
Final simplification85.6%
(FPCore (x y z) :precision binary64 (if (<= x -50000000000000.0) x (if (<= x 6e-23) (- 1.0 (* z (sin y))) (+ x 1.0))))
double code(double x, double y, double z) {
double tmp;
if (x <= -50000000000000.0) {
tmp = x;
} else if (x <= 6e-23) {
tmp = 1.0 - (z * sin(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 <= (-50000000000000.0d0)) then
tmp = x
else if (x <= 6d-23) then
tmp = 1.0d0 - (z * sin(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 <= -50000000000000.0) {
tmp = x;
} else if (x <= 6e-23) {
tmp = 1.0 - (z * Math.sin(y));
} else {
tmp = x + 1.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -50000000000000.0: tmp = x elif x <= 6e-23: tmp = 1.0 - (z * math.sin(y)) else: tmp = x + 1.0 return tmp
function code(x, y, z) tmp = 0.0 if (x <= -50000000000000.0) tmp = x; elseif (x <= 6e-23) tmp = Float64(1.0 - Float64(z * sin(y))); else tmp = Float64(x + 1.0); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -50000000000000.0) tmp = x; elseif (x <= 6e-23) tmp = 1.0 - (z * sin(y)); else tmp = x + 1.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -50000000000000.0], x, If[LessEqual[x, 6e-23], N[(1.0 - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + 1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -50000000000000:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 6 \cdot 10^{-23}:\\
\;\;\;\;1 - z \cdot \sin y\\
\mathbf{else}:\\
\;\;\;\;x + 1\\
\end{array}
\end{array}
if x < -5e13Initial program 99.9%
Taylor expanded in y around 0 99.9%
+-commutative99.9%
Simplified99.9%
Taylor expanded in x around inf 84.5%
if -5e13 < x < 6.00000000000000006e-23Initial program 99.9%
Taylor expanded in y around 0 73.2%
+-commutative73.2%
Simplified73.2%
Taylor expanded in x around 0 72.2%
*-commutative72.2%
Simplified72.2%
if 6.00000000000000006e-23 < x Initial program 100.0%
Taylor expanded in y around 0 97.1%
+-commutative97.1%
Simplified97.1%
Taylor expanded in z around 0 75.0%
Final simplification76.1%
(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 99.9%
Taylor expanded in y around 0 86.5%
+-commutative86.5%
Simplified86.5%
Final simplification86.5%
(FPCore (x y z) :precision binary64 (if (or (<= y -11800.0) (not (<= y 0.59))) (+ x 1.0) (+ 1.0 (+ x (* y (- (* y -0.5) z))))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -11800.0) || !(y <= 0.59)) {
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 <= (-11800.0d0)) .or. (.not. (y <= 0.59d0))) 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 <= -11800.0) || !(y <= 0.59)) {
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 <= -11800.0) or not (y <= 0.59): 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 <= -11800.0) || !(y <= 0.59)) 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 <= -11800.0) || ~((y <= 0.59))) 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, -11800.0], N[Not[LessEqual[y, 0.59]], $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 -11800 \lor \neg \left(y \leq 0.59\right):\\
\;\;\;\;x + 1\\
\mathbf{else}:\\
\;\;\;\;1 + \left(x + y \cdot \left(y \cdot -0.5 - z\right)\right)\\
\end{array}
\end{array}
if y < -11800 or 0.589999999999999969 < y Initial program 99.8%
Taylor expanded in y around 0 75.5%
+-commutative75.5%
Simplified75.5%
Taylor expanded in z around 0 38.8%
if -11800 < y < 0.589999999999999969Initial program 100.0%
Taylor expanded in y around 0 99.5%
Taylor expanded in y around 0 99.5%
*-commutative99.5%
Simplified99.5%
Taylor expanded in y around 0 99.5%
Final simplification66.5%
(FPCore (x y z) :precision binary64 (if (or (<= y -3.3e-5) (not (<= y 2.9e+104))) (+ x 1.0) (- (+ x 1.0) (* y z))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -3.3e-5) || !(y <= 2.9e+104)) {
tmp = x + 1.0;
} else {
tmp = (x + 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 ((y <= (-3.3d-5)) .or. (.not. (y <= 2.9d+104))) then
tmp = x + 1.0d0
else
tmp = (x + 1.0d0) - (y * z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -3.3e-5) || !(y <= 2.9e+104)) {
tmp = x + 1.0;
} else {
tmp = (x + 1.0) - (y * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -3.3e-5) or not (y <= 2.9e+104): tmp = x + 1.0 else: tmp = (x + 1.0) - (y * z) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -3.3e-5) || !(y <= 2.9e+104)) tmp = Float64(x + 1.0); else tmp = Float64(Float64(x + 1.0) - Float64(y * z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -3.3e-5) || ~((y <= 2.9e+104))) tmp = x + 1.0; else tmp = (x + 1.0) - (y * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -3.3e-5], N[Not[LessEqual[y, 2.9e+104]], $MachinePrecision]], N[(x + 1.0), $MachinePrecision], N[(N[(x + 1.0), $MachinePrecision] - N[(y * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.3 \cdot 10^{-5} \lor \neg \left(y \leq 2.9 \cdot 10^{+104}\right):\\
\;\;\;\;x + 1\\
\mathbf{else}:\\
\;\;\;\;\left(x + 1\right) - y \cdot z\\
\end{array}
\end{array}
if y < -3.3000000000000003e-5 or 2.8999999999999998e104 < y Initial program 99.9%
Taylor expanded in y around 0 73.7%
+-commutative73.7%
Simplified73.7%
Taylor expanded in z around 0 38.1%
if -3.3000000000000003e-5 < y < 2.8999999999999998e104Initial program 99.9%
Taylor expanded in y around 0 91.4%
Taylor expanded in y around 0 88.7%
+-commutative96.6%
Simplified88.7%
Final simplification66.4%
(FPCore (x y z) :precision binary64 (if (or (<= z -5.6e+184) (not (<= z 4.7e+142))) (- x (* y z)) (+ x 1.0)))
double code(double x, double y, double z) {
double tmp;
if ((z <= -5.6e+184) || !(z <= 4.7e+142)) {
tmp = x - (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 <= (-5.6d+184)) .or. (.not. (z <= 4.7d+142))) then
tmp = x - (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 <= -5.6e+184) || !(z <= 4.7e+142)) {
tmp = x - (y * z);
} else {
tmp = x + 1.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -5.6e+184) or not (z <= 4.7e+142): tmp = x - (y * z) else: tmp = x + 1.0 return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -5.6e+184) || !(z <= 4.7e+142)) tmp = Float64(x - 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 <= -5.6e+184) || ~((z <= 4.7e+142))) tmp = x - (y * z); else tmp = x + 1.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -5.6e+184], N[Not[LessEqual[z, 4.7e+142]], $MachinePrecision]], N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision], N[(x + 1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.6 \cdot 10^{+184} \lor \neg \left(z \leq 4.7 \cdot 10^{+142}\right):\\
\;\;\;\;x - y \cdot z\\
\mathbf{else}:\\
\;\;\;\;x + 1\\
\end{array}
\end{array}
if z < -5.5999999999999998e184 or 4.7e142 < z Initial program 99.8%
Taylor expanded in x around inf 95.0%
Taylor expanded in y around 0 46.8%
if -5.5999999999999998e184 < z < 4.7e142Initial program 99.9%
Taylor expanded in y around 0 82.5%
+-commutative82.5%
Simplified82.5%
Taylor expanded in z around 0 66.9%
Final simplification62.2%
(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 86.5%
+-commutative86.5%
Simplified86.5%
Taylor expanded in z around 0 57.9%
Final simplification57.9%
(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 99.9%
Taylor expanded in y around 0 86.5%
+-commutative86.5%
Simplified86.5%
Taylor expanded in x around inf 42.5%
Final simplification42.5%
herbie shell --seed 2024078
(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))))