
(FPCore (x y z) :precision binary64 (+ (+ x (sin y)) (* z (cos y))))
double code(double x, double y, double z) {
return (x + sin(y)) + (z * cos(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 + sin(y)) + (z * cos(y))
end function
public static double code(double x, double y, double z) {
return (x + Math.sin(y)) + (z * Math.cos(y));
}
def code(x, y, z): return (x + math.sin(y)) + (z * math.cos(y))
function code(x, y, z) return Float64(Float64(x + sin(y)) + Float64(z * cos(y))) end
function tmp = code(x, y, z) tmp = (x + sin(y)) + (z * cos(y)); end
code[x_, y_, z_] := N[(N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision] + N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x + \sin y\right) + z \cdot \cos y
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 15 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (+ (+ x (sin y)) (* z (cos y))))
double code(double x, double y, double z) {
return (x + sin(y)) + (z * cos(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 + sin(y)) + (z * cos(y))
end function
public static double code(double x, double y, double z) {
return (x + Math.sin(y)) + (z * Math.cos(y));
}
def code(x, y, z): return (x + math.sin(y)) + (z * math.cos(y))
function code(x, y, z) return Float64(Float64(x + sin(y)) + Float64(z * cos(y))) end
function tmp = code(x, y, z) tmp = (x + sin(y)) + (z * cos(y)); end
code[x_, y_, z_] := N[(N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision] + N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x + \sin y\right) + z \cdot \cos y
\end{array}
(FPCore (x y z) :precision binary64 (fma z (cos y) (+ x (sin y))))
double code(double x, double y, double z) {
return fma(z, cos(y), (x + sin(y)));
}
function code(x, y, z) return fma(z, cos(y), Float64(x + sin(y))) end
code[x_, y_, z_] := N[(z * N[Cos[y], $MachinePrecision] + N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(z, \cos y, x + \sin y\right)
\end{array}
Initial program 99.9%
+-commutative99.9%
fma-define99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y z) :precision binary64 (+ (+ x (sin y)) (* z (cos y))))
double code(double x, double y, double z) {
return (x + sin(y)) + (z * cos(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 + sin(y)) + (z * cos(y))
end function
public static double code(double x, double y, double z) {
return (x + Math.sin(y)) + (z * Math.cos(y));
}
def code(x, y, z): return (x + math.sin(y)) + (z * math.cos(y))
function code(x, y, z) return Float64(Float64(x + sin(y)) + Float64(z * cos(y))) end
function tmp = code(x, y, z) tmp = (x + sin(y)) + (z * cos(y)); end
code[x_, y_, z_] := N[(N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision] + N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x + \sin y\right) + z \cdot \cos y
\end{array}
Initial program 99.9%
Final simplification99.9%
(FPCore (x y z) :precision binary64 (if (or (<= z -0.8) (not (<= z 3.5e-16))) (* z (+ (cos y) (/ x z))) (+ z (+ x (sin y)))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -0.8) || !(z <= 3.5e-16)) {
tmp = z * (cos(y) + (x / z));
} else {
tmp = z + (x + sin(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 <= (-0.8d0)) .or. (.not. (z <= 3.5d-16))) then
tmp = z * (cos(y) + (x / z))
else
tmp = z + (x + sin(y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -0.8) || !(z <= 3.5e-16)) {
tmp = z * (Math.cos(y) + (x / z));
} else {
tmp = z + (x + Math.sin(y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -0.8) or not (z <= 3.5e-16): tmp = z * (math.cos(y) + (x / z)) else: tmp = z + (x + math.sin(y)) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -0.8) || !(z <= 3.5e-16)) tmp = Float64(z * Float64(cos(y) + Float64(x / z))); else tmp = Float64(z + Float64(x + sin(y))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -0.8) || ~((z <= 3.5e-16))) tmp = z * (cos(y) + (x / z)); else tmp = z + (x + sin(y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -0.8], N[Not[LessEqual[z, 3.5e-16]], $MachinePrecision]], N[(z * N[(N[Cos[y], $MachinePrecision] + N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(z + N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.8 \lor \neg \left(z \leq 3.5 \cdot 10^{-16}\right):\\
\;\;\;\;z \cdot \left(\cos y + \frac{x}{z}\right)\\
\mathbf{else}:\\
\;\;\;\;z + \left(x + \sin y\right)\\
\end{array}
\end{array}
if z < -0.80000000000000004 or 3.50000000000000017e-16 < z Initial program 99.9%
Taylor expanded in z around inf 99.8%
associate-+r+99.8%
+-commutative99.8%
Simplified99.8%
Taylor expanded in y around 0 80.4%
Taylor expanded in z around -inf 80.4%
mul-1-neg80.4%
unsub-neg80.4%
neg-mul-180.4%
neg-mul-180.4%
unsub-neg80.4%
Simplified80.4%
Taylor expanded in x around inf 99.3%
mul-1-neg99.3%
distribute-neg-frac299.3%
Simplified99.3%
if -0.80000000000000004 < z < 3.50000000000000017e-16Initial program 100.0%
Taylor expanded in y around 0 99.3%
Final simplification99.3%
(FPCore (x y z) :precision binary64 (if (or (<= z -5.5e+77) (not (<= z 1.36e+88))) (* z (cos y)) (+ z (+ x (sin y)))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -5.5e+77) || !(z <= 1.36e+88)) {
tmp = z * cos(y);
} else {
tmp = z + (x + sin(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 <= (-5.5d+77)) .or. (.not. (z <= 1.36d+88))) then
tmp = z * cos(y)
else
tmp = z + (x + sin(y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -5.5e+77) || !(z <= 1.36e+88)) {
tmp = z * Math.cos(y);
} else {
tmp = z + (x + Math.sin(y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -5.5e+77) or not (z <= 1.36e+88): tmp = z * math.cos(y) else: tmp = z + (x + math.sin(y)) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -5.5e+77) || !(z <= 1.36e+88)) tmp = Float64(z * cos(y)); else tmp = Float64(z + Float64(x + sin(y))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -5.5e+77) || ~((z <= 1.36e+88))) tmp = z * cos(y); else tmp = z + (x + sin(y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -5.5e+77], N[Not[LessEqual[z, 1.36e+88]], $MachinePrecision]], N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision], N[(z + N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.5 \cdot 10^{+77} \lor \neg \left(z \leq 1.36 \cdot 10^{+88}\right):\\
\;\;\;\;z \cdot \cos y\\
\mathbf{else}:\\
\;\;\;\;z + \left(x + \sin y\right)\\
\end{array}
\end{array}
if z < -5.50000000000000036e77 or 1.3600000000000001e88 < z Initial program 99.8%
Taylor expanded in z around inf 81.8%
if -5.50000000000000036e77 < z < 1.3600000000000001e88Initial program 100.0%
Taylor expanded in y around 0 96.0%
Final simplification90.0%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (cos y))))
(if (<= z -6.5e+105)
(+ x (+ y t_0))
(if (<= z 9e+87) (+ z (+ x (sin y))) t_0))))
double code(double x, double y, double z) {
double t_0 = z * cos(y);
double tmp;
if (z <= -6.5e+105) {
tmp = x + (y + t_0);
} else if (z <= 9e+87) {
tmp = z + (x + sin(y));
} 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 = z * cos(y)
if (z <= (-6.5d+105)) then
tmp = x + (y + t_0)
else if (z <= 9d+87) then
tmp = z + (x + sin(y))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = z * Math.cos(y);
double tmp;
if (z <= -6.5e+105) {
tmp = x + (y + t_0);
} else if (z <= 9e+87) {
tmp = z + (x + Math.sin(y));
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = z * math.cos(y) tmp = 0 if z <= -6.5e+105: tmp = x + (y + t_0) elif z <= 9e+87: tmp = z + (x + math.sin(y)) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(z * cos(y)) tmp = 0.0 if (z <= -6.5e+105) tmp = Float64(x + Float64(y + t_0)); elseif (z <= 9e+87) tmp = Float64(z + Float64(x + sin(y))); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = z * cos(y); tmp = 0.0; if (z <= -6.5e+105) tmp = x + (y + t_0); elseif (z <= 9e+87) tmp = z + (x + sin(y)); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -6.5e+105], N[(x + N[(y + t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 9e+87], N[(z + N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \cos y\\
\mathbf{if}\;z \leq -6.5 \cdot 10^{+105}:\\
\;\;\;\;x + \left(y + t\_0\right)\\
\mathbf{elif}\;z \leq 9 \cdot 10^{+87}:\\
\;\;\;\;z + \left(x + \sin y\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -6.50000000000000049e105Initial program 99.9%
Taylor expanded in z around inf 99.8%
associate-+r+99.8%
+-commutative99.8%
Simplified99.8%
Taylor expanded in y around 0 89.3%
Taylor expanded in z around 0 89.4%
if -6.50000000000000049e105 < z < 9.0000000000000005e87Initial program 100.0%
Taylor expanded in y around 0 95.1%
if 9.0000000000000005e87 < z Initial program 99.7%
Taylor expanded in z around inf 83.6%
Final simplification91.7%
(FPCore (x y z) :precision binary64 (if (or (<= z -1.05e+78) (not (<= z 1.4e+88))) (* z (cos y)) (+ z x)))
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.05e+78) || !(z <= 1.4e+88)) {
tmp = z * cos(y);
} else {
tmp = z + 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 ((z <= (-1.05d+78)) .or. (.not. (z <= 1.4d+88))) then
tmp = z * cos(y)
else
tmp = z + x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -1.05e+78) || !(z <= 1.4e+88)) {
tmp = z * Math.cos(y);
} else {
tmp = z + x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -1.05e+78) or not (z <= 1.4e+88): tmp = z * math.cos(y) else: tmp = z + x return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -1.05e+78) || !(z <= 1.4e+88)) tmp = Float64(z * cos(y)); else tmp = Float64(z + x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -1.05e+78) || ~((z <= 1.4e+88))) tmp = z * cos(y); else tmp = z + x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -1.05e+78], N[Not[LessEqual[z, 1.4e+88]], $MachinePrecision]], N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision], N[(z + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.05 \cdot 10^{+78} \lor \neg \left(z \leq 1.4 \cdot 10^{+88}\right):\\
\;\;\;\;z \cdot \cos y\\
\mathbf{else}:\\
\;\;\;\;z + x\\
\end{array}
\end{array}
if z < -1.05e78 or 1.39999999999999994e88 < z Initial program 99.8%
Taylor expanded in z around inf 81.8%
if -1.05e78 < z < 1.39999999999999994e88Initial program 100.0%
Taylor expanded in y around 0 68.9%
+-commutative68.9%
Simplified68.9%
Final simplification74.4%
(FPCore (x y z) :precision binary64 (if (or (<= z -2.7e+77) (not (<= z 9.5e+16))) (* z (cos y)) (+ x (sin y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -2.7e+77) || !(z <= 9.5e+16)) {
tmp = z * cos(y);
} else {
tmp = x + sin(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.7d+77)) .or. (.not. (z <= 9.5d+16))) then
tmp = z * cos(y)
else
tmp = x + sin(y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -2.7e+77) || !(z <= 9.5e+16)) {
tmp = z * Math.cos(y);
} else {
tmp = x + Math.sin(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -2.7e+77) or not (z <= 9.5e+16): tmp = z * math.cos(y) else: tmp = x + math.sin(y) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -2.7e+77) || !(z <= 9.5e+16)) tmp = Float64(z * cos(y)); else tmp = Float64(x + sin(y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -2.7e+77) || ~((z <= 9.5e+16))) tmp = z * cos(y); else tmp = x + sin(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -2.7e+77], N[Not[LessEqual[z, 9.5e+16]], $MachinePrecision]], N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision], N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.7 \cdot 10^{+77} \lor \neg \left(z \leq 9.5 \cdot 10^{+16}\right):\\
\;\;\;\;z \cdot \cos y\\
\mathbf{else}:\\
\;\;\;\;x + \sin y\\
\end{array}
\end{array}
if z < -2.6999999999999998e77 or 9.5e16 < z Initial program 99.9%
Taylor expanded in z around inf 80.0%
if -2.6999999999999998e77 < z < 9.5e16Initial program 100.0%
Taylor expanded in z around 0 88.2%
+-commutative88.2%
Simplified88.2%
Final simplification84.3%
(FPCore (x y z) :precision binary64 (if (or (<= y -23000000000.0) (not (<= y 39000000000000.0))) (+ z x) (+ x (+ z (* y (+ (* y (+ (* z -0.5) (* y -0.16666666666666666))) 1.0))))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -23000000000.0) || !(y <= 39000000000000.0)) {
tmp = z + x;
} else {
tmp = x + (z + (y * ((y * ((z * -0.5) + (y * -0.16666666666666666))) + 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 ((y <= (-23000000000.0d0)) .or. (.not. (y <= 39000000000000.0d0))) then
tmp = z + x
else
tmp = x + (z + (y * ((y * ((z * (-0.5d0)) + (y * (-0.16666666666666666d0)))) + 1.0d0)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -23000000000.0) || !(y <= 39000000000000.0)) {
tmp = z + x;
} else {
tmp = x + (z + (y * ((y * ((z * -0.5) + (y * -0.16666666666666666))) + 1.0)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -23000000000.0) or not (y <= 39000000000000.0): tmp = z + x else: tmp = x + (z + (y * ((y * ((z * -0.5) + (y * -0.16666666666666666))) + 1.0))) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -23000000000.0) || !(y <= 39000000000000.0)) tmp = Float64(z + x); else tmp = Float64(x + Float64(z + Float64(y * Float64(Float64(y * Float64(Float64(z * -0.5) + Float64(y * -0.16666666666666666))) + 1.0)))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -23000000000.0) || ~((y <= 39000000000000.0))) tmp = z + x; else tmp = x + (z + (y * ((y * ((z * -0.5) + (y * -0.16666666666666666))) + 1.0))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -23000000000.0], N[Not[LessEqual[y, 39000000000000.0]], $MachinePrecision]], N[(z + x), $MachinePrecision], N[(x + N[(z + N[(y * N[(N[(y * N[(N[(z * -0.5), $MachinePrecision] + N[(y * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -23000000000 \lor \neg \left(y \leq 39000000000000\right):\\
\;\;\;\;z + x\\
\mathbf{else}:\\
\;\;\;\;x + \left(z + y \cdot \left(y \cdot \left(z \cdot -0.5 + y \cdot -0.16666666666666666\right) + 1\right)\right)\\
\end{array}
\end{array}
if y < -2.3e10 or 3.9e13 < y Initial program 99.9%
Taylor expanded in y around 0 39.6%
+-commutative39.6%
Simplified39.6%
if -2.3e10 < y < 3.9e13Initial program 100.0%
Taylor expanded in y around 0 98.2%
Final simplification68.5%
(FPCore (x y z) :precision binary64 (if (or (<= y -3.7e+32) (not (<= y 850.0))) (+ z x) (+ x (+ z (* y (+ (* y (* y -0.16666666666666666)) 1.0))))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -3.7e+32) || !(y <= 850.0)) {
tmp = z + x;
} else {
tmp = x + (z + (y * ((y * (y * -0.16666666666666666)) + 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 ((y <= (-3.7d+32)) .or. (.not. (y <= 850.0d0))) then
tmp = z + x
else
tmp = x + (z + (y * ((y * (y * (-0.16666666666666666d0))) + 1.0d0)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -3.7e+32) || !(y <= 850.0)) {
tmp = z + x;
} else {
tmp = x + (z + (y * ((y * (y * -0.16666666666666666)) + 1.0)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -3.7e+32) or not (y <= 850.0): tmp = z + x else: tmp = x + (z + (y * ((y * (y * -0.16666666666666666)) + 1.0))) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -3.7e+32) || !(y <= 850.0)) tmp = Float64(z + x); else tmp = Float64(x + Float64(z + Float64(y * Float64(Float64(y * Float64(y * -0.16666666666666666)) + 1.0)))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -3.7e+32) || ~((y <= 850.0))) tmp = z + x; else tmp = x + (z + (y * ((y * (y * -0.16666666666666666)) + 1.0))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -3.7e+32], N[Not[LessEqual[y, 850.0]], $MachinePrecision]], N[(z + x), $MachinePrecision], N[(x + N[(z + N[(y * N[(N[(y * N[(y * -0.16666666666666666), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.7 \cdot 10^{+32} \lor \neg \left(y \leq 850\right):\\
\;\;\;\;z + x\\
\mathbf{else}:\\
\;\;\;\;x + \left(z + y \cdot \left(y \cdot \left(y \cdot -0.16666666666666666\right) + 1\right)\right)\\
\end{array}
\end{array}
if y < -3.7e32 or 850 < y Initial program 99.8%
Taylor expanded in y around 0 38.4%
+-commutative38.4%
Simplified38.4%
if -3.7e32 < y < 850Initial program 100.0%
Taylor expanded in y around 0 96.8%
Taylor expanded in z around 0 97.3%
*-commutative97.3%
Simplified97.3%
Final simplification68.3%
(FPCore (x y z) :precision binary64 (if (or (<= y -1.42) (not (<= y 4.5e+16))) (+ z x) (+ (+ z x) (* y (+ (* -0.5 (* z y)) 1.0)))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -1.42) || !(y <= 4.5e+16)) {
tmp = z + x;
} else {
tmp = (z + x) + (y * ((-0.5 * (z * y)) + 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 ((y <= (-1.42d0)) .or. (.not. (y <= 4.5d+16))) then
tmp = z + x
else
tmp = (z + x) + (y * (((-0.5d0) * (z * y)) + 1.0d0))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -1.42) || !(y <= 4.5e+16)) {
tmp = z + x;
} else {
tmp = (z + x) + (y * ((-0.5 * (z * y)) + 1.0));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -1.42) or not (y <= 4.5e+16): tmp = z + x else: tmp = (z + x) + (y * ((-0.5 * (z * y)) + 1.0)) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -1.42) || !(y <= 4.5e+16)) tmp = Float64(z + x); else tmp = Float64(Float64(z + x) + Float64(y * Float64(Float64(-0.5 * Float64(z * y)) + 1.0))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -1.42) || ~((y <= 4.5e+16))) tmp = z + x; else tmp = (z + x) + (y * ((-0.5 * (z * y)) + 1.0)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -1.42], N[Not[LessEqual[y, 4.5e+16]], $MachinePrecision]], N[(z + x), $MachinePrecision], N[(N[(z + x), $MachinePrecision] + N[(y * N[(N[(-0.5 * N[(z * y), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.42 \lor \neg \left(y \leq 4.5 \cdot 10^{+16}\right):\\
\;\;\;\;z + x\\
\mathbf{else}:\\
\;\;\;\;\left(z + x\right) + y \cdot \left(-0.5 \cdot \left(z \cdot y\right) + 1\right)\\
\end{array}
\end{array}
if y < -1.4199999999999999 or 4.5e16 < y Initial program 99.9%
Taylor expanded in y around 0 39.7%
+-commutative39.7%
Simplified39.7%
if -1.4199999999999999 < y < 4.5e16Initial program 100.0%
Taylor expanded in y around 0 97.9%
associate-+r+97.9%
+-commutative97.9%
*-commutative97.9%
Simplified97.9%
Final simplification68.4%
(FPCore (x y z) :precision binary64 (if (or (<= y -4.7e+52) (not (<= y 2.4e+66))) (+ z x) (+ z (+ y x))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -4.7e+52) || !(y <= 2.4e+66)) {
tmp = z + x;
} else {
tmp = z + (y + 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 <= (-4.7d+52)) .or. (.not. (y <= 2.4d+66))) then
tmp = z + x
else
tmp = z + (y + x)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -4.7e+52) || !(y <= 2.4e+66)) {
tmp = z + x;
} else {
tmp = z + (y + x);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -4.7e+52) or not (y <= 2.4e+66): tmp = z + x else: tmp = z + (y + x) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -4.7e+52) || !(y <= 2.4e+66)) tmp = Float64(z + x); else tmp = Float64(z + Float64(y + x)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -4.7e+52) || ~((y <= 2.4e+66))) tmp = z + x; else tmp = z + (y + x); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -4.7e+52], N[Not[LessEqual[y, 2.4e+66]], $MachinePrecision]], N[(z + x), $MachinePrecision], N[(z + N[(y + x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.7 \cdot 10^{+52} \lor \neg \left(y \leq 2.4 \cdot 10^{+66}\right):\\
\;\;\;\;z + x\\
\mathbf{else}:\\
\;\;\;\;z + \left(y + x\right)\\
\end{array}
\end{array}
if y < -4.7e52 or 2.4000000000000002e66 < y Initial program 99.9%
Taylor expanded in y around 0 39.9%
+-commutative39.9%
Simplified39.9%
if -4.7e52 < y < 2.4000000000000002e66Initial program 99.9%
Taylor expanded in y around 0 88.6%
+-commutative88.6%
+-commutative88.6%
associate-+l+88.6%
Simplified88.6%
Final simplification68.2%
(FPCore (x y z) :precision binary64 (if (or (<= x -9.25e-21) (not (<= x 5.3e-127))) (+ z x) (+ z y)))
double code(double x, double y, double z) {
double tmp;
if ((x <= -9.25e-21) || !(x <= 5.3e-127)) {
tmp = z + x;
} else {
tmp = z + 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 <= (-9.25d-21)) .or. (.not. (x <= 5.3d-127))) then
tmp = z + x
else
tmp = z + y
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -9.25e-21) || !(x <= 5.3e-127)) {
tmp = z + x;
} else {
tmp = z + y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -9.25e-21) or not (x <= 5.3e-127): tmp = z + x else: tmp = z + y return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -9.25e-21) || !(x <= 5.3e-127)) tmp = Float64(z + x); else tmp = Float64(z + y); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -9.25e-21) || ~((x <= 5.3e-127))) tmp = z + x; else tmp = z + y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -9.25e-21], N[Not[LessEqual[x, 5.3e-127]], $MachinePrecision]], N[(z + x), $MachinePrecision], N[(z + y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -9.25 \cdot 10^{-21} \lor \neg \left(x \leq 5.3 \cdot 10^{-127}\right):\\
\;\;\;\;z + x\\
\mathbf{else}:\\
\;\;\;\;z + y\\
\end{array}
\end{array}
if x < -9.2500000000000001e-21 or 5.3000000000000003e-127 < x Initial program 99.9%
Taylor expanded in y around 0 76.5%
+-commutative76.5%
Simplified76.5%
if -9.2500000000000001e-21 < x < 5.3000000000000003e-127Initial program 99.9%
Taylor expanded in z around inf 99.8%
associate-+r+99.8%
+-commutative99.8%
Simplified99.8%
Taylor expanded in x around 0 99.8%
Taylor expanded in y around 0 52.3%
Final simplification67.6%
(FPCore (x y z) :precision binary64 (if (<= x -8.4e-20) x (if (<= x 5400000.0) (+ z y) x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -8.4e-20) {
tmp = x;
} else if (x <= 5400000.0) {
tmp = z + 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 <= (-8.4d-20)) then
tmp = x
else if (x <= 5400000.0d0) then
tmp = z + y
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -8.4e-20) {
tmp = x;
} else if (x <= 5400000.0) {
tmp = z + y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -8.4e-20: tmp = x elif x <= 5400000.0: tmp = z + y else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -8.4e-20) tmp = x; elseif (x <= 5400000.0) tmp = Float64(z + y); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -8.4e-20) tmp = x; elseif (x <= 5400000.0) tmp = z + y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -8.4e-20], x, If[LessEqual[x, 5400000.0], N[(z + y), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -8.4 \cdot 10^{-20}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 5400000:\\
\;\;\;\;z + y\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -8.3999999999999996e-20 or 5.4e6 < x Initial program 99.9%
Taylor expanded in x around inf 69.8%
if -8.3999999999999996e-20 < x < 5.4e6Initial program 99.9%
Taylor expanded in z around inf 99.8%
associate-+r+99.8%
+-commutative99.8%
Simplified99.8%
Taylor expanded in x around 0 96.0%
Taylor expanded in y around 0 51.4%
Final simplification61.1%
(FPCore (x y z) :precision binary64 (if (<= x -7.8e-20) x (if (<= x 3300000.0) z x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -7.8e-20) {
tmp = x;
} else if (x <= 3300000.0) {
tmp = 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 <= (-7.8d-20)) then
tmp = x
else if (x <= 3300000.0d0) then
tmp = z
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -7.8e-20) {
tmp = x;
} else if (x <= 3300000.0) {
tmp = z;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -7.8e-20: tmp = x elif x <= 3300000.0: tmp = z else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -7.8e-20) tmp = x; elseif (x <= 3300000.0) tmp = z; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -7.8e-20) tmp = x; elseif (x <= 3300000.0) tmp = z; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -7.8e-20], x, If[LessEqual[x, 3300000.0], z, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.8 \cdot 10^{-20}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 3300000:\\
\;\;\;\;z\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -7.80000000000000014e-20 or 3.3e6 < x Initial program 99.9%
Taylor expanded in x around inf 69.8%
if -7.80000000000000014e-20 < x < 3.3e6Initial program 99.9%
Taylor expanded in z around inf 99.8%
associate-+r+99.8%
+-commutative99.8%
Simplified99.8%
Taylor expanded in x around 0 96.0%
Taylor expanded in y around 0 45.1%
Final simplification58.2%
(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 x around inf 39.6%
Final simplification39.6%
herbie shell --seed 2024096
(FPCore (x y z)
:name "Graphics.Rasterific.Svg.PathConverter:segmentToBezier from rasterific-svg-0.2.3.1, C"
:precision binary64
(+ (+ x (sin y)) (* z (cos y))))