
(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 11 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 (if (or (<= z -58000000.0) (not (<= z 0.0135))) (- (+ x 1.0) (* z (sin y))) (+ x (cos y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -58000000.0) || !(z <= 0.0135)) {
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 <= (-58000000.0d0)) .or. (.not. (z <= 0.0135d0))) 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 <= -58000000.0) || !(z <= 0.0135)) {
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 <= -58000000.0) or not (z <= 0.0135): 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 <= -58000000.0) || !(z <= 0.0135)) 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 <= -58000000.0) || ~((z <= 0.0135))) 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, -58000000.0], N[Not[LessEqual[z, 0.0135]], $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 -58000000 \lor \neg \left(z \leq 0.0135\right):\\
\;\;\;\;\left(x + 1\right) - z \cdot \sin y\\
\mathbf{else}:\\
\;\;\;\;x + \cos y\\
\end{array}
\end{array}
if z < -5.8e7 or 0.0134999999999999998 < z Initial program 99.8%
Taylor expanded in y around 0 99.8%
if -5.8e7 < z < 0.0134999999999999998Initial program 99.9%
Taylor expanded in z around 0 99.0%
+-commutative99.0%
Simplified99.0%
Final simplification99.4%
(FPCore (x y z) :precision binary64 (if (or (<= z -1.12e+110) (not (<= z 8.5e+78))) (- 1.0 (* z (sin y))) (+ x (cos y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.12e+110) || !(z <= 8.5e+78)) {
tmp = 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 <= (-1.12d+110)) .or. (.not. (z <= 8.5d+78))) then
tmp = 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 <= -1.12e+110) || !(z <= 8.5e+78)) {
tmp = 1.0 - (z * Math.sin(y));
} else {
tmp = x + Math.cos(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -1.12e+110) or not (z <= 8.5e+78): tmp = 1.0 - (z * math.sin(y)) else: tmp = x + math.cos(y) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -1.12e+110) || !(z <= 8.5e+78)) tmp = Float64(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 <= -1.12e+110) || ~((z <= 8.5e+78))) tmp = 1.0 - (z * sin(y)); else tmp = x + cos(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -1.12e+110], N[Not[LessEqual[z, 8.5e+78]], $MachinePrecision]], N[(1.0 - 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 -1.12 \cdot 10^{+110} \lor \neg \left(z \leq 8.5 \cdot 10^{+78}\right):\\
\;\;\;\;1 - z \cdot \sin y\\
\mathbf{else}:\\
\;\;\;\;x + \cos y\\
\end{array}
\end{array}
if z < -1.1200000000000001e110 or 8.50000000000000079e78 < z Initial program 99.8%
Taylor expanded in x around 0 78.4%
Taylor expanded in y around 0 78.4%
if -1.1200000000000001e110 < z < 8.50000000000000079e78Initial program 99.9%
Taylor expanded in z around 0 92.7%
+-commutative92.7%
Simplified92.7%
Final simplification88.1%
(FPCore (x y z) :precision binary64 (if (or (<= z -5.5e+176) (not (<= z 5e+72))) (* (sin y) (- z)) (+ x (cos y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -5.5e+176) || !(z <= 5e+72)) {
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 <= (-5.5d+176)) .or. (.not. (z <= 5d+72))) 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 <= -5.5e+176) || !(z <= 5e+72)) {
tmp = Math.sin(y) * -z;
} else {
tmp = x + Math.cos(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -5.5e+176) or not (z <= 5e+72): tmp = math.sin(y) * -z else: tmp = x + math.cos(y) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -5.5e+176) || !(z <= 5e+72)) 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 <= -5.5e+176) || ~((z <= 5e+72))) tmp = sin(y) * -z; else tmp = x + cos(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -5.5e+176], N[Not[LessEqual[z, 5e+72]], $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 -5.5 \cdot 10^{+176} \lor \neg \left(z \leq 5 \cdot 10^{+72}\right):\\
\;\;\;\;\sin y \cdot \left(-z\right)\\
\mathbf{else}:\\
\;\;\;\;x + \cos y\\
\end{array}
\end{array}
if z < -5.4999999999999995e176 or 4.99999999999999992e72 < z Initial program 99.9%
Taylor expanded in z around inf 73.8%
mul-1-neg73.8%
*-commutative73.8%
distribute-rgt-neg-in73.8%
Simplified73.8%
if -5.4999999999999995e176 < z < 4.99999999999999992e72Initial program 99.9%
Taylor expanded in z around 0 89.4%
+-commutative89.4%
Simplified89.4%
Final simplification85.3%
(FPCore (x y z) :precision binary64 (if (or (<= y -1420000000000.0) (not (<= y 1.9e-27))) (+ x (cos y)) (+ 1.0 (+ x (* y (- (* y (* y (* z 0.16666666666666666))) z))))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -1420000000000.0) || !(y <= 1.9e-27)) {
tmp = x + cos(y);
} else {
tmp = 1.0 + (x + (y * ((y * (y * (z * 0.16666666666666666))) - 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 <= (-1420000000000.0d0)) .or. (.not. (y <= 1.9d-27))) then
tmp = x + cos(y)
else
tmp = 1.0d0 + (x + (y * ((y * (y * (z * 0.16666666666666666d0))) - z)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -1420000000000.0) || !(y <= 1.9e-27)) {
tmp = x + Math.cos(y);
} else {
tmp = 1.0 + (x + (y * ((y * (y * (z * 0.16666666666666666))) - z)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -1420000000000.0) or not (y <= 1.9e-27): tmp = x + math.cos(y) else: tmp = 1.0 + (x + (y * ((y * (y * (z * 0.16666666666666666))) - z))) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -1420000000000.0) || !(y <= 1.9e-27)) tmp = Float64(x + cos(y)); else tmp = Float64(1.0 + Float64(x + Float64(y * Float64(Float64(y * Float64(y * Float64(z * 0.16666666666666666))) - z)))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -1420000000000.0) || ~((y <= 1.9e-27))) tmp = x + cos(y); else tmp = 1.0 + (x + (y * ((y * (y * (z * 0.16666666666666666))) - z))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -1420000000000.0], N[Not[LessEqual[y, 1.9e-27]], $MachinePrecision]], N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(x + N[(y * N[(N[(y * N[(y * N[(z * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1420000000000 \lor \neg \left(y \leq 1.9 \cdot 10^{-27}\right):\\
\;\;\;\;x + \cos y\\
\mathbf{else}:\\
\;\;\;\;1 + \left(x + y \cdot \left(y \cdot \left(y \cdot \left(z \cdot 0.16666666666666666\right)\right) - z\right)\right)\\
\end{array}
\end{array}
if y < -1.42e12 or 1.9e-27 < y Initial program 99.8%
Taylor expanded in z around 0 65.9%
+-commutative65.9%
Simplified65.9%
if -1.42e12 < y < 1.9e-27Initial program 100.0%
Taylor expanded in y around 0 99.2%
Taylor expanded in y around inf 99.2%
*-commutative99.2%
associate-*r*99.2%
Simplified99.2%
Final simplification80.5%
(FPCore (x y z) :precision binary64 (if (or (<= x -0.00092) (not (<= x 0.0013))) (+ x 1.0) (cos y)))
double code(double x, double y, double z) {
double tmp;
if ((x <= -0.00092) || !(x <= 0.0013)) {
tmp = x + 1.0;
} else {
tmp = 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 <= (-0.00092d0)) .or. (.not. (x <= 0.0013d0))) then
tmp = x + 1.0d0
else
tmp = cos(y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -0.00092) || !(x <= 0.0013)) {
tmp = x + 1.0;
} else {
tmp = Math.cos(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -0.00092) or not (x <= 0.0013): tmp = x + 1.0 else: tmp = math.cos(y) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -0.00092) || !(x <= 0.0013)) tmp = Float64(x + 1.0); else tmp = cos(y); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -0.00092) || ~((x <= 0.0013))) tmp = x + 1.0; else tmp = cos(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -0.00092], N[Not[LessEqual[x, 0.0013]], $MachinePrecision]], N[(x + 1.0), $MachinePrecision], N[Cos[y], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.00092 \lor \neg \left(x \leq 0.0013\right):\\
\;\;\;\;x + 1\\
\mathbf{else}:\\
\;\;\;\;\cos y\\
\end{array}
\end{array}
if x < -9.2000000000000003e-4 or 0.0012999999999999999 < x Initial program 99.9%
Taylor expanded in y around 0 79.9%
+-commutative79.9%
Simplified79.9%
if -9.2000000000000003e-4 < x < 0.0012999999999999999Initial program 99.8%
Taylor expanded in z around 0 65.9%
+-commutative65.9%
Simplified65.9%
Taylor expanded in x around 0 63.7%
Final simplification71.7%
(FPCore (x y z) :precision binary64 (if (<= y -100.0) (+ x 1.0) (if (<= y 220000000000.0) (+ x (- 1.0 (* y z))) (* x (+ 1.0 (/ 1.0 x))))))
double code(double x, double y, double z) {
double tmp;
if (y <= -100.0) {
tmp = x + 1.0;
} else if (y <= 220000000000.0) {
tmp = x + (1.0 - (y * z));
} else {
tmp = x * (1.0 + (1.0 / 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 <= (-100.0d0)) then
tmp = x + 1.0d0
else if (y <= 220000000000.0d0) then
tmp = x + (1.0d0 - (y * z))
else
tmp = x * (1.0d0 + (1.0d0 / x))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -100.0) {
tmp = x + 1.0;
} else if (y <= 220000000000.0) {
tmp = x + (1.0 - (y * z));
} else {
tmp = x * (1.0 + (1.0 / x));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -100.0: tmp = x + 1.0 elif y <= 220000000000.0: tmp = x + (1.0 - (y * z)) else: tmp = x * (1.0 + (1.0 / x)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -100.0) tmp = Float64(x + 1.0); elseif (y <= 220000000000.0) tmp = Float64(x + Float64(1.0 - Float64(y * z))); else tmp = Float64(x * Float64(1.0 + Float64(1.0 / x))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -100.0) tmp = x + 1.0; elseif (y <= 220000000000.0) tmp = x + (1.0 - (y * z)); else tmp = x * (1.0 + (1.0 / x)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -100.0], N[(x + 1.0), $MachinePrecision], If[LessEqual[y, 220000000000.0], N[(x + N[(1.0 - N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 + N[(1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -100:\\
\;\;\;\;x + 1\\
\mathbf{elif}\;y \leq 220000000000:\\
\;\;\;\;x + \left(1 - y \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 + \frac{1}{x}\right)\\
\end{array}
\end{array}
if y < -100Initial program 99.8%
Taylor expanded in y around 0 30.3%
+-commutative30.3%
Simplified30.3%
if -100 < y < 2.2e11Initial program 100.0%
Taylor expanded in y around 0 98.5%
associate-+r+98.5%
+-commutative98.5%
associate-+l+98.5%
mul-1-neg98.5%
unsub-neg98.5%
Simplified98.5%
if 2.2e11 < y Initial program 99.8%
Taylor expanded in y around 0 46.9%
+-commutative46.9%
Simplified46.9%
Taylor expanded in x around inf 46.9%
(FPCore (x y z) :precision binary64 (if (<= x -1.5e-21) (+ (+ x 2.0) -1.0) (if (<= x 19500.0) (- 1.0 (* y z)) (+ x 1.0))))
double code(double x, double y, double z) {
double tmp;
if (x <= -1.5e-21) {
tmp = (x + 2.0) + -1.0;
} else if (x <= 19500.0) {
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.5d-21)) then
tmp = (x + 2.0d0) + (-1.0d0)
else if (x <= 19500.0d0) 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.5e-21) {
tmp = (x + 2.0) + -1.0;
} else if (x <= 19500.0) {
tmp = 1.0 - (y * z);
} else {
tmp = x + 1.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -1.5e-21: tmp = (x + 2.0) + -1.0 elif x <= 19500.0: tmp = 1.0 - (y * z) else: tmp = x + 1.0 return tmp
function code(x, y, z) tmp = 0.0 if (x <= -1.5e-21) tmp = Float64(Float64(x + 2.0) + -1.0); elseif (x <= 19500.0) 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.5e-21) tmp = (x + 2.0) + -1.0; elseif (x <= 19500.0) tmp = 1.0 - (y * z); else tmp = x + 1.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -1.5e-21], N[(N[(x + 2.0), $MachinePrecision] + -1.0), $MachinePrecision], If[LessEqual[x, 19500.0], N[(1.0 - N[(y * z), $MachinePrecision]), $MachinePrecision], N[(x + 1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.5 \cdot 10^{-21}:\\
\;\;\;\;\left(x + 2\right) + -1\\
\mathbf{elif}\;x \leq 19500:\\
\;\;\;\;1 - y \cdot z\\
\mathbf{else}:\\
\;\;\;\;x + 1\\
\end{array}
\end{array}
if x < -1.49999999999999996e-21Initial program 99.9%
Taylor expanded in y around 0 76.4%
+-commutative76.4%
Simplified76.4%
expm1-log1p-u2.6%
expm1-undefine2.6%
Applied egg-rr2.6%
sub-neg2.6%
log1p-undefine2.6%
rem-exp-log76.4%
+-commutative76.4%
associate-+r+76.4%
metadata-eval76.4%
metadata-eval76.4%
Simplified76.4%
if -1.49999999999999996e-21 < x < 19500Initial program 99.9%
Taylor expanded in x around inf 86.3%
associate--l+86.3%
div-sub86.3%
Simplified86.3%
Taylor expanded in y around 0 44.8%
mul-1-neg44.8%
Simplified44.8%
Taylor expanded in x around 0 48.0%
if 19500 < x Initial program 99.9%
Taylor expanded in y around 0 80.3%
+-commutative80.3%
Simplified80.3%
Final simplification63.5%
(FPCore (x y z) :precision binary64 (if (<= x -1.0) x (if (<= x 0.00125) 1.0 x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -1.0) {
tmp = x;
} else if (x <= 0.00125) {
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.00125d0) 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.00125) {
tmp = 1.0;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -1.0: tmp = x elif x <= 0.00125: 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.00125) 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.00125) 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.00125], 1.0, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 0.00125:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -1 or 0.00125000000000000003 < x Initial program 99.9%
Taylor expanded in x around inf 77.9%
if -1 < x < 0.00125000000000000003Initial program 99.8%
Taylor expanded in y around 0 38.5%
+-commutative38.5%
Simplified38.5%
Taylor expanded in x around 0 38.5%
(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 58.7%
+-commutative58.7%
Simplified58.7%
(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 y around 0 58.7%
+-commutative58.7%
Simplified58.7%
Taylor expanded in x around 0 21.0%
herbie shell --seed 2024146
(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))))