
(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 12 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-def99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y z) :precision binary64 (+ (* z (cos y)) (+ x (sin y))))
double code(double x, double y, double z) {
return (z * cos(y)) + (x + 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 = (z * cos(y)) + (x + sin(y))
end function
public static double code(double x, double y, double z) {
return (z * Math.cos(y)) + (x + Math.sin(y));
}
def code(x, y, z): return (z * math.cos(y)) + (x + math.sin(y))
function code(x, y, z) return Float64(Float64(z * cos(y)) + Float64(x + sin(y))) end
function tmp = code(x, y, z) tmp = (z * cos(y)) + (x + sin(y)); end
code[x_, y_, z_] := N[(N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision] + N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
z \cdot \cos y + \left(x + \sin y\right)
\end{array}
Initial program 99.9%
Final simplification99.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (cos y))))
(if (<= z -4.4e+120)
t_0
(if (<= z -5.5e-14)
(+ z x)
(if (<= z 3.6e-26) (+ x (sin y)) (if (<= z 2.2e+111) (+ z x) t_0))))))
double code(double x, double y, double z) {
double t_0 = z * cos(y);
double tmp;
if (z <= -4.4e+120) {
tmp = t_0;
} else if (z <= -5.5e-14) {
tmp = z + x;
} else if (z <= 3.6e-26) {
tmp = x + sin(y);
} else if (z <= 2.2e+111) {
tmp = z + x;
} 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 <= (-4.4d+120)) then
tmp = t_0
else if (z <= (-5.5d-14)) then
tmp = z + x
else if (z <= 3.6d-26) then
tmp = x + sin(y)
else if (z <= 2.2d+111) then
tmp = z + x
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 <= -4.4e+120) {
tmp = t_0;
} else if (z <= -5.5e-14) {
tmp = z + x;
} else if (z <= 3.6e-26) {
tmp = x + Math.sin(y);
} else if (z <= 2.2e+111) {
tmp = z + x;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = z * math.cos(y) tmp = 0 if z <= -4.4e+120: tmp = t_0 elif z <= -5.5e-14: tmp = z + x elif z <= 3.6e-26: tmp = x + math.sin(y) elif z <= 2.2e+111: tmp = z + x else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(z * cos(y)) tmp = 0.0 if (z <= -4.4e+120) tmp = t_0; elseif (z <= -5.5e-14) tmp = Float64(z + x); elseif (z <= 3.6e-26) tmp = Float64(x + sin(y)); elseif (z <= 2.2e+111) tmp = Float64(z + x); 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 <= -4.4e+120) tmp = t_0; elseif (z <= -5.5e-14) tmp = z + x; elseif (z <= 3.6e-26) tmp = x + sin(y); elseif (z <= 2.2e+111) tmp = z + x; 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, -4.4e+120], t$95$0, If[LessEqual[z, -5.5e-14], N[(z + x), $MachinePrecision], If[LessEqual[z, 3.6e-26], N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.2e+111], N[(z + x), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \cos y\\
\mathbf{if}\;z \leq -4.4 \cdot 10^{+120}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq -5.5 \cdot 10^{-14}:\\
\;\;\;\;z + x\\
\mathbf{elif}\;z \leq 3.6 \cdot 10^{-26}:\\
\;\;\;\;x + \sin y\\
\mathbf{elif}\;z \leq 2.2 \cdot 10^{+111}:\\
\;\;\;\;z + x\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if z < -4.4000000000000003e120 or 2.19999999999999999e111 < z Initial program 99.8%
Taylor expanded in z around inf 90.9%
if -4.4000000000000003e120 < z < -5.49999999999999991e-14 or 3.6000000000000001e-26 < z < 2.19999999999999999e111Initial program 100.0%
Taylor expanded in y around 0 76.6%
+-commutative76.6%
Simplified76.6%
if -5.49999999999999991e-14 < z < 3.6000000000000001e-26Initial program 100.0%
Taylor expanded in z around 0 93.4%
+-commutative93.4%
Simplified93.4%
Final simplification88.7%
(FPCore (x y z) :precision binary64 (if (or (<= z -2.3e-7) (not (<= z 2.7e-26))) (+ x (* z (cos y))) (+ x (sin y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -2.3e-7) || !(z <= 2.7e-26)) {
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 <= (-2.3d-7)) .or. (.not. (z <= 2.7d-26))) 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 <= -2.3e-7) || !(z <= 2.7e-26)) {
tmp = x + (z * Math.cos(y));
} else {
tmp = x + Math.sin(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -2.3e-7) or not (z <= 2.7e-26): tmp = x + (z * math.cos(y)) else: tmp = x + math.sin(y) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -2.3e-7) || !(z <= 2.7e-26)) 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 <= -2.3e-7) || ~((z <= 2.7e-26))) tmp = x + (z * cos(y)); else tmp = x + sin(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -2.3e-7], N[Not[LessEqual[z, 2.7e-26]], $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 -2.3 \cdot 10^{-7} \lor \neg \left(z \leq 2.7 \cdot 10^{-26}\right):\\
\;\;\;\;x + z \cdot \cos y\\
\mathbf{else}:\\
\;\;\;\;x + \sin y\\
\end{array}
\end{array}
if z < -2.29999999999999995e-7 or 2.69999999999999982e-26 < z Initial program 99.8%
Taylor expanded in x around inf 98.3%
if -2.29999999999999995e-7 < z < 2.69999999999999982e-26Initial program 100.0%
Taylor expanded in z around 0 93.4%
+-commutative93.4%
Simplified93.4%
Final simplification96.1%
(FPCore (x y z) :precision binary64 (if (or (<= z -1.5) (not (<= z 0.05))) (+ x (* z (cos y))) (+ z (+ x (sin y)))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.5) || !(z <= 0.05)) {
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 <= (-1.5d0)) .or. (.not. (z <= 0.05d0))) 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 <= -1.5) || !(z <= 0.05)) {
tmp = x + (z * Math.cos(y));
} else {
tmp = z + (x + Math.sin(y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -1.5) or not (z <= 0.05): 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 <= -1.5) || !(z <= 0.05)) 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 <= -1.5) || ~((z <= 0.05))) tmp = x + (z * cos(y)); else tmp = z + (x + sin(y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -1.5], N[Not[LessEqual[z, 0.05]], $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 -1.5 \lor \neg \left(z \leq 0.05\right):\\
\;\;\;\;x + z \cdot \cos y\\
\mathbf{else}:\\
\;\;\;\;z + \left(x + \sin y\right)\\
\end{array}
\end{array}
if z < -1.5 or 0.050000000000000003 < z Initial program 99.8%
Taylor expanded in x around inf 98.9%
if -1.5 < z < 0.050000000000000003Initial program 100.0%
Taylor expanded in y around 0 99.6%
Final simplification99.2%
(FPCore (x y z) :precision binary64 (if (<= y -9.8e+135) (sin y) (if (<= y 2.8e+51) (+ y (+ z x)) (if (<= y 1.2e+181) (sin y) (+ z x)))))
double code(double x, double y, double z) {
double tmp;
if (y <= -9.8e+135) {
tmp = sin(y);
} else if (y <= 2.8e+51) {
tmp = y + (z + x);
} else if (y <= 1.2e+181) {
tmp = sin(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 (y <= (-9.8d+135)) then
tmp = sin(y)
else if (y <= 2.8d+51) then
tmp = y + (z + x)
else if (y <= 1.2d+181) then
tmp = sin(y)
else
tmp = z + x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -9.8e+135) {
tmp = Math.sin(y);
} else if (y <= 2.8e+51) {
tmp = y + (z + x);
} else if (y <= 1.2e+181) {
tmp = Math.sin(y);
} else {
tmp = z + x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -9.8e+135: tmp = math.sin(y) elif y <= 2.8e+51: tmp = y + (z + x) elif y <= 1.2e+181: tmp = math.sin(y) else: tmp = z + x return tmp
function code(x, y, z) tmp = 0.0 if (y <= -9.8e+135) tmp = sin(y); elseif (y <= 2.8e+51) tmp = Float64(y + Float64(z + x)); elseif (y <= 1.2e+181) tmp = sin(y); else tmp = Float64(z + x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -9.8e+135) tmp = sin(y); elseif (y <= 2.8e+51) tmp = y + (z + x); elseif (y <= 1.2e+181) tmp = sin(y); else tmp = z + x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -9.8e+135], N[Sin[y], $MachinePrecision], If[LessEqual[y, 2.8e+51], N[(y + N[(z + x), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.2e+181], N[Sin[y], $MachinePrecision], N[(z + x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -9.8 \cdot 10^{+135}:\\
\;\;\;\;\sin y\\
\mathbf{elif}\;y \leq 2.8 \cdot 10^{+51}:\\
\;\;\;\;y + \left(z + x\right)\\
\mathbf{elif}\;y \leq 1.2 \cdot 10^{+181}:\\
\;\;\;\;\sin y\\
\mathbf{else}:\\
\;\;\;\;z + x\\
\end{array}
\end{array}
if y < -9.8000000000000002e135 or 2.80000000000000005e51 < y < 1.20000000000000001e181Initial program 99.8%
Taylor expanded in z around 0 59.2%
+-commutative59.2%
Simplified59.2%
Taylor expanded in x around 0 35.5%
if -9.8000000000000002e135 < y < 2.80000000000000005e51Initial program 99.9%
Taylor expanded in y around 0 84.6%
+-commutative84.6%
associate-+l+84.6%
Simplified84.6%
if 1.20000000000000001e181 < y Initial program 99.9%
Taylor expanded in y around 0 41.8%
+-commutative41.8%
Simplified41.8%
Final simplification68.4%
(FPCore (x y z) :precision binary64 (if (or (<= z -1.5e+121) (not (<= z 7e+107))) (* z (cos y)) (+ z x)))
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.5e+121) || !(z <= 7e+107)) {
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.5d+121)) .or. (.not. (z <= 7d+107))) 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.5e+121) || !(z <= 7e+107)) {
tmp = z * Math.cos(y);
} else {
tmp = z + x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -1.5e+121) or not (z <= 7e+107): tmp = z * math.cos(y) else: tmp = z + x return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -1.5e+121) || !(z <= 7e+107)) 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.5e+121) || ~((z <= 7e+107))) tmp = z * cos(y); else tmp = z + x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -1.5e+121], N[Not[LessEqual[z, 7e+107]], $MachinePrecision]], N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision], N[(z + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.5 \cdot 10^{+121} \lor \neg \left(z \leq 7 \cdot 10^{+107}\right):\\
\;\;\;\;z \cdot \cos y\\
\mathbf{else}:\\
\;\;\;\;z + x\\
\end{array}
\end{array}
if z < -1.5000000000000001e121 or 6.9999999999999995e107 < z Initial program 99.8%
Taylor expanded in z around inf 90.9%
if -1.5000000000000001e121 < z < 6.9999999999999995e107Initial program 100.0%
Taylor expanded in y around 0 68.1%
+-commutative68.1%
Simplified68.1%
Final simplification75.6%
(FPCore (x y z) :precision binary64 (if (or (<= y -6.6e+21) (not (<= y 3.1))) (+ z x) (+ y (+ z x))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -6.6e+21) || !(y <= 3.1)) {
tmp = z + x;
} else {
tmp = y + (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 <= (-6.6d+21)) .or. (.not. (y <= 3.1d0))) then
tmp = z + x
else
tmp = y + (z + x)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -6.6e+21) || !(y <= 3.1)) {
tmp = z + x;
} else {
tmp = y + (z + x);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -6.6e+21) or not (y <= 3.1): tmp = z + x else: tmp = y + (z + x) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -6.6e+21) || !(y <= 3.1)) tmp = Float64(z + x); else tmp = Float64(y + Float64(z + x)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -6.6e+21) || ~((y <= 3.1))) tmp = z + x; else tmp = y + (z + x); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -6.6e+21], N[Not[LessEqual[y, 3.1]], $MachinePrecision]], N[(z + x), $MachinePrecision], N[(y + N[(z + x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -6.6 \cdot 10^{+21} \lor \neg \left(y \leq 3.1\right):\\
\;\;\;\;z + x\\
\mathbf{else}:\\
\;\;\;\;y + \left(z + x\right)\\
\end{array}
\end{array}
if y < -6.6e21 or 3.10000000000000009 < y Initial program 99.8%
Taylor expanded in y around 0 30.6%
+-commutative30.6%
Simplified30.6%
if -6.6e21 < y < 3.10000000000000009Initial program 100.0%
Taylor expanded in y around 0 96.6%
+-commutative96.6%
associate-+l+96.6%
Simplified96.6%
Final simplification65.9%
(FPCore (x y z) :precision binary64 (if (<= x -7e-16) x (if (<= x 8e+74) (+ z y) x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -7e-16) {
tmp = x;
} else if (x <= 8e+74) {
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 <= (-7d-16)) then
tmp = x
else if (x <= 8d+74) 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 <= -7e-16) {
tmp = x;
} else if (x <= 8e+74) {
tmp = z + y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -7e-16: tmp = x elif x <= 8e+74: tmp = z + y else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -7e-16) tmp = x; elseif (x <= 8e+74) tmp = Float64(z + y); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -7e-16) tmp = x; elseif (x <= 8e+74) tmp = z + y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -7e-16], x, If[LessEqual[x, 8e+74], N[(z + y), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7 \cdot 10^{-16}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 8 \cdot 10^{+74}:\\
\;\;\;\;z + y\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -7.00000000000000035e-16 or 7.99999999999999961e74 < x Initial program 99.9%
+-commutative99.9%
add-cube-cbrt99.5%
associate-*l*99.5%
fma-def99.5%
pow299.5%
+-commutative99.5%
Applied egg-rr99.5%
Taylor expanded in x around inf 75.2%
if -7.00000000000000035e-16 < x < 7.99999999999999961e74Initial program 99.9%
Taylor expanded in x around 0 93.1%
Taylor expanded in y around 0 42.2%
Final simplification57.3%
(FPCore (x y z) :precision binary64 (if (<= x -6e-13) x (if (<= x 8e+74) z x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -6e-13) {
tmp = x;
} else if (x <= 8e+74) {
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 <= (-6d-13)) then
tmp = x
else if (x <= 8d+74) 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 <= -6e-13) {
tmp = x;
} else if (x <= 8e+74) {
tmp = z;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -6e-13: tmp = x elif x <= 8e+74: tmp = z else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -6e-13) tmp = x; elseif (x <= 8e+74) tmp = z; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -6e-13) tmp = x; elseif (x <= 8e+74) tmp = z; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -6e-13], x, If[LessEqual[x, 8e+74], z, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6 \cdot 10^{-13}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 8 \cdot 10^{+74}:\\
\;\;\;\;z\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -5.99999999999999968e-13 or 7.99999999999999961e74 < x Initial program 99.9%
+-commutative99.9%
add-cube-cbrt99.5%
associate-*l*99.4%
fma-def99.5%
pow299.5%
+-commutative99.5%
Applied egg-rr99.5%
Taylor expanded in x around inf 75.8%
if -5.99999999999999968e-13 < x < 7.99999999999999961e74Initial program 99.9%
Taylor expanded in x around 0 93.1%
Taylor expanded in y around 0 37.6%
Final simplification54.9%
(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%
Taylor expanded in y around 0 62.8%
+-commutative62.8%
Simplified62.8%
Final simplification62.8%
(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%
+-commutative99.9%
add-cube-cbrt99.0%
associate-*l*99.0%
fma-def99.0%
pow299.0%
+-commutative99.0%
Applied egg-rr99.0%
Taylor expanded in x around inf 39.4%
Final simplification39.4%
herbie shell --seed 2023320
(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))))