
(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 16 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (- (+ x (cos y)) (* z (sin y))))
double code(double x, double y, double z) {
return (x + cos(y)) - (z * sin(y));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (x + cos(y)) - (z * sin(y))
end function
public static double code(double x, double y, double z) {
return (x + Math.cos(y)) - (z * Math.sin(y));
}
def code(x, y, z): return (x + math.cos(y)) - (z * math.sin(y))
function code(x, y, z) return Float64(Float64(x + cos(y)) - Float64(z * sin(y))) end
function tmp = code(x, y, z) tmp = (x + cos(y)) - (z * sin(y)); end
code[x_, y_, z_] := N[(N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision] - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x + \cos y\right) - z \cdot \sin y
\end{array}
(FPCore (x y z) :precision binary64 (- (+ x (cos y)) (* z (sin y))))
double code(double x, double y, double z) {
return (x + cos(y)) - (z * sin(y));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (x + cos(y)) - (z * sin(y))
end function
public static double code(double x, double y, double z) {
return (x + Math.cos(y)) - (z * Math.sin(y));
}
def code(x, y, z): return (x + math.cos(y)) - (z * math.sin(y))
function code(x, y, z) return Float64(Float64(x + cos(y)) - Float64(z * sin(y))) end
function tmp = code(x, y, z) tmp = (x + cos(y)) - (z * sin(y)); end
code[x_, y_, z_] := N[(N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision] - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x + \cos y\right) - z \cdot \sin y
\end{array}
Initial program 99.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (sin y))))
(if (or (<= x -1.95e-11) (not (<= x 1.16e-63)))
(- (+ 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 <= -1.95e-11) || !(x <= 1.16e-63)) {
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 <= (-1.95d-11)) .or. (.not. (x <= 1.16d-63))) 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 <= -1.95e-11) || !(x <= 1.16e-63)) {
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 <= -1.95e-11) or not (x <= 1.16e-63): 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 <= -1.95e-11) || !(x <= 1.16e-63)) 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 <= -1.95e-11) || ~((x <= 1.16e-63))) 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, -1.95e-11], N[Not[LessEqual[x, 1.16e-63]], $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 -1.95 \cdot 10^{-11} \lor \neg \left(x \leq 1.16 \cdot 10^{-63}\right):\\
\;\;\;\;\left(x + 1\right) - t\_0\\
\mathbf{else}:\\
\;\;\;\;\cos y - t\_0\\
\end{array}
\end{array}
if x < -1.95000000000000005e-11 or 1.16e-63 < x Initial program 99.9%
Taylor expanded in y around 0 99.2%
if -1.95000000000000005e-11 < x < 1.16e-63Initial program 99.9%
Taylor expanded in x around 0 99.9%
Final simplification99.5%
(FPCore (x y z) :precision binary64 (if (or (<= z -0.00033) (not (<= z 4.3e-46))) (- (+ x 1.0) (* z (sin y))) (+ x (cos y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -0.00033) || !(z <= 4.3e-46)) {
tmp = (x + 1.0) - (z * sin(y));
} else {
tmp = x + cos(y);
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((z <= (-0.00033d0)) .or. (.not. (z <= 4.3d-46))) then
tmp = (x + 1.0d0) - (z * sin(y))
else
tmp = x + cos(y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -0.00033) || !(z <= 4.3e-46)) {
tmp = (x + 1.0) - (z * Math.sin(y));
} else {
tmp = x + Math.cos(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -0.00033) or not (z <= 4.3e-46): tmp = (x + 1.0) - (z * math.sin(y)) else: tmp = x + math.cos(y) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -0.00033) || !(z <= 4.3e-46)) tmp = Float64(Float64(x + 1.0) - Float64(z * sin(y))); else tmp = Float64(x + cos(y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -0.00033) || ~((z <= 4.3e-46))) tmp = (x + 1.0) - (z * sin(y)); else tmp = x + cos(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -0.00033], N[Not[LessEqual[z, 4.3e-46]], $MachinePrecision]], N[(N[(x + 1.0), $MachinePrecision] - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.00033 \lor \neg \left(z \leq 4.3 \cdot 10^{-46}\right):\\
\;\;\;\;\left(x + 1\right) - z \cdot \sin y\\
\mathbf{else}:\\
\;\;\;\;x + \cos y\\
\end{array}
\end{array}
if z < -3.3e-4 or 4.30000000000000035e-46 < z Initial program 99.9%
Taylor expanded in y around 0 98.4%
if -3.3e-4 < z < 4.30000000000000035e-46Initial program 100.0%
Taylor expanded in z around 0 100.0%
+-commutative100.0%
Simplified100.0%
Final simplification99.2%
(FPCore (x y z) :precision binary64 (if (or (<= z -4.2e+25) (not (<= z 6.2e+33))) (- x (* z (sin y))) (+ x (cos y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -4.2e+25) || !(z <= 6.2e+33)) {
tmp = x - (z * sin(y));
} else {
tmp = x + cos(y);
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((z <= (-4.2d+25)) .or. (.not. (z <= 6.2d+33))) then
tmp = x - (z * sin(y))
else
tmp = x + cos(y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -4.2e+25) || !(z <= 6.2e+33)) {
tmp = x - (z * Math.sin(y));
} else {
tmp = x + Math.cos(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -4.2e+25) or not (z <= 6.2e+33): tmp = x - (z * math.sin(y)) else: tmp = x + math.cos(y) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -4.2e+25) || !(z <= 6.2e+33)) tmp = Float64(x - Float64(z * sin(y))); else tmp = Float64(x + cos(y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -4.2e+25) || ~((z <= 6.2e+33))) tmp = x - (z * sin(y)); else tmp = x + cos(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -4.2e+25], N[Not[LessEqual[z, 6.2e+33]], $MachinePrecision]], N[(x - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.2 \cdot 10^{+25} \lor \neg \left(z \leq 6.2 \cdot 10^{+33}\right):\\
\;\;\;\;x - z \cdot \sin y\\
\mathbf{else}:\\
\;\;\;\;x + \cos y\\
\end{array}
\end{array}
if z < -4.1999999999999998e25 or 6.2e33 < z Initial program 99.9%
Taylor expanded in y around 0 99.9%
Taylor expanded in x around inf 88.4%
if -4.1999999999999998e25 < z < 6.2e33Initial program 100.0%
Taylor expanded in z around 0 97.3%
+-commutative97.3%
Simplified97.3%
Final simplification93.3%
(FPCore (x y z) :precision binary64 (if (or (<= z -1e+132) (not (<= z 6.2e+195))) (* (sin y) (- z)) (+ x (cos y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -1e+132) || !(z <= 6.2e+195)) {
tmp = 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 <= (-1d+132)) .or. (.not. (z <= 6.2d+195))) then
tmp = 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 <= -1e+132) || !(z <= 6.2e+195)) {
tmp = Math.sin(y) * -z;
} else {
tmp = x + Math.cos(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -1e+132) or not (z <= 6.2e+195): tmp = math.sin(y) * -z else: tmp = x + math.cos(y) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -1e+132) || !(z <= 6.2e+195)) tmp = Float64(sin(y) * Float64(-z)); else tmp = Float64(x + cos(y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -1e+132) || ~((z <= 6.2e+195))) tmp = sin(y) * -z; else tmp = x + cos(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -1e+132], N[Not[LessEqual[z, 6.2e+195]], $MachinePrecision]], N[(N[Sin[y], $MachinePrecision] * (-z)), $MachinePrecision], N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1 \cdot 10^{+132} \lor \neg \left(z \leq 6.2 \cdot 10^{+195}\right):\\
\;\;\;\;\sin y \cdot \left(-z\right)\\
\mathbf{else}:\\
\;\;\;\;x + \cos y\\
\end{array}
\end{array}
if z < -9.99999999999999991e131 or 6.2000000000000004e195 < z Initial program 99.8%
Taylor expanded in z around inf 81.6%
mul-1-neg81.6%
distribute-rgt-neg-out81.6%
Simplified81.6%
if -9.99999999999999991e131 < z < 6.2000000000000004e195Initial program 100.0%
Taylor expanded in z around 0 88.9%
+-commutative88.9%
Simplified88.9%
Final simplification87.2%
(FPCore (x y z) :precision binary64 (if (or (<= y -35000000.0) (not (<= y 1.05))) (+ x (cos y)) (+ 1.0 (+ x (* y (- (* y (* 0.16666666666666666 (* y z))) z))))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -35000000.0) || !(y <= 1.05)) {
tmp = x + cos(y);
} else {
tmp = 1.0 + (x + (y * ((y * (0.16666666666666666 * (y * z))) - 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 <= (-35000000.0d0)) .or. (.not. (y <= 1.05d0))) then
tmp = x + cos(y)
else
tmp = 1.0d0 + (x + (y * ((y * (0.16666666666666666d0 * (y * z))) - z)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -35000000.0) || !(y <= 1.05)) {
tmp = x + Math.cos(y);
} else {
tmp = 1.0 + (x + (y * ((y * (0.16666666666666666 * (y * z))) - z)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -35000000.0) or not (y <= 1.05): tmp = x + math.cos(y) else: tmp = 1.0 + (x + (y * ((y * (0.16666666666666666 * (y * z))) - z))) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -35000000.0) || !(y <= 1.05)) tmp = Float64(x + cos(y)); else tmp = Float64(1.0 + Float64(x + Float64(y * Float64(Float64(y * Float64(0.16666666666666666 * Float64(y * z))) - z)))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -35000000.0) || ~((y <= 1.05))) tmp = x + cos(y); else tmp = 1.0 + (x + (y * ((y * (0.16666666666666666 * (y * z))) - z))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -35000000.0], N[Not[LessEqual[y, 1.05]], $MachinePrecision]], N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(x + N[(y * N[(N[(y * N[(0.16666666666666666 * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -35000000 \lor \neg \left(y \leq 1.05\right):\\
\;\;\;\;x + \cos y\\
\mathbf{else}:\\
\;\;\;\;1 + \left(x + y \cdot \left(y \cdot \left(0.16666666666666666 \cdot \left(y \cdot z\right)\right) - z\right)\right)\\
\end{array}
\end{array}
if y < -3.5e7 or 1.05000000000000004 < y Initial program 99.9%
Taylor expanded in z around 0 61.5%
+-commutative61.5%
Simplified61.5%
if -3.5e7 < y < 1.05000000000000004Initial program 100.0%
Taylor expanded in y around 0 99.4%
Taylor expanded in y around inf 99.4%
Final simplification81.9%
(FPCore (x y z) :precision binary64 (if (<= x -1.5e-77) (+ 1.0 (- x (* y z))) (if (<= x 1.16e-63) (cos y) (+ x 1.0))))
double code(double x, double y, double z) {
double tmp;
if (x <= -1.5e-77) {
tmp = 1.0 + (x - (y * z));
} else if (x <= 1.16e-63) {
tmp = cos(y);
} else {
tmp = x + 1.0;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (x <= (-1.5d-77)) then
tmp = 1.0d0 + (x - (y * z))
else if (x <= 1.16d-63) then
tmp = cos(y)
else
tmp = x + 1.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -1.5e-77) {
tmp = 1.0 + (x - (y * z));
} else if (x <= 1.16e-63) {
tmp = Math.cos(y);
} else {
tmp = x + 1.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -1.5e-77: tmp = 1.0 + (x - (y * z)) elif x <= 1.16e-63: tmp = math.cos(y) else: tmp = x + 1.0 return tmp
function code(x, y, z) tmp = 0.0 if (x <= -1.5e-77) tmp = Float64(1.0 + Float64(x - Float64(y * z))); elseif (x <= 1.16e-63) tmp = cos(y); else tmp = Float64(x + 1.0); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -1.5e-77) tmp = 1.0 + (x - (y * z)); elseif (x <= 1.16e-63) tmp = cos(y); else tmp = x + 1.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -1.5e-77], N[(1.0 + N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.16e-63], N[Cos[y], $MachinePrecision], N[(x + 1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.5 \cdot 10^{-77}:\\
\;\;\;\;1 + \left(x - y \cdot z\right)\\
\mathbf{elif}\;x \leq 1.16 \cdot 10^{-63}:\\
\;\;\;\;\cos y\\
\mathbf{else}:\\
\;\;\;\;x + 1\\
\end{array}
\end{array}
if x < -1.50000000000000008e-77Initial program 99.9%
Taylor expanded in y around 0 71.7%
mul-1-neg71.7%
unsub-neg71.7%
Simplified71.7%
if -1.50000000000000008e-77 < x < 1.16e-63Initial program 99.9%
Taylor expanded in x around 0 99.9%
Taylor expanded in z around 0 67.2%
if 1.16e-63 < x Initial program 100.0%
Taylor expanded in y around 0 85.0%
+-commutative85.0%
Simplified85.0%
(FPCore (x y z) :precision binary64 (if (or (<= y -1.7e+32) (not (<= y 62.0))) (+ x 1.0) (+ 1.0 (+ x (* y (- (* y (- (* 0.16666666666666666 (* y z)) 0.5)) z))))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -1.7e+32) || !(y <= 62.0)) {
tmp = x + 1.0;
} else {
tmp = 1.0 + (x + (y * ((y * ((0.16666666666666666 * (y * z)) - 0.5)) - z)));
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((y <= (-1.7d+32)) .or. (.not. (y <= 62.0d0))) then
tmp = x + 1.0d0
else
tmp = 1.0d0 + (x + (y * ((y * ((0.16666666666666666d0 * (y * z)) - 0.5d0)) - z)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -1.7e+32) || !(y <= 62.0)) {
tmp = x + 1.0;
} else {
tmp = 1.0 + (x + (y * ((y * ((0.16666666666666666 * (y * z)) - 0.5)) - z)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -1.7e+32) or not (y <= 62.0): tmp = x + 1.0 else: tmp = 1.0 + (x + (y * ((y * ((0.16666666666666666 * (y * z)) - 0.5)) - z))) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -1.7e+32) || !(y <= 62.0)) tmp = Float64(x + 1.0); else tmp = Float64(1.0 + Float64(x + Float64(y * Float64(Float64(y * Float64(Float64(0.16666666666666666 * Float64(y * z)) - 0.5)) - z)))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -1.7e+32) || ~((y <= 62.0))) tmp = x + 1.0; else tmp = 1.0 + (x + (y * ((y * ((0.16666666666666666 * (y * z)) - 0.5)) - z))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -1.7e+32], N[Not[LessEqual[y, 62.0]], $MachinePrecision]], N[(x + 1.0), $MachinePrecision], N[(1.0 + N[(x + N[(y * N[(N[(y * N[(N[(0.16666666666666666 * N[(y * z), $MachinePrecision]), $MachinePrecision] - 0.5), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.7 \cdot 10^{+32} \lor \neg \left(y \leq 62\right):\\
\;\;\;\;x + 1\\
\mathbf{else}:\\
\;\;\;\;1 + \left(x + y \cdot \left(y \cdot \left(0.16666666666666666 \cdot \left(y \cdot z\right) - 0.5\right) - z\right)\right)\\
\end{array}
\end{array}
if y < -1.69999999999999989e32 or 62 < y Initial program 99.8%
Taylor expanded in y around 0 37.2%
+-commutative37.2%
Simplified37.2%
if -1.69999999999999989e32 < y < 62Initial program 100.0%
Taylor expanded in y around 0 98.3%
Final simplification71.5%
(FPCore (x y z) :precision binary64 (if (or (<= y -3.6e+83) (not (<= y 2.1))) (+ x 1.0) (+ 1.0 (+ x (* y (- (* y (* 0.16666666666666666 (* y z))) z))))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -3.6e+83) || !(y <= 2.1)) {
tmp = x + 1.0;
} else {
tmp = 1.0 + (x + (y * ((y * (0.16666666666666666 * (y * z))) - 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.6d+83)) .or. (.not. (y <= 2.1d0))) then
tmp = x + 1.0d0
else
tmp = 1.0d0 + (x + (y * ((y * (0.16666666666666666d0 * (y * z))) - z)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -3.6e+83) || !(y <= 2.1)) {
tmp = x + 1.0;
} else {
tmp = 1.0 + (x + (y * ((y * (0.16666666666666666 * (y * z))) - z)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -3.6e+83) or not (y <= 2.1): tmp = x + 1.0 else: tmp = 1.0 + (x + (y * ((y * (0.16666666666666666 * (y * z))) - z))) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -3.6e+83) || !(y <= 2.1)) tmp = Float64(x + 1.0); else tmp = Float64(1.0 + Float64(x + Float64(y * Float64(Float64(y * Float64(0.16666666666666666 * Float64(y * z))) - z)))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -3.6e+83) || ~((y <= 2.1))) tmp = x + 1.0; else tmp = 1.0 + (x + (y * ((y * (0.16666666666666666 * (y * z))) - z))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -3.6e+83], N[Not[LessEqual[y, 2.1]], $MachinePrecision]], N[(x + 1.0), $MachinePrecision], N[(1.0 + N[(x + N[(y * N[(N[(y * N[(0.16666666666666666 * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.6 \cdot 10^{+83} \lor \neg \left(y \leq 2.1\right):\\
\;\;\;\;x + 1\\
\mathbf{else}:\\
\;\;\;\;1 + \left(x + y \cdot \left(y \cdot \left(0.16666666666666666 \cdot \left(y \cdot z\right)\right) - z\right)\right)\\
\end{array}
\end{array}
if y < -3.5999999999999997e83 or 2.10000000000000009 < y Initial program 99.8%
Taylor expanded in y around 0 37.3%
+-commutative37.3%
Simplified37.3%
if -3.5999999999999997e83 < y < 2.10000000000000009Initial program 100.0%
Taylor expanded in y around 0 94.4%
Taylor expanded in y around inf 95.2%
Final simplification71.5%
(FPCore (x y z) :precision binary64 (if (or (<= y -1.05e+35) (not (<= y 600000.0))) (+ x 1.0) (+ (+ x 1.0) (* y (- (* y -0.5) z)))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -1.05e+35) || !(y <= 600000.0)) {
tmp = x + 1.0;
} else {
tmp = (x + 1.0) + (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 <= (-1.05d+35)) .or. (.not. (y <= 600000.0d0))) then
tmp = x + 1.0d0
else
tmp = (x + 1.0d0) + (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 <= -1.05e+35) || !(y <= 600000.0)) {
tmp = x + 1.0;
} else {
tmp = (x + 1.0) + (y * ((y * -0.5) - z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -1.05e+35) or not (y <= 600000.0): tmp = x + 1.0 else: tmp = (x + 1.0) + (y * ((y * -0.5) - z)) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -1.05e+35) || !(y <= 600000.0)) tmp = Float64(x + 1.0); else tmp = Float64(Float64(x + 1.0) + Float64(y * Float64(Float64(y * -0.5) - z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -1.05e+35) || ~((y <= 600000.0))) tmp = x + 1.0; else tmp = (x + 1.0) + (y * ((y * -0.5) - z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -1.05e+35], N[Not[LessEqual[y, 600000.0]], $MachinePrecision]], N[(x + 1.0), $MachinePrecision], N[(N[(x + 1.0), $MachinePrecision] + N[(y * N[(N[(y * -0.5), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.05 \cdot 10^{+35} \lor \neg \left(y \leq 600000\right):\\
\;\;\;\;x + 1\\
\mathbf{else}:\\
\;\;\;\;\left(x + 1\right) + y \cdot \left(y \cdot -0.5 - z\right)\\
\end{array}
\end{array}
if y < -1.0499999999999999e35 or 6e5 < y Initial program 99.9%
Taylor expanded in y around 0 38.0%
+-commutative38.0%
Simplified38.0%
if -1.0499999999999999e35 < y < 6e5Initial program 100.0%
Taylor expanded in y around 0 96.2%
associate-+r+96.2%
+-commutative96.2%
*-commutative96.2%
Simplified96.2%
Final simplification71.4%
(FPCore (x y z) :precision binary64 (if (or (<= y -8e+120) (not (<= y 520000.0))) (+ x 1.0) (+ 1.0 (- x (* y z)))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -8e+120) || !(y <= 520000.0)) {
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 <= (-8d+120)) .or. (.not. (y <= 520000.0d0))) 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 <= -8e+120) || !(y <= 520000.0)) {
tmp = x + 1.0;
} else {
tmp = 1.0 + (x - (y * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -8e+120) or not (y <= 520000.0): tmp = x + 1.0 else: tmp = 1.0 + (x - (y * z)) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -8e+120) || !(y <= 520000.0)) 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 <= -8e+120) || ~((y <= 520000.0))) tmp = x + 1.0; else tmp = 1.0 + (x - (y * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -8e+120], N[Not[LessEqual[y, 520000.0]], $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 -8 \cdot 10^{+120} \lor \neg \left(y \leq 520000\right):\\
\;\;\;\;x + 1\\
\mathbf{else}:\\
\;\;\;\;1 + \left(x - y \cdot z\right)\\
\end{array}
\end{array}
if y < -7.9999999999999998e120 or 5.2e5 < y Initial program 99.9%
Taylor expanded in y around 0 38.2%
+-commutative38.2%
Simplified38.2%
if -7.9999999999999998e120 < y < 5.2e5Initial program 100.0%
Taylor expanded in y around 0 89.7%
mul-1-neg89.7%
unsub-neg89.7%
Simplified89.7%
Final simplification71.4%
(FPCore (x y z) :precision binary64 (if (<= x -1.0) x (if (<= x 0.000115) 1.0 x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -1.0) {
tmp = x;
} else if (x <= 0.000115) {
tmp = 1.0;
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (x <= (-1.0d0)) then
tmp = x
else if (x <= 0.000115d0) then
tmp = 1.0d0
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -1.0) {
tmp = x;
} else if (x <= 0.000115) {
tmp = 1.0;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -1.0: tmp = x elif x <= 0.000115: tmp = 1.0 else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -1.0) tmp = x; elseif (x <= 0.000115) tmp = 1.0; 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.000115) tmp = 1.0; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -1.0], x, If[LessEqual[x, 0.000115], 1.0, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 0.000115:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -1 or 1.15e-4 < x Initial program 99.9%
Taylor expanded in x around inf 81.8%
if -1 < x < 1.15e-4Initial program 99.9%
Taylor expanded in x around 0 98.0%
Taylor expanded in y around 0 43.0%
(FPCore (x y z) :precision binary64 (if (<= z -4e+139) (- 1.0 (* y z)) (+ x 1.0)))
double code(double x, double y, double z) {
double tmp;
if (z <= -4e+139) {
tmp = 1.0 - (y * z);
} else {
tmp = x + 1.0;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (z <= (-4d+139)) then
tmp = 1.0d0 - (y * z)
else
tmp = x + 1.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -4e+139) {
tmp = 1.0 - (y * z);
} else {
tmp = x + 1.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -4e+139: tmp = 1.0 - (y * z) else: tmp = x + 1.0 return tmp
function code(x, y, z) tmp = 0.0 if (z <= -4e+139) tmp = Float64(1.0 - Float64(y * z)); else tmp = Float64(x + 1.0); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -4e+139) tmp = 1.0 - (y * z); else tmp = x + 1.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -4e+139], N[(1.0 - N[(y * z), $MachinePrecision]), $MachinePrecision], N[(x + 1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4 \cdot 10^{+139}:\\
\;\;\;\;1 - y \cdot z\\
\mathbf{else}:\\
\;\;\;\;x + 1\\
\end{array}
\end{array}
if z < -4.00000000000000013e139Initial program 99.8%
Taylor expanded in x around 0 94.2%
Taylor expanded in y around 0 54.1%
mul-1-neg54.1%
*-commutative54.1%
unsub-neg54.1%
Simplified54.1%
if -4.00000000000000013e139 < z Initial program 99.9%
Taylor expanded in y around 0 70.1%
+-commutative70.1%
Simplified70.1%
Final simplification67.7%
(FPCore (x y z) :precision binary64 (if (<= z -4.1e+139) (* y (- z)) (+ x 1.0)))
double code(double x, double y, double z) {
double tmp;
if (z <= -4.1e+139) {
tmp = 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 <= (-4.1d+139)) then
tmp = 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 <= -4.1e+139) {
tmp = y * -z;
} else {
tmp = x + 1.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -4.1e+139: tmp = y * -z else: tmp = x + 1.0 return tmp
function code(x, y, z) tmp = 0.0 if (z <= -4.1e+139) tmp = Float64(y * Float64(-z)); else tmp = Float64(x + 1.0); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -4.1e+139) tmp = y * -z; else tmp = x + 1.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -4.1e+139], N[(y * (-z)), $MachinePrecision], N[(x + 1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.1 \cdot 10^{+139}:\\
\;\;\;\;y \cdot \left(-z\right)\\
\mathbf{else}:\\
\;\;\;\;x + 1\\
\end{array}
\end{array}
if z < -4.1000000000000002e139Initial program 99.8%
Taylor expanded in x around 0 94.2%
Taylor expanded in y around 0 54.1%
*-commutative54.1%
Simplified54.1%
Taylor expanded in z around inf 44.2%
associate-*r*44.2%
*-commutative44.2%
mul-1-neg44.2%
Simplified44.2%
if -4.1000000000000002e139 < z Initial program 99.9%
Taylor expanded in y around 0 70.1%
+-commutative70.1%
Simplified70.1%
Final simplification66.3%
(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 62.5%
+-commutative62.5%
Simplified62.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 x around 0 60.8%
Taylor expanded in y around 0 23.8%
herbie shell --seed 2024141
(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))))