
(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 14 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%
cancel-sign-sub-inv99.9%
+-commutative99.9%
*-commutative99.9%
fma-def99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y z) :precision binary64 (if (<= x -8.4e+46) x (if (<= x 2.4e+16) (- (cos y) (* (sin y) z)) (+ x 1.0))))
double code(double x, double y, double z) {
double tmp;
if (x <= -8.4e+46) {
tmp = x;
} else if (x <= 2.4e+16) {
tmp = cos(y) - (sin(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 (x <= (-8.4d+46)) then
tmp = x
else if (x <= 2.4d+16) then
tmp = cos(y) - (sin(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 (x <= -8.4e+46) {
tmp = x;
} else if (x <= 2.4e+16) {
tmp = Math.cos(y) - (Math.sin(y) * z);
} else {
tmp = x + 1.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -8.4e+46: tmp = x elif x <= 2.4e+16: tmp = math.cos(y) - (math.sin(y) * z) else: tmp = x + 1.0 return tmp
function code(x, y, z) tmp = 0.0 if (x <= -8.4e+46) tmp = x; elseif (x <= 2.4e+16) tmp = Float64(cos(y) - Float64(sin(y) * z)); else tmp = Float64(x + 1.0); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -8.4e+46) tmp = x; elseif (x <= 2.4e+16) tmp = cos(y) - (sin(y) * z); else tmp = x + 1.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -8.4e+46], x, If[LessEqual[x, 2.4e+16], N[(N[Cos[y], $MachinePrecision] - N[(N[Sin[y], $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], N[(x + 1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -8.4 \cdot 10^{+46}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 2.4 \cdot 10^{+16}:\\
\;\;\;\;\cos y - \sin y \cdot z\\
\mathbf{else}:\\
\;\;\;\;x + 1\\
\end{array}
\end{array}
if x < -8.4e46Initial program 100.0%
Taylor expanded in x around inf 87.5%
if -8.4e46 < x < 2.4e16Initial program 99.9%
Taylor expanded in x around 0 97.2%
if 2.4e16 < x Initial program 99.9%
Taylor expanded in y around 0 83.9%
+-commutative83.9%
Simplified83.9%
Final simplification92.1%
(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
(if (<= z -2.5e+196)
(- (+ 1.0 (+ x (* -0.5 (* y y)))) (* (sin y) z))
(if (or (<= z -4.9e+64) (not (<= z 5.2e+56)))
(* (sin y) (- z))
(+ x (cos y)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -2.5e+196) {
tmp = (1.0 + (x + (-0.5 * (y * y)))) - (sin(y) * z);
} else if ((z <= -4.9e+64) || !(z <= 5.2e+56)) {
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 <= (-2.5d+196)) then
tmp = (1.0d0 + (x + ((-0.5d0) * (y * y)))) - (sin(y) * z)
else if ((z <= (-4.9d+64)) .or. (.not. (z <= 5.2d+56))) 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 <= -2.5e+196) {
tmp = (1.0 + (x + (-0.5 * (y * y)))) - (Math.sin(y) * z);
} else if ((z <= -4.9e+64) || !(z <= 5.2e+56)) {
tmp = Math.sin(y) * -z;
} else {
tmp = x + Math.cos(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -2.5e+196: tmp = (1.0 + (x + (-0.5 * (y * y)))) - (math.sin(y) * z) elif (z <= -4.9e+64) or not (z <= 5.2e+56): tmp = math.sin(y) * -z else: tmp = x + math.cos(y) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -2.5e+196) tmp = Float64(Float64(1.0 + Float64(x + Float64(-0.5 * Float64(y * y)))) - Float64(sin(y) * z)); elseif ((z <= -4.9e+64) || !(z <= 5.2e+56)) 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 <= -2.5e+196) tmp = (1.0 + (x + (-0.5 * (y * y)))) - (sin(y) * z); elseif ((z <= -4.9e+64) || ~((z <= 5.2e+56))) tmp = sin(y) * -z; else tmp = x + cos(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -2.5e+196], N[(N[(1.0 + N[(x + N[(-0.5 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[Sin[y], $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[z, -4.9e+64], N[Not[LessEqual[z, 5.2e+56]], $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 -2.5 \cdot 10^{+196}:\\
\;\;\;\;\left(1 + \left(x + -0.5 \cdot \left(y \cdot y\right)\right)\right) - \sin y \cdot z\\
\mathbf{elif}\;z \leq -4.9 \cdot 10^{+64} \lor \neg \left(z \leq 5.2 \cdot 10^{+56}\right):\\
\;\;\;\;\sin y \cdot \left(-z\right)\\
\mathbf{else}:\\
\;\;\;\;x + \cos y\\
\end{array}
\end{array}
if z < -2.4999999999999999e196Initial program 99.8%
Taylor expanded in y around 0 79.3%
unpow279.3%
Simplified79.3%
if -2.4999999999999999e196 < z < -4.9000000000000003e64 or 5.20000000000000022e56 < z Initial program 99.8%
Taylor expanded in z around inf 72.3%
neg-mul-172.3%
distribute-rgt-neg-in72.3%
Simplified72.3%
if -4.9000000000000003e64 < z < 5.20000000000000022e56Initial program 100.0%
Taylor expanded in z around 0 95.0%
+-commutative95.0%
Simplified95.0%
Final simplification86.4%
(FPCore (x y z) :precision binary64 (if (or (<= z -3.2e+63) (not (<= z 8.5e+55))) (* (sin y) (- z)) (+ x (cos y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -3.2e+63) || !(z <= 8.5e+55)) {
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 <= (-3.2d+63)) .or. (.not. (z <= 8.5d+55))) 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 <= -3.2e+63) || !(z <= 8.5e+55)) {
tmp = Math.sin(y) * -z;
} else {
tmp = x + Math.cos(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -3.2e+63) or not (z <= 8.5e+55): tmp = math.sin(y) * -z else: tmp = x + math.cos(y) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -3.2e+63) || !(z <= 8.5e+55)) 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 <= -3.2e+63) || ~((z <= 8.5e+55))) tmp = sin(y) * -z; else tmp = x + cos(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -3.2e+63], N[Not[LessEqual[z, 8.5e+55]], $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 -3.2 \cdot 10^{+63} \lor \neg \left(z \leq 8.5 \cdot 10^{+55}\right):\\
\;\;\;\;\sin y \cdot \left(-z\right)\\
\mathbf{else}:\\
\;\;\;\;x + \cos y\\
\end{array}
\end{array}
if z < -3.20000000000000011e63 or 8.50000000000000002e55 < z Initial program 99.8%
Taylor expanded in z around inf 70.0%
neg-mul-170.0%
distribute-rgt-neg-in70.0%
Simplified70.0%
if -3.20000000000000011e63 < z < 8.50000000000000002e55Initial program 100.0%
Taylor expanded in z around 0 95.0%
+-commutative95.0%
Simplified95.0%
Final simplification84.7%
(FPCore (x y z)
:precision binary64
(if (<= x -8.2e+46)
x
(if (<= x -1.75e-29)
(+ x (- 1.0 (* y z)))
(if (<= x 14.5) (cos y) (+ x 1.0)))))
double code(double x, double y, double z) {
double tmp;
if (x <= -8.2e+46) {
tmp = x;
} else if (x <= -1.75e-29) {
tmp = x + (1.0 - (y * z));
} else if (x <= 14.5) {
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 <= (-8.2d+46)) then
tmp = x
else if (x <= (-1.75d-29)) then
tmp = x + (1.0d0 - (y * z))
else if (x <= 14.5d0) 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 <= -8.2e+46) {
tmp = x;
} else if (x <= -1.75e-29) {
tmp = x + (1.0 - (y * z));
} else if (x <= 14.5) {
tmp = Math.cos(y);
} else {
tmp = x + 1.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -8.2e+46: tmp = x elif x <= -1.75e-29: tmp = x + (1.0 - (y * z)) elif x <= 14.5: tmp = math.cos(y) else: tmp = x + 1.0 return tmp
function code(x, y, z) tmp = 0.0 if (x <= -8.2e+46) tmp = x; elseif (x <= -1.75e-29) tmp = Float64(x + Float64(1.0 - Float64(y * z))); elseif (x <= 14.5) 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 <= -8.2e+46) tmp = x; elseif (x <= -1.75e-29) tmp = x + (1.0 - (y * z)); elseif (x <= 14.5) tmp = cos(y); else tmp = x + 1.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -8.2e+46], x, If[LessEqual[x, -1.75e-29], N[(x + N[(1.0 - N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 14.5], N[Cos[y], $MachinePrecision], N[(x + 1.0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -8.2 \cdot 10^{+46}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq -1.75 \cdot 10^{-29}:\\
\;\;\;\;x + \left(1 - y \cdot z\right)\\
\mathbf{elif}\;x \leq 14.5:\\
\;\;\;\;\cos y\\
\mathbf{else}:\\
\;\;\;\;x + 1\\
\end{array}
\end{array}
if x < -8.19999999999999999e46Initial program 100.0%
Taylor expanded in x around inf 87.5%
if -8.19999999999999999e46 < x < -1.7499999999999999e-29Initial program 99.9%
Taylor expanded in y around 0 60.5%
associate-+r+60.5%
+-commutative60.5%
associate-+l+60.5%
mul-1-neg60.5%
unsub-neg60.5%
Simplified60.5%
if -1.7499999999999999e-29 < x < 14.5Initial program 99.8%
Taylor expanded in z around 0 59.2%
+-commutative59.2%
Simplified59.2%
Taylor expanded in x around 0 58.5%
if 14.5 < x Initial program 100.0%
Taylor expanded in y around 0 81.3%
+-commutative81.3%
Simplified81.3%
Final simplification69.9%
(FPCore (x y z) :precision binary64 (if (or (<= y -0.00205) (not (<= y 0.1))) (+ x (cos y)) (+ x (+ 1.0 (- (* y (* y -0.5)) (* y z))))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -0.00205) || !(y <= 0.1)) {
tmp = x + cos(y);
} else {
tmp = x + (1.0 + ((y * (y * -0.5)) - (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.00205d0)) .or. (.not. (y <= 0.1d0))) then
tmp = x + cos(y)
else
tmp = x + (1.0d0 + ((y * (y * (-0.5d0))) - (y * z)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -0.00205) || !(y <= 0.1)) {
tmp = x + Math.cos(y);
} else {
tmp = x + (1.0 + ((y * (y * -0.5)) - (y * z)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -0.00205) or not (y <= 0.1): tmp = x + math.cos(y) else: tmp = x + (1.0 + ((y * (y * -0.5)) - (y * z))) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -0.00205) || !(y <= 0.1)) tmp = Float64(x + cos(y)); else tmp = Float64(x + Float64(1.0 + Float64(Float64(y * Float64(y * -0.5)) - Float64(y * z)))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -0.00205) || ~((y <= 0.1))) tmp = x + cos(y); else tmp = x + (1.0 + ((y * (y * -0.5)) - (y * z))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -0.00205], N[Not[LessEqual[y, 0.1]], $MachinePrecision]], N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision], N[(x + N[(1.0 + N[(N[(y * N[(y * -0.5), $MachinePrecision]), $MachinePrecision] - N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -0.00205 \lor \neg \left(y \leq 0.1\right):\\
\;\;\;\;x + \cos y\\
\mathbf{else}:\\
\;\;\;\;x + \left(1 + \left(y \cdot \left(y \cdot -0.5\right) - y \cdot z\right)\right)\\
\end{array}
\end{array}
if y < -0.00205000000000000017 or 0.10000000000000001 < y Initial program 99.8%
Taylor expanded in z around 0 59.9%
+-commutative59.9%
Simplified59.9%
if -0.00205000000000000017 < y < 0.10000000000000001Initial program 100.0%
Taylor expanded in y around 0 98.5%
associate-+r+98.5%
+-commutative98.5%
associate-+l+98.5%
+-commutative98.5%
mul-1-neg98.5%
unsub-neg98.5%
*-commutative98.5%
unpow298.5%
associate-*l*98.5%
Simplified98.5%
Final simplification78.9%
(FPCore (x y z) :precision binary64 (if (or (<= y -1400.0) (not (<= y 1900000.0))) (+ x 1.0) (+ x (+ 1.0 (- (* y (* y -0.5)) (* y z))))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -1400.0) || !(y <= 1900000.0)) {
tmp = x + 1.0;
} else {
tmp = x + (1.0 + ((y * (y * -0.5)) - (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 <= (-1400.0d0)) .or. (.not. (y <= 1900000.0d0))) then
tmp = x + 1.0d0
else
tmp = x + (1.0d0 + ((y * (y * (-0.5d0))) - (y * z)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -1400.0) || !(y <= 1900000.0)) {
tmp = x + 1.0;
} else {
tmp = x + (1.0 + ((y * (y * -0.5)) - (y * z)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -1400.0) or not (y <= 1900000.0): tmp = x + 1.0 else: tmp = x + (1.0 + ((y * (y * -0.5)) - (y * z))) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -1400.0) || !(y <= 1900000.0)) tmp = Float64(x + 1.0); else tmp = Float64(x + Float64(1.0 + Float64(Float64(y * Float64(y * -0.5)) - Float64(y * z)))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -1400.0) || ~((y <= 1900000.0))) tmp = x + 1.0; else tmp = x + (1.0 + ((y * (y * -0.5)) - (y * z))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -1400.0], N[Not[LessEqual[y, 1900000.0]], $MachinePrecision]], N[(x + 1.0), $MachinePrecision], N[(x + N[(1.0 + N[(N[(y * N[(y * -0.5), $MachinePrecision]), $MachinePrecision] - N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1400 \lor \neg \left(y \leq 1900000\right):\\
\;\;\;\;x + 1\\
\mathbf{else}:\\
\;\;\;\;x + \left(1 + \left(y \cdot \left(y \cdot -0.5\right) - y \cdot z\right)\right)\\
\end{array}
\end{array}
if y < -1400 or 1.9e6 < y Initial program 99.8%
Taylor expanded in y around 0 37.4%
+-commutative37.4%
Simplified37.4%
if -1400 < y < 1.9e6Initial program 100.0%
Taylor expanded in y around 0 96.3%
associate-+r+96.3%
+-commutative96.3%
associate-+l+96.3%
+-commutative96.3%
mul-1-neg96.3%
unsub-neg96.3%
*-commutative96.3%
unpow296.3%
associate-*l*96.3%
Simplified96.3%
Final simplification67.3%
(FPCore (x y z) :precision binary64 (if (<= y -4.4e+26) (+ x 1.0) (if (<= y 510000.0) (+ x (- 1.0 (* y z))) (+ x 1.0))))
double code(double x, double y, double z) {
double tmp;
if (y <= -4.4e+26) {
tmp = x + 1.0;
} else if (y <= 510000.0) {
tmp = x + (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 (y <= (-4.4d+26)) then
tmp = x + 1.0d0
else if (y <= 510000.0d0) then
tmp = x + (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 (y <= -4.4e+26) {
tmp = x + 1.0;
} else if (y <= 510000.0) {
tmp = x + (1.0 - (y * z));
} else {
tmp = x + 1.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -4.4e+26: tmp = x + 1.0 elif y <= 510000.0: tmp = x + (1.0 - (y * z)) else: tmp = x + 1.0 return tmp
function code(x, y, z) tmp = 0.0 if (y <= -4.4e+26) tmp = Float64(x + 1.0); elseif (y <= 510000.0) tmp = Float64(x + 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 (y <= -4.4e+26) tmp = x + 1.0; elseif (y <= 510000.0) tmp = x + (1.0 - (y * z)); else tmp = x + 1.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -4.4e+26], N[(x + 1.0), $MachinePrecision], If[LessEqual[y, 510000.0], N[(x + N[(1.0 - N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + 1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.4 \cdot 10^{+26}:\\
\;\;\;\;x + 1\\
\mathbf{elif}\;y \leq 510000:\\
\;\;\;\;x + \left(1 - y \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x + 1\\
\end{array}
\end{array}
if y < -4.40000000000000014e26 or 5.1e5 < y Initial program 99.8%
Taylor expanded in y around 0 38.5%
+-commutative38.5%
Simplified38.5%
if -4.40000000000000014e26 < y < 5.1e5Initial program 100.0%
Taylor expanded in y around 0 91.4%
associate-+r+91.4%
+-commutative91.4%
associate-+l+91.4%
mul-1-neg91.4%
unsub-neg91.4%
Simplified91.4%
Final simplification67.2%
(FPCore (x y z) :precision binary64 (if (<= x -1.25e+18) x (if (<= x 2.1e+14) (- 1.0 (* y z)) (+ x 1.0))))
double code(double x, double y, double z) {
double tmp;
if (x <= -1.25e+18) {
tmp = x;
} else if (x <= 2.1e+14) {
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 (x <= (-1.25d+18)) then
tmp = x
else if (x <= 2.1d+14) 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 (x <= -1.25e+18) {
tmp = x;
} else if (x <= 2.1e+14) {
tmp = 1.0 - (y * z);
} else {
tmp = x + 1.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -1.25e+18: tmp = x elif x <= 2.1e+14: tmp = 1.0 - (y * z) else: tmp = x + 1.0 return tmp
function code(x, y, z) tmp = 0.0 if (x <= -1.25e+18) tmp = x; elseif (x <= 2.1e+14) 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 (x <= -1.25e+18) tmp = x; elseif (x <= 2.1e+14) tmp = 1.0 - (y * z); else tmp = x + 1.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -1.25e+18], x, If[LessEqual[x, 2.1e+14], N[(1.0 - N[(y * z), $MachinePrecision]), $MachinePrecision], N[(x + 1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.25 \cdot 10^{+18}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 2.1 \cdot 10^{+14}:\\
\;\;\;\;1 - y \cdot z\\
\mathbf{else}:\\
\;\;\;\;x + 1\\
\end{array}
\end{array}
if x < -1.25e18Initial program 100.0%
Taylor expanded in x around inf 83.0%
if -1.25e18 < x < 2.1e14Initial program 99.8%
Taylor expanded in x around 0 97.8%
Taylor expanded in y around 0 50.7%
mul-1-neg50.7%
unsub-neg50.7%
*-commutative50.7%
Simplified50.7%
if 2.1e14 < x Initial program 99.9%
Taylor expanded in y around 0 83.9%
+-commutative83.9%
Simplified83.9%
Final simplification65.4%
(FPCore (x y z) :precision binary64 (if (<= z -5.7e+237) (* y (- z)) (+ x 1.0)))
double code(double x, double y, double z) {
double tmp;
if (z <= -5.7e+237) {
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 <= (-5.7d+237)) 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 <= -5.7e+237) {
tmp = y * -z;
} else {
tmp = x + 1.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -5.7e+237: tmp = y * -z else: tmp = x + 1.0 return tmp
function code(x, y, z) tmp = 0.0 if (z <= -5.7e+237) 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 <= -5.7e+237) tmp = y * -z; else tmp = x + 1.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -5.7e+237], N[(y * (-z)), $MachinePrecision], N[(x + 1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.7 \cdot 10^{+237}:\\
\;\;\;\;y \cdot \left(-z\right)\\
\mathbf{else}:\\
\;\;\;\;x + 1\\
\end{array}
\end{array}
if z < -5.69999999999999993e237Initial program 99.8%
Taylor expanded in x around 0 80.1%
Taylor expanded in y around 0 50.3%
mul-1-neg50.3%
unsub-neg50.3%
*-commutative50.3%
Simplified50.3%
Taylor expanded in z around inf 50.3%
associate-*r*50.3%
neg-mul-150.3%
Simplified50.3%
if -5.69999999999999993e237 < z Initial program 99.9%
Taylor expanded in y around 0 59.4%
+-commutative59.4%
Simplified59.4%
Final simplification58.9%
(FPCore (x y z) :precision binary64 (if (<= x -0.96) x (if (<= x 14.5) 1.0 x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -0.96) {
tmp = x;
} else if (x <= 14.5) {
tmp = 1.0;
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (x <= (-0.96d0)) then
tmp = x
else if (x <= 14.5d0) then
tmp = 1.0d0
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -0.96) {
tmp = x;
} else if (x <= 14.5) {
tmp = 1.0;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -0.96: tmp = x elif x <= 14.5: tmp = 1.0 else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -0.96) tmp = x; elseif (x <= 14.5) tmp = 1.0; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -0.96) tmp = x; elseif (x <= 14.5) tmp = 1.0; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -0.96], x, If[LessEqual[x, 14.5], 1.0, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.96:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 14.5:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -0.95999999999999996 or 14.5 < x Initial program 100.0%
Taylor expanded in x around inf 80.4%
if -0.95999999999999996 < x < 14.5Initial program 99.8%
Taylor expanded in x around 0 99.1%
Taylor expanded in y around 0 36.5%
Final simplification57.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 57.2%
+-commutative57.2%
Simplified57.2%
Final simplification57.2%
(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 62.4%
Taylor expanded in y around 0 20.7%
Final simplification20.7%
herbie shell --seed 2023290
(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))))