
(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 (fma (sin y) (- z) (+ x (cos y))))
double code(double x, double y, double z) {
return fma(sin(y), -z, (x + cos(y)));
}
function code(x, y, z) return fma(sin(y), Float64(-z), Float64(x + cos(y))) end
code[x_, y_, z_] := N[(N[Sin[y], $MachinePrecision] * (-z) + N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\sin y, -z, x + \cos y\right)
\end{array}
Initial program 99.9%
sub-neg99.9%
+-commutative99.9%
*-commutative99.9%
distribute-rgt-neg-in99.9%
fma-def99.9%
Applied egg-rr99.9%
Final simplification99.9%
(FPCore (x y z) :precision binary64 (if (<= z -3.1) (fma (sin y) (- z) (+ x 1.0)) (if (<= z 3.5e-16) (+ x (cos y)) (- (+ x 1.0) (* (sin y) z)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -3.1) {
tmp = fma(sin(y), -z, (x + 1.0));
} else if (z <= 3.5e-16) {
tmp = x + cos(y);
} else {
tmp = (x + 1.0) - (sin(y) * z);
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (z <= -3.1) tmp = fma(sin(y), Float64(-z), Float64(x + 1.0)); elseif (z <= 3.5e-16) tmp = Float64(x + cos(y)); else tmp = Float64(Float64(x + 1.0) - Float64(sin(y) * z)); end return tmp end
code[x_, y_, z_] := If[LessEqual[z, -3.1], N[(N[Sin[y], $MachinePrecision] * (-z) + N[(x + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.5e-16], N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision], N[(N[(x + 1.0), $MachinePrecision] - N[(N[Sin[y], $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.1:\\
\;\;\;\;\mathsf{fma}\left(\sin y, -z, x + 1\right)\\
\mathbf{elif}\;z \leq 3.5 \cdot 10^{-16}:\\
\;\;\;\;x + \cos y\\
\mathbf{else}:\\
\;\;\;\;\left(x + 1\right) - \sin y \cdot z\\
\end{array}
\end{array}
if z < -3.10000000000000009Initial program 99.8%
sub-neg99.8%
+-commutative99.8%
*-commutative99.8%
distribute-rgt-neg-in99.8%
fma-def99.8%
Applied egg-rr99.8%
Taylor expanded in y around 0 99.7%
if -3.10000000000000009 < z < 3.50000000000000017e-16Initial program 100.0%
Taylor expanded in z around 0 99.2%
+-commutative99.2%
Simplified99.2%
if 3.50000000000000017e-16 < z Initial program 99.8%
add-sqr-sqrt54.8%
pow254.8%
Applied egg-rr54.8%
Taylor expanded in y around 0 54.0%
unpow254.0%
add-sqr-sqrt99.1%
*-commutative99.1%
Applied egg-rr99.1%
Final simplification99.3%
(FPCore (x y z) :precision binary64 (- (+ x (cos y)) (* (sin y) z)))
double code(double x, double y, double z) {
return (x + cos(y)) - (sin(y) * z);
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (x + cos(y)) - (sin(y) * z)
end function
public static double code(double x, double y, double z) {
return (x + Math.cos(y)) - (Math.sin(y) * z);
}
def code(x, y, z): return (x + math.cos(y)) - (math.sin(y) * z)
function code(x, y, z) return Float64(Float64(x + cos(y)) - Float64(sin(y) * z)) end
function tmp = code(x, y, z) tmp = (x + cos(y)) - (sin(y) * z); end
code[x_, y_, z_] := N[(N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision] - N[(N[Sin[y], $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x + \cos y\right) - \sin y \cdot z
\end{array}
Initial program 99.9%
Final simplification99.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (- 1.0 (* (sin y) z))))
(if (<= z -1.1e+227)
t_0
(if (<= z -5.9e+175)
(+ 1.0 (- x (* y z)))
(if (or (<= z -1.05e+141) (not (<= z 1.12e+88))) t_0 (+ x (cos y)))))))
double code(double x, double y, double z) {
double t_0 = 1.0 - (sin(y) * z);
double tmp;
if (z <= -1.1e+227) {
tmp = t_0;
} else if (z <= -5.9e+175) {
tmp = 1.0 + (x - (y * z));
} else if ((z <= -1.05e+141) || !(z <= 1.12e+88)) {
tmp = t_0;
} 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) :: t_0
real(8) :: tmp
t_0 = 1.0d0 - (sin(y) * z)
if (z <= (-1.1d+227)) then
tmp = t_0
else if (z <= (-5.9d+175)) then
tmp = 1.0d0 + (x - (y * z))
else if ((z <= (-1.05d+141)) .or. (.not. (z <= 1.12d+88))) then
tmp = t_0
else
tmp = x + cos(y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = 1.0 - (Math.sin(y) * z);
double tmp;
if (z <= -1.1e+227) {
tmp = t_0;
} else if (z <= -5.9e+175) {
tmp = 1.0 + (x - (y * z));
} else if ((z <= -1.05e+141) || !(z <= 1.12e+88)) {
tmp = t_0;
} else {
tmp = x + Math.cos(y);
}
return tmp;
}
def code(x, y, z): t_0 = 1.0 - (math.sin(y) * z) tmp = 0 if z <= -1.1e+227: tmp = t_0 elif z <= -5.9e+175: tmp = 1.0 + (x - (y * z)) elif (z <= -1.05e+141) or not (z <= 1.12e+88): tmp = t_0 else: tmp = x + math.cos(y) return tmp
function code(x, y, z) t_0 = Float64(1.0 - Float64(sin(y) * z)) tmp = 0.0 if (z <= -1.1e+227) tmp = t_0; elseif (z <= -5.9e+175) tmp = Float64(1.0 + Float64(x - Float64(y * z))); elseif ((z <= -1.05e+141) || !(z <= 1.12e+88)) tmp = t_0; else tmp = Float64(x + cos(y)); end return tmp end
function tmp_2 = code(x, y, z) t_0 = 1.0 - (sin(y) * z); tmp = 0.0; if (z <= -1.1e+227) tmp = t_0; elseif (z <= -5.9e+175) tmp = 1.0 + (x - (y * z)); elseif ((z <= -1.05e+141) || ~((z <= 1.12e+88))) tmp = t_0; else tmp = x + cos(y); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(1.0 - N[(N[Sin[y], $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.1e+227], t$95$0, If[LessEqual[z, -5.9e+175], N[(1.0 + N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[z, -1.05e+141], N[Not[LessEqual[z, 1.12e+88]], $MachinePrecision]], t$95$0, N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 - \sin y \cdot z\\
\mathbf{if}\;z \leq -1.1 \cdot 10^{+227}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -5.9 \cdot 10^{+175}:\\
\;\;\;\;1 + \left(x - y \cdot z\right)\\
\mathbf{elif}\;z \leq -1.05 \cdot 10^{+141} \lor \neg \left(z \leq 1.12 \cdot 10^{+88}\right):\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;x + \cos y\\
\end{array}
\end{array}
if z < -1.1000000000000001e227 or -5.9000000000000003e175 < z < -1.0499999999999999e141 or 1.12000000000000006e88 < z Initial program 99.8%
sub-neg99.8%
+-commutative99.8%
distribute-lft-neg-in99.8%
add-sqr-sqrt56.0%
associate-*r*56.1%
fma-def56.1%
Applied egg-rr56.1%
Taylor expanded in y around 0 56.1%
Taylor expanded in x around 0 82.4%
mul-1-neg82.4%
*-commutative82.4%
unsub-neg82.4%
*-commutative82.4%
Simplified82.4%
if -1.1000000000000001e227 < z < -5.9000000000000003e175Initial program 100.0%
Taylor expanded in y around 0 89.5%
mul-1-neg89.5%
unsub-neg89.5%
Simplified89.5%
if -1.0499999999999999e141 < z < 1.12000000000000006e88Initial program 100.0%
Taylor expanded in z around 0 92.6%
+-commutative92.6%
Simplified92.6%
Final simplification89.2%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (sin y) (- z))))
(if (<= z -8.2e+226)
t_0
(if (<= z -1.05e+185)
(+ 1.0 (- x (* y z)))
(if (or (<= z -3e+144) (not (<= z 1.42e+88))) t_0 (+ x (cos y)))))))
double code(double x, double y, double z) {
double t_0 = sin(y) * -z;
double tmp;
if (z <= -8.2e+226) {
tmp = t_0;
} else if (z <= -1.05e+185) {
tmp = 1.0 + (x - (y * z));
} else if ((z <= -3e+144) || !(z <= 1.42e+88)) {
tmp = t_0;
} 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) :: t_0
real(8) :: tmp
t_0 = sin(y) * -z
if (z <= (-8.2d+226)) then
tmp = t_0
else if (z <= (-1.05d+185)) then
tmp = 1.0d0 + (x - (y * z))
else if ((z <= (-3d+144)) .or. (.not. (z <= 1.42d+88))) then
tmp = t_0
else
tmp = x + cos(y)
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 (z <= -8.2e+226) {
tmp = t_0;
} else if (z <= -1.05e+185) {
tmp = 1.0 + (x - (y * z));
} else if ((z <= -3e+144) || !(z <= 1.42e+88)) {
tmp = t_0;
} else {
tmp = x + Math.cos(y);
}
return tmp;
}
def code(x, y, z): t_0 = math.sin(y) * -z tmp = 0 if z <= -8.2e+226: tmp = t_0 elif z <= -1.05e+185: tmp = 1.0 + (x - (y * z)) elif (z <= -3e+144) or not (z <= 1.42e+88): tmp = t_0 else: tmp = x + math.cos(y) return tmp
function code(x, y, z) t_0 = Float64(sin(y) * Float64(-z)) tmp = 0.0 if (z <= -8.2e+226) tmp = t_0; elseif (z <= -1.05e+185) tmp = Float64(1.0 + Float64(x - Float64(y * z))); elseif ((z <= -3e+144) || !(z <= 1.42e+88)) tmp = t_0; else tmp = Float64(x + cos(y)); end return tmp end
function tmp_2 = code(x, y, z) t_0 = sin(y) * -z; tmp = 0.0; if (z <= -8.2e+226) tmp = t_0; elseif (z <= -1.05e+185) tmp = 1.0 + (x - (y * z)); elseif ((z <= -3e+144) || ~((z <= 1.42e+88))) tmp = t_0; else tmp = x + cos(y); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[Sin[y], $MachinePrecision] * (-z)), $MachinePrecision]}, If[LessEqual[z, -8.2e+226], t$95$0, If[LessEqual[z, -1.05e+185], N[(1.0 + N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[z, -3e+144], N[Not[LessEqual[z, 1.42e+88]], $MachinePrecision]], t$95$0, N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin y \cdot \left(-z\right)\\
\mathbf{if}\;z \leq -8.2 \cdot 10^{+226}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -1.05 \cdot 10^{+185}:\\
\;\;\;\;1 + \left(x - y \cdot z\right)\\
\mathbf{elif}\;z \leq -3 \cdot 10^{+144} \lor \neg \left(z \leq 1.42 \cdot 10^{+88}\right):\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;x + \cos y\\
\end{array}
\end{array}
if z < -8.19999999999999971e226 or -1.05e185 < z < -2.9999999999999999e144 or 1.41999999999999996e88 < z Initial program 99.8%
Taylor expanded in z around inf 68.8%
associate-*r*68.8%
neg-mul-168.8%
*-commutative68.8%
Simplified68.8%
if -8.19999999999999971e226 < z < -1.05e185Initial program 100.0%
Taylor expanded in y around 0 89.5%
mul-1-neg89.5%
unsub-neg89.5%
Simplified89.5%
if -2.9999999999999999e144 < z < 1.41999999999999996e88Initial program 100.0%
Taylor expanded in z around 0 92.6%
+-commutative92.6%
Simplified92.6%
Final simplification85.0%
(FPCore (x y z) :precision binary64 (if (or (<= z -1.05) (not (<= z 3.5e-16))) (- (+ x 1.0) (* (sin y) z)) (+ x (cos y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.05) || !(z <= 3.5e-16)) {
tmp = (x + 1.0) - (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 <= (-1.05d0)) .or. (.not. (z <= 3.5d-16))) then
tmp = (x + 1.0d0) - (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 <= -1.05) || !(z <= 3.5e-16)) {
tmp = (x + 1.0) - (Math.sin(y) * z);
} else {
tmp = x + Math.cos(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -1.05) or not (z <= 3.5e-16): tmp = (x + 1.0) - (math.sin(y) * z) else: tmp = x + math.cos(y) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -1.05) || !(z <= 3.5e-16)) tmp = Float64(Float64(x + 1.0) - Float64(sin(y) * z)); else tmp = Float64(x + cos(y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -1.05) || ~((z <= 3.5e-16))) tmp = (x + 1.0) - (sin(y) * z); else tmp = x + cos(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -1.05], N[Not[LessEqual[z, 3.5e-16]], $MachinePrecision]], N[(N[(x + 1.0), $MachinePrecision] - N[(N[Sin[y], $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.05 \lor \neg \left(z \leq 3.5 \cdot 10^{-16}\right):\\
\;\;\;\;\left(x + 1\right) - \sin y \cdot z\\
\mathbf{else}:\\
\;\;\;\;x + \cos y\\
\end{array}
\end{array}
if z < -1.05000000000000004 or 3.50000000000000017e-16 < z Initial program 99.8%
add-sqr-sqrt49.4%
pow249.4%
Applied egg-rr49.4%
Taylor expanded in y around 0 49.0%
unpow249.0%
add-sqr-sqrt99.4%
*-commutative99.4%
Applied egg-rr99.4%
if -1.05000000000000004 < z < 3.50000000000000017e-16Initial program 100.0%
Taylor expanded in z around 0 99.2%
+-commutative99.2%
Simplified99.2%
Final simplification99.3%
(FPCore (x y z) :precision binary64 (if (or (<= y -0.041) (not (<= y 0.0026))) (+ x (cos y)) (+ 1.0 (- x (* y z)))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -0.041) || !(y <= 0.0026)) {
tmp = x + cos(y);
} else {
tmp = 1.0 + (x - (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.041d0)) .or. (.not. (y <= 0.0026d0))) then
tmp = x + cos(y)
else
tmp = 1.0d0 + (x - (y * z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -0.041) || !(y <= 0.0026)) {
tmp = x + Math.cos(y);
} else {
tmp = 1.0 + (x - (y * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -0.041) or not (y <= 0.0026): tmp = x + math.cos(y) else: tmp = 1.0 + (x - (y * z)) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -0.041) || !(y <= 0.0026)) tmp = Float64(x + cos(y)); else tmp = Float64(1.0 + Float64(x - Float64(y * z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -0.041) || ~((y <= 0.0026))) tmp = x + cos(y); else tmp = 1.0 + (x - (y * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -0.041], N[Not[LessEqual[y, 0.0026]], $MachinePrecision]], N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -0.041 \lor \neg \left(y \leq 0.0026\right):\\
\;\;\;\;x + \cos y\\
\mathbf{else}:\\
\;\;\;\;1 + \left(x - y \cdot z\right)\\
\end{array}
\end{array}
if y < -0.0410000000000000017 or 0.0025999999999999999 < y Initial program 99.8%
Taylor expanded in z around 0 58.2%
+-commutative58.2%
Simplified58.2%
if -0.0410000000000000017 < y < 0.0025999999999999999Initial program 100.0%
Taylor expanded in y around 0 99.5%
mul-1-neg99.5%
unsub-neg99.5%
Simplified99.5%
Final simplification78.0%
(FPCore (x y z) :precision binary64 (if (or (<= x -3.5e-12) (not (<= x 1.6e-42))) (+ x 1.0) (cos y)))
double code(double x, double y, double z) {
double tmp;
if ((x <= -3.5e-12) || !(x <= 1.6e-42)) {
tmp = x + 1.0;
} else {
tmp = 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 ((x <= (-3.5d-12)) .or. (.not. (x <= 1.6d-42))) then
tmp = x + 1.0d0
else
tmp = cos(y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -3.5e-12) || !(x <= 1.6e-42)) {
tmp = x + 1.0;
} else {
tmp = Math.cos(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -3.5e-12) or not (x <= 1.6e-42): tmp = x + 1.0 else: tmp = math.cos(y) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -3.5e-12) || !(x <= 1.6e-42)) tmp = Float64(x + 1.0); else tmp = cos(y); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -3.5e-12) || ~((x <= 1.6e-42))) tmp = x + 1.0; else tmp = cos(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -3.5e-12], N[Not[LessEqual[x, 1.6e-42]], $MachinePrecision]], N[(x + 1.0), $MachinePrecision], N[Cos[y], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.5 \cdot 10^{-12} \lor \neg \left(x \leq 1.6 \cdot 10^{-42}\right):\\
\;\;\;\;x + 1\\
\mathbf{else}:\\
\;\;\;\;\cos y\\
\end{array}
\end{array}
if x < -3.5e-12 or 1.60000000000000012e-42 < x Initial program 99.9%
Taylor expanded in y around 0 75.8%
+-commutative75.8%
Simplified75.8%
if -3.5e-12 < x < 1.60000000000000012e-42Initial program 99.9%
Taylor expanded in z around 0 62.1%
+-commutative62.1%
Simplified62.1%
Taylor expanded in x around 0 62.1%
Final simplification69.7%
(FPCore (x y z) :precision binary64 (if (or (<= y -5.8e+24) (not (<= y 0.0072))) (+ x 1.0) (+ 1.0 (- x (* y z)))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -5.8e+24) || !(y <= 0.0072)) {
tmp = x + 1.0;
} else {
tmp = 1.0 + (x - (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 <= (-5.8d+24)) .or. (.not. (y <= 0.0072d0))) then
tmp = x + 1.0d0
else
tmp = 1.0d0 + (x - (y * z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -5.8e+24) || !(y <= 0.0072)) {
tmp = x + 1.0;
} else {
tmp = 1.0 + (x - (y * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -5.8e+24) or not (y <= 0.0072): tmp = x + 1.0 else: tmp = 1.0 + (x - (y * z)) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -5.8e+24) || !(y <= 0.0072)) tmp = Float64(x + 1.0); else tmp = Float64(1.0 + Float64(x - Float64(y * z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -5.8e+24) || ~((y <= 0.0072))) tmp = x + 1.0; else tmp = 1.0 + (x - (y * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -5.8e+24], N[Not[LessEqual[y, 0.0072]], $MachinePrecision]], N[(x + 1.0), $MachinePrecision], N[(1.0 + N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.8 \cdot 10^{+24} \lor \neg \left(y \leq 0.0072\right):\\
\;\;\;\;x + 1\\
\mathbf{else}:\\
\;\;\;\;1 + \left(x - y \cdot z\right)\\
\end{array}
\end{array}
if y < -5.79999999999999958e24 or 0.0071999999999999998 < y Initial program 99.8%
Taylor expanded in y around 0 37.9%
+-commutative37.9%
Simplified37.9%
if -5.79999999999999958e24 < y < 0.0071999999999999998Initial program 100.0%
Taylor expanded in y around 0 97.3%
mul-1-neg97.3%
unsub-neg97.3%
Simplified97.3%
Final simplification67.3%
(FPCore (x y z) :precision binary64 (if (<= x -17200000000000.0) x (if (<= x 1.0) 1.0 x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -17200000000000.0) {
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 <= (-17200000000000.0d0)) 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 <= -17200000000000.0) {
tmp = x;
} else if (x <= 1.0) {
tmp = 1.0;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -17200000000000.0: tmp = x elif x <= 1.0: tmp = 1.0 else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -17200000000000.0) 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 <= -17200000000000.0) tmp = x; elseif (x <= 1.0) tmp = 1.0; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -17200000000000.0], x, If[LessEqual[x, 1.0], 1.0, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -17200000000000:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 1:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -1.72e13 or 1 < x Initial program 99.9%
Taylor expanded in x around inf 78.2%
if -1.72e13 < x < 1Initial program 99.9%
Taylor expanded in y around 0 40.7%
+-commutative40.7%
Simplified40.7%
Taylor expanded in x around 0 39.6%
Final simplification58.8%
(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.5%
+-commutative59.5%
Simplified59.5%
Final simplification59.5%
(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 y around 0 59.5%
+-commutative59.5%
Simplified59.5%
Taylor expanded in x around 0 21.5%
Final simplification21.5%
herbie shell --seed 2024096
(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))))