
(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 14 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%
(FPCore (x y z) :precision binary64 (if (<= z -48000000.0) (fma z (cos y) x) (if (<= z 3.5e-30) (+ z (+ x (sin y))) (+ x (* z (cos y))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -48000000.0) {
tmp = fma(z, cos(y), x);
} else if (z <= 3.5e-30) {
tmp = z + (x + sin(y));
} else {
tmp = x + (z * cos(y));
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (z <= -48000000.0) tmp = fma(z, cos(y), x); elseif (z <= 3.5e-30) tmp = Float64(z + Float64(x + sin(y))); else tmp = Float64(x + Float64(z * cos(y))); end return tmp end
code[x_, y_, z_] := If[LessEqual[z, -48000000.0], N[(z * N[Cos[y], $MachinePrecision] + x), $MachinePrecision], If[LessEqual[z, 3.5e-30], N[(z + N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -48000000:\\
\;\;\;\;\mathsf{fma}\left(z, \cos y, x\right)\\
\mathbf{elif}\;z \leq 3.5 \cdot 10^{-30}:\\
\;\;\;\;z + \left(x + \sin y\right)\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \cos y\\
\end{array}
\end{array}
if z < -4.8e7Initial program 99.8%
+-commutative99.8%
fma-define99.8%
Simplified99.8%
Taylor expanded in x around inf 99.4%
if -4.8e7 < z < 3.5000000000000003e-30Initial program 100.0%
Taylor expanded in y around 0 99.0%
if 3.5000000000000003e-30 < z Initial program 99.9%
Taylor expanded in x around inf 98.6%
Final simplification99.0%
(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%
(FPCore (x y z) :precision binary64 (if (<= z -1.95e+154) (* z (cos y)) (if (or (<= z -0.049) (not (<= z 1.25e-50))) (+ z x) (+ x (sin y)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -1.95e+154) {
tmp = z * cos(y);
} else if ((z <= -0.049) || !(z <= 1.25e-50)) {
tmp = z + x;
} 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 <= (-1.95d+154)) then
tmp = z * cos(y)
else if ((z <= (-0.049d0)) .or. (.not. (z <= 1.25d-50))) then
tmp = z + x
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 <= -1.95e+154) {
tmp = z * Math.cos(y);
} else if ((z <= -0.049) || !(z <= 1.25e-50)) {
tmp = z + x;
} else {
tmp = x + Math.sin(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1.95e+154: tmp = z * math.cos(y) elif (z <= -0.049) or not (z <= 1.25e-50): tmp = z + x else: tmp = x + math.sin(y) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -1.95e+154) tmp = Float64(z * cos(y)); elseif ((z <= -0.049) || !(z <= 1.25e-50)) tmp = Float64(z + x); else tmp = Float64(x + sin(y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -1.95e+154) tmp = z * cos(y); elseif ((z <= -0.049) || ~((z <= 1.25e-50))) tmp = z + x; else tmp = x + sin(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -1.95e+154], N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[z, -0.049], N[Not[LessEqual[z, 1.25e-50]], $MachinePrecision]], N[(z + x), $MachinePrecision], N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.95 \cdot 10^{+154}:\\
\;\;\;\;z \cdot \cos y\\
\mathbf{elif}\;z \leq -0.049 \lor \neg \left(z \leq 1.25 \cdot 10^{-50}\right):\\
\;\;\;\;z + x\\
\mathbf{else}:\\
\;\;\;\;x + \sin y\\
\end{array}
\end{array}
if z < -1.9500000000000001e154Initial program 99.7%
+-commutative99.7%
fma-define99.8%
Simplified99.8%
Taylor expanded in z around inf 91.2%
if -1.9500000000000001e154 < z < -0.049000000000000002 or 1.24999999999999992e-50 < z Initial program 99.9%
+-commutative99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in y around 0 76.9%
if -0.049000000000000002 < z < 1.24999999999999992e-50Initial program 100.0%
+-commutative100.0%
fma-define100.0%
Simplified100.0%
Taylor expanded in z around 0 95.3%
+-commutative95.3%
Simplified95.3%
Final simplification86.6%
(FPCore (x y z) :precision binary64 (if (or (<= z -48000000.0) (not (<= z 3.5e-30))) (+ x (* z (cos y))) (+ z (+ x (sin y)))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -48000000.0) || !(z <= 3.5e-30)) {
tmp = x + (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 <= (-48000000.0d0)) .or. (.not. (z <= 3.5d-30))) then
tmp = x + (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 <= -48000000.0) || !(z <= 3.5e-30)) {
tmp = x + (z * Math.cos(y));
} else {
tmp = z + (x + Math.sin(y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -48000000.0) or not (z <= 3.5e-30): tmp = x + (z * math.cos(y)) else: tmp = z + (x + math.sin(y)) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -48000000.0) || !(z <= 3.5e-30)) tmp = Float64(x + 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 <= -48000000.0) || ~((z <= 3.5e-30))) tmp = x + (z * cos(y)); else tmp = z + (x + sin(y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -48000000.0], N[Not[LessEqual[z, 3.5e-30]], $MachinePrecision]], N[(x + N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(z + N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -48000000 \lor \neg \left(z \leq 3.5 \cdot 10^{-30}\right):\\
\;\;\;\;x + z \cdot \cos y\\
\mathbf{else}:\\
\;\;\;\;z + \left(x + \sin y\right)\\
\end{array}
\end{array}
if z < -4.8e7 or 3.5000000000000003e-30 < z Initial program 99.8%
Taylor expanded in x around inf 99.0%
if -4.8e7 < z < 3.5000000000000003e-30Initial program 100.0%
Taylor expanded in y around 0 99.0%
Final simplification99.0%
(FPCore (x y z) :precision binary64 (if (or (<= z -0.049) (not (<= z 2.4e-50))) (+ x (* z (cos y))) (+ x (sin y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -0.049) || !(z <= 2.4e-50)) {
tmp = x + (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 <= (-0.049d0)) .or. (.not. (z <= 2.4d-50))) then
tmp = x + (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 <= -0.049) || !(z <= 2.4e-50)) {
tmp = x + (z * Math.cos(y));
} else {
tmp = x + Math.sin(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -0.049) or not (z <= 2.4e-50): tmp = x + (z * math.cos(y)) else: tmp = x + math.sin(y) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -0.049) || !(z <= 2.4e-50)) tmp = Float64(x + 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 <= -0.049) || ~((z <= 2.4e-50))) tmp = x + (z * cos(y)); else tmp = x + sin(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -0.049], N[Not[LessEqual[z, 2.4e-50]], $MachinePrecision]], N[(x + N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.049 \lor \neg \left(z \leq 2.4 \cdot 10^{-50}\right):\\
\;\;\;\;x + z \cdot \cos y\\
\mathbf{else}:\\
\;\;\;\;x + \sin y\\
\end{array}
\end{array}
if z < -0.049000000000000002 or 2.40000000000000002e-50 < z Initial program 99.8%
Taylor expanded in x around inf 97.5%
if -0.049000000000000002 < z < 2.40000000000000002e-50Initial program 100.0%
+-commutative100.0%
fma-define100.0%
Simplified100.0%
Taylor expanded in z around 0 95.3%
+-commutative95.3%
Simplified95.3%
Final simplification96.6%
(FPCore (x y z) :precision binary64 (if (or (<= x -1.15e-6) (not (<= x 1.8e-14))) (+ z x) (* z (cos y))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -1.15e-6) || !(x <= 1.8e-14)) {
tmp = z + x;
} else {
tmp = z * 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 <= (-1.15d-6)) .or. (.not. (x <= 1.8d-14))) then
tmp = z + x
else
tmp = z * cos(y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -1.15e-6) || !(x <= 1.8e-14)) {
tmp = z + x;
} else {
tmp = z * Math.cos(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -1.15e-6) or not (x <= 1.8e-14): tmp = z + x else: tmp = z * math.cos(y) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -1.15e-6) || !(x <= 1.8e-14)) tmp = Float64(z + x); else tmp = Float64(z * cos(y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -1.15e-6) || ~((x <= 1.8e-14))) tmp = z + x; else tmp = z * cos(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -1.15e-6], N[Not[LessEqual[x, 1.8e-14]], $MachinePrecision]], N[(z + x), $MachinePrecision], N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.15 \cdot 10^{-6} \lor \neg \left(x \leq 1.8 \cdot 10^{-14}\right):\\
\;\;\;\;z + x\\
\mathbf{else}:\\
\;\;\;\;z \cdot \cos y\\
\end{array}
\end{array}
if x < -1.15e-6 or 1.7999999999999999e-14 < x Initial program 99.9%
+-commutative99.9%
fma-define100.0%
Simplified100.0%
Taylor expanded in y around 0 91.7%
if -1.15e-6 < x < 1.7999999999999999e-14Initial program 99.9%
+-commutative99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in z around inf 60.4%
Final simplification75.8%
(FPCore (x y z) :precision binary64 (if (<= y -1.15e+145) (+ z x) (if (<= y -1.05e+76) (sin y) (if (<= y 1.45e+19) (+ z (+ y x)) (+ z x)))))
double code(double x, double y, double z) {
double tmp;
if (y <= -1.15e+145) {
tmp = z + x;
} else if (y <= -1.05e+76) {
tmp = sin(y);
} else if (y <= 1.45e+19) {
tmp = z + (y + x);
} 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 (y <= (-1.15d+145)) then
tmp = z + x
else if (y <= (-1.05d+76)) then
tmp = sin(y)
else if (y <= 1.45d+19) then
tmp = z + (y + x)
else
tmp = z + x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -1.15e+145) {
tmp = z + x;
} else if (y <= -1.05e+76) {
tmp = Math.sin(y);
} else if (y <= 1.45e+19) {
tmp = z + (y + x);
} else {
tmp = z + x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -1.15e+145: tmp = z + x elif y <= -1.05e+76: tmp = math.sin(y) elif y <= 1.45e+19: tmp = z + (y + x) else: tmp = z + x return tmp
function code(x, y, z) tmp = 0.0 if (y <= -1.15e+145) tmp = Float64(z + x); elseif (y <= -1.05e+76) tmp = sin(y); elseif (y <= 1.45e+19) tmp = Float64(z + Float64(y + x)); else tmp = Float64(z + x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -1.15e+145) tmp = z + x; elseif (y <= -1.05e+76) tmp = sin(y); elseif (y <= 1.45e+19) tmp = z + (y + x); else tmp = z + x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -1.15e+145], N[(z + x), $MachinePrecision], If[LessEqual[y, -1.05e+76], N[Sin[y], $MachinePrecision], If[LessEqual[y, 1.45e+19], N[(z + N[(y + x), $MachinePrecision]), $MachinePrecision], N[(z + x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.15 \cdot 10^{+145}:\\
\;\;\;\;z + x\\
\mathbf{elif}\;y \leq -1.05 \cdot 10^{+76}:\\
\;\;\;\;\sin y\\
\mathbf{elif}\;y \leq 1.45 \cdot 10^{+19}:\\
\;\;\;\;z + \left(y + x\right)\\
\mathbf{else}:\\
\;\;\;\;z + x\\
\end{array}
\end{array}
if y < -1.15e145 or 1.45e19 < y Initial program 99.9%
+-commutative99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in y around 0 42.9%
if -1.15e145 < y < -1.05000000000000003e76Initial program 99.8%
+-commutative99.8%
fma-define99.8%
Simplified99.8%
Taylor expanded in z around 0 57.0%
+-commutative57.0%
Simplified57.0%
Taylor expanded in x around 0 47.3%
if -1.05000000000000003e76 < y < 1.45e19Initial program 99.9%
+-commutative99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in y around 0 90.3%
associate-+r+90.3%
+-commutative90.3%
Simplified90.3%
Final simplification72.8%
(FPCore (x y z) :precision binary64 (if (or (<= y -1600.0) (not (<= y 2.5e+63))) (+ z x) (+ x (+ z (* y (+ 1.0 (* y (+ (* z -0.5) (* y -0.16666666666666666)))))))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -1600.0) || !(y <= 2.5e+63)) {
tmp = z + x;
} else {
tmp = x + (z + (y * (1.0 + (y * ((z * -0.5) + (y * -0.16666666666666666))))));
}
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 <= (-1600.0d0)) .or. (.not. (y <= 2.5d+63))) then
tmp = z + x
else
tmp = x + (z + (y * (1.0d0 + (y * ((z * (-0.5d0)) + (y * (-0.16666666666666666d0)))))))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -1600.0) || !(y <= 2.5e+63)) {
tmp = z + x;
} else {
tmp = x + (z + (y * (1.0 + (y * ((z * -0.5) + (y * -0.16666666666666666))))));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -1600.0) or not (y <= 2.5e+63): tmp = z + x else: tmp = x + (z + (y * (1.0 + (y * ((z * -0.5) + (y * -0.16666666666666666)))))) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -1600.0) || !(y <= 2.5e+63)) tmp = Float64(z + x); else tmp = Float64(x + Float64(z + Float64(y * Float64(1.0 + Float64(y * Float64(Float64(z * -0.5) + Float64(y * -0.16666666666666666))))))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -1600.0) || ~((y <= 2.5e+63))) tmp = z + x; else tmp = x + (z + (y * (1.0 + (y * ((z * -0.5) + (y * -0.16666666666666666)))))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -1600.0], N[Not[LessEqual[y, 2.5e+63]], $MachinePrecision]], N[(z + x), $MachinePrecision], N[(x + N[(z + N[(y * N[(1.0 + N[(y * N[(N[(z * -0.5), $MachinePrecision] + N[(y * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1600 \lor \neg \left(y \leq 2.5 \cdot 10^{+63}\right):\\
\;\;\;\;z + x\\
\mathbf{else}:\\
\;\;\;\;x + \left(z + y \cdot \left(1 + y \cdot \left(z \cdot -0.5 + y \cdot -0.16666666666666666\right)\right)\right)\\
\end{array}
\end{array}
if y < -1600 or 2.50000000000000005e63 < y Initial program 99.8%
+-commutative99.8%
fma-define99.8%
Simplified99.8%
Taylor expanded in y around 0 38.3%
if -1600 < y < 2.50000000000000005e63Initial program 100.0%
+-commutative100.0%
fma-define100.0%
Simplified100.0%
Taylor expanded in y around 0 96.8%
Final simplification71.0%
(FPCore (x y z) :precision binary64 (if (or (<= y -1600.0) (not (<= y 2.5e+63))) (+ z x) (+ (+ z x) (* y (+ 1.0 (* -0.5 (* z y)))))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -1600.0) || !(y <= 2.5e+63)) {
tmp = z + x;
} else {
tmp = (z + x) + (y * (1.0 + (-0.5 * (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 ((y <= (-1600.0d0)) .or. (.not. (y <= 2.5d+63))) then
tmp = z + x
else
tmp = (z + x) + (y * (1.0d0 + ((-0.5d0) * (z * y))))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -1600.0) || !(y <= 2.5e+63)) {
tmp = z + x;
} else {
tmp = (z + x) + (y * (1.0 + (-0.5 * (z * y))));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -1600.0) or not (y <= 2.5e+63): tmp = z + x else: tmp = (z + x) + (y * (1.0 + (-0.5 * (z * y)))) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -1600.0) || !(y <= 2.5e+63)) tmp = Float64(z + x); else tmp = Float64(Float64(z + x) + Float64(y * Float64(1.0 + Float64(-0.5 * Float64(z * y))))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -1600.0) || ~((y <= 2.5e+63))) tmp = z + x; else tmp = (z + x) + (y * (1.0 + (-0.5 * (z * y)))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -1600.0], N[Not[LessEqual[y, 2.5e+63]], $MachinePrecision]], N[(z + x), $MachinePrecision], N[(N[(z + x), $MachinePrecision] + N[(y * N[(1.0 + N[(-0.5 * N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1600 \lor \neg \left(y \leq 2.5 \cdot 10^{+63}\right):\\
\;\;\;\;z + x\\
\mathbf{else}:\\
\;\;\;\;\left(z + x\right) + y \cdot \left(1 + -0.5 \cdot \left(z \cdot y\right)\right)\\
\end{array}
\end{array}
if y < -1600 or 2.50000000000000005e63 < y Initial program 99.8%
+-commutative99.8%
fma-define99.8%
Simplified99.8%
Taylor expanded in y around 0 38.3%
if -1600 < y < 2.50000000000000005e63Initial program 100.0%
+-commutative100.0%
fma-define100.0%
Simplified100.0%
Taylor expanded in y around 0 96.5%
associate-+r+96.5%
Simplified96.5%
Final simplification70.8%
(FPCore (x y z) :precision binary64 (if (or (<= y -8.2e+137) (not (<= y 7e+21))) (+ z x) (+ z (+ y x))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -8.2e+137) || !(y <= 7e+21)) {
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 <= (-8.2d+137)) .or. (.not. (y <= 7d+21))) 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 <= -8.2e+137) || !(y <= 7e+21)) {
tmp = z + x;
} else {
tmp = z + (y + x);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -8.2e+137) or not (y <= 7e+21): tmp = z + x else: tmp = z + (y + x) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -8.2e+137) || !(y <= 7e+21)) 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 <= -8.2e+137) || ~((y <= 7e+21))) tmp = z + x; else tmp = z + (y + x); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -8.2e+137], N[Not[LessEqual[y, 7e+21]], $MachinePrecision]], N[(z + x), $MachinePrecision], N[(z + N[(y + x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -8.2 \cdot 10^{+137} \lor \neg \left(y \leq 7 \cdot 10^{+21}\right):\\
\;\;\;\;z + x\\
\mathbf{else}:\\
\;\;\;\;z + \left(y + x\right)\\
\end{array}
\end{array}
if y < -8.19999999999999994e137 or 7e21 < y Initial program 99.9%
+-commutative99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in y around 0 42.6%
if -8.19999999999999994e137 < y < 7e21Initial program 99.9%
+-commutative99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in y around 0 84.5%
associate-+r+84.5%
+-commutative84.5%
Simplified84.5%
Final simplification70.7%
(FPCore (x y z) :precision binary64 (if (<= x -0.42) x (if (<= x 40.0) z x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -0.42) {
tmp = x;
} else if (x <= 40.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 <= (-0.42d0)) then
tmp = x
else if (x <= 40.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 <= -0.42) {
tmp = x;
} else if (x <= 40.0) {
tmp = z;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -0.42: tmp = x elif x <= 40.0: tmp = z else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -0.42) tmp = x; elseif (x <= 40.0) tmp = z; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -0.42) tmp = x; elseif (x <= 40.0) tmp = z; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -0.42], x, If[LessEqual[x, 40.0], z, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.42:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 40:\\
\;\;\;\;z\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -0.419999999999999984 or 40 < x Initial program 99.9%
expm1-log1p-u99.9%
Applied egg-rr99.9%
Taylor expanded in x around inf 76.7%
if -0.419999999999999984 < x < 40Initial program 99.9%
Taylor expanded in y around 0 75.7%
Taylor expanded in z around inf 37.8%
(FPCore (x y z) :precision binary64 (+ z x))
double code(double x, double y, double z) {
return z + x;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = z + x
end function
public static double code(double x, double y, double z) {
return z + x;
}
def code(x, y, z): return z + x
function code(x, y, z) return Float64(z + x) end
function tmp = code(x, y, z) tmp = z + x; end
code[x_, y_, z_] := N[(z + x), $MachinePrecision]
\begin{array}{l}
\\
z + x
\end{array}
Initial program 99.9%
+-commutative99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in y around 0 66.1%
Final simplification66.1%
(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%
expm1-log1p-u99.9%
Applied egg-rr99.9%
Taylor expanded in x around inf 40.7%
herbie shell --seed 2024185
(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))))