
(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 12 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 z (- (sin y)) (+ x (cos y))))
double code(double x, double y, double z) {
return fma(z, -sin(y), (x + cos(y)));
}
function code(x, y, z) return fma(z, Float64(-sin(y)), Float64(x + cos(y))) end
code[x_, y_, z_] := N[(z * (-N[Sin[y], $MachinePrecision]) + N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(z, -\sin y, x + \cos y\right)
\end{array}
Initial program 99.9%
cancel-sign-sub-inv99.9%
+-commutative99.9%
distribute-lft-neg-out99.9%
distribute-rgt-neg-in99.9%
sin-neg99.9%
fma-def99.9%
sin-neg99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y z) :precision binary64 (if (<= x -2.7e+24) x (if (<= x 0.49) (- (cos y) (* z (sin y))) (+ x (cos y)))))
double code(double x, double y, double z) {
double tmp;
if (x <= -2.7e+24) {
tmp = x;
} else if (x <= 0.49) {
tmp = cos(y) - (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 (x <= (-2.7d+24)) then
tmp = x
else if (x <= 0.49d0) then
tmp = cos(y) - (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 (x <= -2.7e+24) {
tmp = x;
} else if (x <= 0.49) {
tmp = Math.cos(y) - (z * Math.sin(y));
} else {
tmp = x + Math.cos(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -2.7e+24: tmp = x elif x <= 0.49: tmp = math.cos(y) - (z * math.sin(y)) else: tmp = x + math.cos(y) return tmp
function code(x, y, z) tmp = 0.0 if (x <= -2.7e+24) tmp = x; elseif (x <= 0.49) tmp = Float64(cos(y) - 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 (x <= -2.7e+24) tmp = x; elseif (x <= 0.49) tmp = cos(y) - (z * sin(y)); else tmp = x + cos(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -2.7e+24], x, If[LessEqual[x, 0.49], N[(N[Cos[y], $MachinePrecision] - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.7 \cdot 10^{+24}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 0.49:\\
\;\;\;\;\cos y - z \cdot \sin y\\
\mathbf{else}:\\
\;\;\;\;x + \cos y\\
\end{array}
\end{array}
if x < -2.7e24Initial program 99.9%
Taylor expanded in x around inf 81.3%
if -2.7e24 < x < 0.48999999999999999Initial program 99.8%
Taylor expanded in x around 0 96.8%
if 0.48999999999999999 < x Initial program 100.0%
Taylor expanded in z around 0 85.5%
+-commutative85.5%
Simplified85.5%
Final simplification89.9%
(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%
Final simplification99.9%
(FPCore (x y z) :precision binary64 (if (or (<= z -6e+154) (not (<= z 2.4e+85))) (* z (- (sin y))) (+ x (cos y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -6e+154) || !(z <= 2.4e+85)) {
tmp = 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 <= (-6d+154)) .or. (.not. (z <= 2.4d+85))) then
tmp = 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 <= -6e+154) || !(z <= 2.4e+85)) {
tmp = z * -Math.sin(y);
} else {
tmp = x + Math.cos(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -6e+154) or not (z <= 2.4e+85): tmp = z * -math.sin(y) else: tmp = x + math.cos(y) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -6e+154) || !(z <= 2.4e+85)) tmp = Float64(z * Float64(-sin(y))); else tmp = Float64(x + cos(y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -6e+154) || ~((z <= 2.4e+85))) tmp = z * -sin(y); else tmp = x + cos(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -6e+154], N[Not[LessEqual[z, 2.4e+85]], $MachinePrecision]], N[(z * (-N[Sin[y], $MachinePrecision])), $MachinePrecision], N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6 \cdot 10^{+154} \lor \neg \left(z \leq 2.4 \cdot 10^{+85}\right):\\
\;\;\;\;z \cdot \left(-\sin y\right)\\
\mathbf{else}:\\
\;\;\;\;x + \cos y\\
\end{array}
\end{array}
if z < -6.00000000000000052e154 or 2.39999999999999997e85 < z Initial program 99.7%
Taylor expanded in z around inf 75.0%
neg-mul-175.0%
*-commutative75.0%
distribute-rgt-neg-in75.0%
Simplified75.0%
if -6.00000000000000052e154 < z < 2.39999999999999997e85Initial program 100.0%
Taylor expanded in z around 0 91.5%
+-commutative91.5%
Simplified91.5%
Final simplification86.2%
(FPCore (x y z) :precision binary64 (if (or (<= y -2.4e+27) (not (<= y 6.8e-7))) (+ x (cos y)) (+ 1.0 (- x (* z y)))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -2.4e+27) || !(y <= 6.8e-7)) {
tmp = x + cos(y);
} else {
tmp = 1.0 + (x - (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 <= (-2.4d+27)) .or. (.not. (y <= 6.8d-7))) then
tmp = x + cos(y)
else
tmp = 1.0d0 + (x - (z * y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -2.4e+27) || !(y <= 6.8e-7)) {
tmp = x + Math.cos(y);
} else {
tmp = 1.0 + (x - (z * y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -2.4e+27) or not (y <= 6.8e-7): tmp = x + math.cos(y) else: tmp = 1.0 + (x - (z * y)) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -2.4e+27) || !(y <= 6.8e-7)) tmp = Float64(x + cos(y)); else tmp = Float64(1.0 + Float64(x - Float64(z * y))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -2.4e+27) || ~((y <= 6.8e-7))) tmp = x + cos(y); else tmp = 1.0 + (x - (z * y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -2.4e+27], N[Not[LessEqual[y, 6.8e-7]], $MachinePrecision]], N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(x - N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.4 \cdot 10^{+27} \lor \neg \left(y \leq 6.8 \cdot 10^{-7}\right):\\
\;\;\;\;x + \cos y\\
\mathbf{else}:\\
\;\;\;\;1 + \left(x - z \cdot y\right)\\
\end{array}
\end{array}
if y < -2.39999999999999998e27 or 6.79999999999999948e-7 < y Initial program 99.8%
Taylor expanded in z around 0 59.4%
+-commutative59.4%
Simplified59.4%
if -2.39999999999999998e27 < y < 6.79999999999999948e-7Initial program 100.0%
Taylor expanded in y around 0 97.6%
mul-1-neg97.6%
unsub-neg97.6%
Simplified97.6%
Final simplification76.3%
(FPCore (x y z) :precision binary64 (if (or (<= x -3.8e-8) (not (<= x 2.75e-12))) (+ x 1.0) (cos y)))
double code(double x, double y, double z) {
double tmp;
if ((x <= -3.8e-8) || !(x <= 2.75e-12)) {
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 <= (-3.8d-8)) .or. (.not. (x <= 2.75d-12))) 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 <= -3.8e-8) || !(x <= 2.75e-12)) {
tmp = x + 1.0;
} else {
tmp = Math.cos(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -3.8e-8) or not (x <= 2.75e-12): tmp = x + 1.0 else: tmp = math.cos(y) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -3.8e-8) || !(x <= 2.75e-12)) 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 <= -3.8e-8) || ~((x <= 2.75e-12))) tmp = x + 1.0; else tmp = cos(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -3.8e-8], N[Not[LessEqual[x, 2.75e-12]], $MachinePrecision]], N[(x + 1.0), $MachinePrecision], N[Cos[y], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.8 \cdot 10^{-8} \lor \neg \left(x \leq 2.75 \cdot 10^{-12}\right):\\
\;\;\;\;x + 1\\
\mathbf{else}:\\
\;\;\;\;\cos y\\
\end{array}
\end{array}
if x < -3.80000000000000028e-8 or 2.7500000000000002e-12 < x Initial program 99.9%
Taylor expanded in y around 0 80.4%
+-commutative80.4%
Simplified80.4%
if -3.80000000000000028e-8 < x < 2.7500000000000002e-12Initial program 99.8%
add-cube-cbrt99.3%
pow399.3%
Applied egg-rr99.3%
rem-cube-cbrt99.8%
*-commutative99.8%
add-sqr-sqrt51.6%
associate-*r*51.6%
Applied egg-rr51.6%
Taylor expanded in x around 0 99.1%
*-commutative99.1%
Simplified99.1%
Taylor expanded in z around 0 57.2%
Final simplification70.4%
(FPCore (x y z) :precision binary64 (if (or (<= y -2.4e+27) (not (<= y 42000000.0))) (+ x 1.0) (+ (+ x 1.0) (* y (- (* y -0.5) z)))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -2.4e+27) || !(y <= 42000000.0)) {
tmp = x + 1.0;
} else {
tmp = (x + 1.0) + (y * ((y * -0.5) - z));
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((y <= (-2.4d+27)) .or. (.not. (y <= 42000000.0d0))) then
tmp = x + 1.0d0
else
tmp = (x + 1.0d0) + (y * ((y * (-0.5d0)) - z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -2.4e+27) || !(y <= 42000000.0)) {
tmp = x + 1.0;
} else {
tmp = (x + 1.0) + (y * ((y * -0.5) - z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -2.4e+27) or not (y <= 42000000.0): tmp = x + 1.0 else: tmp = (x + 1.0) + (y * ((y * -0.5) - z)) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -2.4e+27) || !(y <= 42000000.0)) tmp = Float64(x + 1.0); else tmp = Float64(Float64(x + 1.0) + Float64(y * Float64(Float64(y * -0.5) - z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -2.4e+27) || ~((y <= 42000000.0))) tmp = x + 1.0; else tmp = (x + 1.0) + (y * ((y * -0.5) - z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -2.4e+27], N[Not[LessEqual[y, 42000000.0]], $MachinePrecision]], N[(x + 1.0), $MachinePrecision], N[(N[(x + 1.0), $MachinePrecision] + N[(y * N[(N[(y * -0.5), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.4 \cdot 10^{+27} \lor \neg \left(y \leq 42000000\right):\\
\;\;\;\;x + 1\\
\mathbf{else}:\\
\;\;\;\;\left(x + 1\right) + y \cdot \left(y \cdot -0.5 - z\right)\\
\end{array}
\end{array}
if y < -2.39999999999999998e27 or 4.2e7 < y Initial program 99.8%
Taylor expanded in y around 0 41.9%
+-commutative41.9%
Simplified41.9%
if -2.39999999999999998e27 < y < 4.2e7Initial program 100.0%
Taylor expanded in y around 0 96.0%
associate-+r+96.0%
+-commutative96.0%
+-commutative96.0%
mul-1-neg96.0%
unsub-neg96.0%
*-commutative96.0%
unpow296.0%
associate-*l*96.0%
distribute-lft-out--96.0%
Simplified96.0%
Final simplification66.6%
(FPCore (x y z) :precision binary64 (if (or (<= y -5.9e+29) (not (<= y 4.5e+65))) (+ x 1.0) (+ 1.0 (- x (* z y)))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -5.9e+29) || !(y <= 4.5e+65)) {
tmp = x + 1.0;
} else {
tmp = 1.0 + (x - (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 <= (-5.9d+29)) .or. (.not. (y <= 4.5d+65))) then
tmp = x + 1.0d0
else
tmp = 1.0d0 + (x - (z * y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -5.9e+29) || !(y <= 4.5e+65)) {
tmp = x + 1.0;
} else {
tmp = 1.0 + (x - (z * y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -5.9e+29) or not (y <= 4.5e+65): tmp = x + 1.0 else: tmp = 1.0 + (x - (z * y)) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -5.9e+29) || !(y <= 4.5e+65)) tmp = Float64(x + 1.0); else tmp = Float64(1.0 + Float64(x - Float64(z * y))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -5.9e+29) || ~((y <= 4.5e+65))) tmp = x + 1.0; else tmp = 1.0 + (x - (z * y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -5.9e+29], N[Not[LessEqual[y, 4.5e+65]], $MachinePrecision]], N[(x + 1.0), $MachinePrecision], N[(1.0 + N[(x - N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.9 \cdot 10^{+29} \lor \neg \left(y \leq 4.5 \cdot 10^{+65}\right):\\
\;\;\;\;x + 1\\
\mathbf{else}:\\
\;\;\;\;1 + \left(x - z \cdot y\right)\\
\end{array}
\end{array}
if y < -5.8999999999999999e29 or 4.5e65 < y Initial program 99.8%
Taylor expanded in y around 0 40.4%
+-commutative40.4%
Simplified40.4%
if -5.8999999999999999e29 < y < 4.5e65Initial program 100.0%
Taylor expanded in y around 0 92.7%
mul-1-neg92.7%
unsub-neg92.7%
Simplified92.7%
Final simplification66.5%
(FPCore (x y z) :precision binary64 (if (<= x -1.5e+17) x (if (<= x 6.5e-79) (- 1.0 (* z y)) (+ x 1.0))))
double code(double x, double y, double z) {
double tmp;
if (x <= -1.5e+17) {
tmp = x;
} else if (x <= 6.5e-79) {
tmp = 1.0 - (z * y);
} else {
tmp = x + 1.0;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (x <= (-1.5d+17)) then
tmp = x
else if (x <= 6.5d-79) then
tmp = 1.0d0 - (z * y)
else
tmp = x + 1.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -1.5e+17) {
tmp = x;
} else if (x <= 6.5e-79) {
tmp = 1.0 - (z * y);
} else {
tmp = x + 1.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -1.5e+17: tmp = x elif x <= 6.5e-79: tmp = 1.0 - (z * y) else: tmp = x + 1.0 return tmp
function code(x, y, z) tmp = 0.0 if (x <= -1.5e+17) tmp = x; elseif (x <= 6.5e-79) tmp = Float64(1.0 - Float64(z * y)); else tmp = Float64(x + 1.0); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -1.5e+17) tmp = x; elseif (x <= 6.5e-79) tmp = 1.0 - (z * y); else tmp = x + 1.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -1.5e+17], x, If[LessEqual[x, 6.5e-79], N[(1.0 - N[(z * y), $MachinePrecision]), $MachinePrecision], N[(x + 1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.5 \cdot 10^{+17}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 6.5 \cdot 10^{-79}:\\
\;\;\;\;1 - z \cdot y\\
\mathbf{else}:\\
\;\;\;\;x + 1\\
\end{array}
\end{array}
if x < -1.5e17Initial program 99.9%
Taylor expanded in x around inf 79.0%
if -1.5e17 < x < 6.5000000000000003e-79Initial program 99.8%
Taylor expanded in y around 0 41.8%
associate-+r+41.8%
+-commutative41.8%
+-commutative41.8%
mul-1-neg41.8%
unsub-neg41.8%
*-commutative41.8%
unpow241.8%
associate-*l*41.8%
distribute-lft-out--41.9%
Simplified41.9%
Taylor expanded in x around 0 41.1%
Taylor expanded in y around 0 42.1%
associate-*r*42.1%
*-commutative42.1%
mul-1-neg42.1%
Simplified42.1%
Taylor expanded in z around 0 42.1%
mul-1-neg42.1%
sub-neg42.1%
Simplified42.1%
if 6.5000000000000003e-79 < x Initial program 99.9%
Taylor expanded in y around 0 80.2%
+-commutative80.2%
Simplified80.2%
Final simplification64.7%
(FPCore (x y z) :precision binary64 (if (<= x -82000000000.0) x (if (<= x 0.48) 1.0 x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -82000000000.0) {
tmp = x;
} else if (x <= 0.48) {
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 <= (-82000000000.0d0)) then
tmp = x
else if (x <= 0.48d0) 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 <= -82000000000.0) {
tmp = x;
} else if (x <= 0.48) {
tmp = 1.0;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -82000000000.0: tmp = x elif x <= 0.48: tmp = 1.0 else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -82000000000.0) tmp = x; elseif (x <= 0.48) tmp = 1.0; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -82000000000.0) tmp = x; elseif (x <= 0.48) tmp = 1.0; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -82000000000.0], x, If[LessEqual[x, 0.48], 1.0, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -82000000000:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 0.48:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -8.2e10 or 0.47999999999999998 < x Initial program 99.9%
Taylor expanded in x around inf 81.5%
if -8.2e10 < x < 0.47999999999999998Initial program 99.9%
Taylor expanded in y around 0 43.3%
associate-+r+43.3%
+-commutative43.3%
+-commutative43.3%
mul-1-neg43.3%
unsub-neg43.3%
*-commutative43.3%
unpow243.3%
associate-*l*43.3%
distribute-lft-out--43.4%
Simplified43.4%
Taylor expanded in x around 0 41.8%
Taylor expanded in y around 0 42.9%
associate-*r*42.9%
*-commutative42.9%
mul-1-neg42.9%
Simplified42.9%
Taylor expanded in z around 0 35.1%
Final simplification60.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 61.1%
+-commutative61.1%
Simplified61.1%
Final simplification61.1%
(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 50.5%
associate-+r+50.5%
+-commutative50.5%
+-commutative50.5%
mul-1-neg50.5%
unsub-neg50.5%
*-commutative50.5%
unpow250.5%
associate-*l*50.5%
distribute-lft-out--50.6%
Simplified50.6%
Taylor expanded in x around 0 22.0%
Taylor expanded in y around 0 22.8%
associate-*r*22.8%
*-commutative22.8%
mul-1-neg22.8%
Simplified22.8%
Taylor expanded in z around 0 17.8%
Final simplification17.8%
herbie shell --seed 2023334
(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))))