
(FPCore (x y z) :precision binary64 (/ (* x (/ (sin y) y)) z))
double code(double x, double y, double z) {
return (x * (sin(y) / 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 * (sin(y) / y)) / z
end function
public static double code(double x, double y, double z) {
return (x * (Math.sin(y) / y)) / z;
}
def code(x, y, z): return (x * (math.sin(y) / y)) / z
function code(x, y, z) return Float64(Float64(x * Float64(sin(y) / y)) / z) end
function tmp = code(x, y, z) tmp = (x * (sin(y) / y)) / z; end
code[x_, y_, z_] := N[(N[(x * N[(N[Sin[y], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot \frac{\sin y}{y}}{z}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (/ (* x (/ (sin y) y)) z))
double code(double x, double y, double z) {
return (x * (sin(y) / 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 * (sin(y) / y)) / z
end function
public static double code(double x, double y, double z) {
return (x * (Math.sin(y) / y)) / z;
}
def code(x, y, z): return (x * (math.sin(y) / y)) / z
function code(x, y, z) return Float64(Float64(x * Float64(sin(y) / y)) / z) end
function tmp = code(x, y, z) tmp = (x * (sin(y) / y)) / z; end
code[x_, y_, z_] := N[(N[(x * N[(N[Sin[y], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot \frac{\sin y}{y}}{z}
\end{array}
(FPCore (x y z) :precision binary64 (let* ((t_0 (/ (sin y) y)) (t_1 (/ (* x t_0) z))) (if (<= t_1 -5e-222) t_1 (* t_0 (/ x z)))))
double code(double x, double y, double z) {
double t_0 = sin(y) / y;
double t_1 = (x * t_0) / z;
double tmp;
if (t_1 <= -5e-222) {
tmp = t_1;
} else {
tmp = t_0 * (x / 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) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = sin(y) / y
t_1 = (x * t_0) / z
if (t_1 <= (-5d-222)) then
tmp = t_1
else
tmp = t_0 * (x / z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = Math.sin(y) / y;
double t_1 = (x * t_0) / z;
double tmp;
if (t_1 <= -5e-222) {
tmp = t_1;
} else {
tmp = t_0 * (x / z);
}
return tmp;
}
def code(x, y, z): t_0 = math.sin(y) / y t_1 = (x * t_0) / z tmp = 0 if t_1 <= -5e-222: tmp = t_1 else: tmp = t_0 * (x / z) return tmp
function code(x, y, z) t_0 = Float64(sin(y) / y) t_1 = Float64(Float64(x * t_0) / z) tmp = 0.0 if (t_1 <= -5e-222) tmp = t_1; else tmp = Float64(t_0 * Float64(x / z)); end return tmp end
function tmp_2 = code(x, y, z) t_0 = sin(y) / y; t_1 = (x * t_0) / z; tmp = 0.0; if (t_1 <= -5e-222) tmp = t_1; else tmp = t_0 * (x / z); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[Sin[y], $MachinePrecision] / y), $MachinePrecision]}, Block[{t$95$1 = N[(N[(x * t$95$0), $MachinePrecision] / z), $MachinePrecision]}, If[LessEqual[t$95$1, -5e-222], t$95$1, N[(t$95$0 * N[(x / z), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\sin y}{y}\\
t_1 := \frac{x \cdot t_0}{z}\\
\mathbf{if}\;t_1 \leq -5 \cdot 10^{-222}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot \frac{x}{z}\\
\end{array}
\end{array}
if (/.f64 (*.f64 x (/.f64 (sin.f64 y) y)) z) < -5.00000000000000008e-222Initial program 99.8%
if -5.00000000000000008e-222 < (/.f64 (*.f64 x (/.f64 (sin.f64 y) y)) z) Initial program 93.1%
associate-/l*93.1%
associate-/r/83.0%
Simplified83.0%
*-un-lft-identity83.0%
frac-times80.1%
clear-num80.9%
frac-times85.8%
*-commutative85.8%
times-frac98.7%
Applied egg-rr98.7%
Final simplification99.1%
(FPCore (x y z) :precision binary64 (if (<= y 6e-6) (* (/ x z) (+ 1.0 (* -0.16666666666666666 (* y y)))) (* (sin y) (/ x (* y z)))))
double code(double x, double y, double z) {
double tmp;
if (y <= 6e-6) {
tmp = (x / z) * (1.0 + (-0.16666666666666666 * (y * y)));
} else {
tmp = sin(y) * (x / (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 <= 6d-6) then
tmp = (x / z) * (1.0d0 + ((-0.16666666666666666d0) * (y * y)))
else
tmp = sin(y) * (x / (y * z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 6e-6) {
tmp = (x / z) * (1.0 + (-0.16666666666666666 * (y * y)));
} else {
tmp = Math.sin(y) * (x / (y * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 6e-6: tmp = (x / z) * (1.0 + (-0.16666666666666666 * (y * y))) else: tmp = math.sin(y) * (x / (y * z)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 6e-6) tmp = Float64(Float64(x / z) * Float64(1.0 + Float64(-0.16666666666666666 * Float64(y * y)))); else tmp = Float64(sin(y) * Float64(x / Float64(y * z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 6e-6) tmp = (x / z) * (1.0 + (-0.16666666666666666 * (y * y))); else tmp = sin(y) * (x / (y * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 6e-6], N[(N[(x / z), $MachinePrecision] * N[(1.0 + N[(-0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[y], $MachinePrecision] * N[(x / N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 6 \cdot 10^{-6}:\\
\;\;\;\;\frac{x}{z} \cdot \left(1 + -0.16666666666666666 \cdot \left(y \cdot y\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\sin y \cdot \frac{x}{y \cdot z}\\
\end{array}
\end{array}
if y < 6.0000000000000002e-6Initial program 96.9%
associate-/l*93.6%
associate-/r/78.3%
Simplified78.3%
*-un-lft-identity78.3%
frac-times75.9%
clear-num76.8%
frac-times78.7%
*-commutative78.7%
times-frac98.4%
Applied egg-rr98.4%
Taylor expanded in y around 0 68.6%
unpow268.6%
Simplified68.6%
if 6.0000000000000002e-6 < y Initial program 91.1%
associate-*l/92.3%
times-frac87.9%
*-commutative87.9%
associate-*r/87.9%
*-commutative87.9%
Simplified87.9%
Final simplification73.4%
(FPCore (x y z) :precision binary64 (* (/ (sin y) y) (/ x z)))
double code(double x, double y, double z) {
return (sin(y) / y) * (x / z);
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (sin(y) / y) * (x / z)
end function
public static double code(double x, double y, double z) {
return (Math.sin(y) / y) * (x / z);
}
def code(x, y, z): return (math.sin(y) / y) * (x / z)
function code(x, y, z) return Float64(Float64(sin(y) / y) * Float64(x / z)) end
function tmp = code(x, y, z) tmp = (sin(y) / y) * (x / z); end
code[x_, y_, z_] := N[(N[(N[Sin[y], $MachinePrecision] / y), $MachinePrecision] * N[(x / z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin y}{y} \cdot \frac{x}{z}
\end{array}
Initial program 95.5%
associate-/l*92.1%
associate-/r/80.7%
Simplified80.7%
*-un-lft-identity80.7%
frac-times79.8%
clear-num80.5%
frac-times81.0%
*-commutative81.0%
times-frac96.9%
Applied egg-rr96.9%
Final simplification96.9%
(FPCore (x y z) :precision binary64 (if (<= y 2.5) (/ x z) (* 6.0 (* (/ 1.0 y) (/ (/ x z) y)))))
double code(double x, double y, double z) {
double tmp;
if (y <= 2.5) {
tmp = x / z;
} else {
tmp = 6.0 * ((1.0 / y) * ((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.5d0) then
tmp = x / z
else
tmp = 6.0d0 * ((1.0d0 / y) * ((x / z) / y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 2.5) {
tmp = x / z;
} else {
tmp = 6.0 * ((1.0 / y) * ((x / z) / y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 2.5: tmp = x / z else: tmp = 6.0 * ((1.0 / y) * ((x / z) / y)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 2.5) tmp = Float64(x / z); else tmp = Float64(6.0 * Float64(Float64(1.0 / y) * Float64(Float64(x / z) / y))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 2.5) tmp = x / z; else tmp = 6.0 * ((1.0 / y) * ((x / z) / y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 2.5], N[(x / z), $MachinePrecision], N[(6.0 * N[(N[(1.0 / y), $MachinePrecision] * N[(N[(x / z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.5:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;6 \cdot \left(\frac{1}{y} \cdot \frac{\frac{x}{z}}{y}\right)\\
\end{array}
\end{array}
if y < 2.5Initial program 96.9%
associate-*l/98.4%
times-frac78.7%
*-commutative78.7%
associate-*r/80.0%
*-commutative80.0%
Simplified80.0%
Taylor expanded in y around 0 71.2%
if 2.5 < y Initial program 91.1%
associate-/l*87.8%
associate-/r/87.9%
Simplified87.9%
Taylor expanded in y around 0 36.3%
Taylor expanded in y around inf 36.3%
*-commutative36.3%
unpow236.3%
Simplified36.3%
associate-/r*36.2%
*-un-lft-identity36.2%
times-frac36.4%
Applied egg-rr36.4%
Final simplification62.5%
(FPCore (x y z) :precision binary64 (if (<= y 12.5) (* (/ x z) (+ 1.0 (* -0.16666666666666666 (* y y)))) (* 6.0 (* (/ 1.0 y) (/ (/ x z) y)))))
double code(double x, double y, double z) {
double tmp;
if (y <= 12.5) {
tmp = (x / z) * (1.0 + (-0.16666666666666666 * (y * y)));
} else {
tmp = 6.0 * ((1.0 / y) * ((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 <= 12.5d0) then
tmp = (x / z) * (1.0d0 + ((-0.16666666666666666d0) * (y * y)))
else
tmp = 6.0d0 * ((1.0d0 / y) * ((x / z) / y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 12.5) {
tmp = (x / z) * (1.0 + (-0.16666666666666666 * (y * y)));
} else {
tmp = 6.0 * ((1.0 / y) * ((x / z) / y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 12.5: tmp = (x / z) * (1.0 + (-0.16666666666666666 * (y * y))) else: tmp = 6.0 * ((1.0 / y) * ((x / z) / y)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 12.5) tmp = Float64(Float64(x / z) * Float64(1.0 + Float64(-0.16666666666666666 * Float64(y * y)))); else tmp = Float64(6.0 * Float64(Float64(1.0 / y) * Float64(Float64(x / z) / y))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 12.5) tmp = (x / z) * (1.0 + (-0.16666666666666666 * (y * y))); else tmp = 6.0 * ((1.0 / y) * ((x / z) / y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 12.5], N[(N[(x / z), $MachinePrecision] * N[(1.0 + N[(-0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(6.0 * N[(N[(1.0 / y), $MachinePrecision] * N[(N[(x / z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 12.5:\\
\;\;\;\;\frac{x}{z} \cdot \left(1 + -0.16666666666666666 \cdot \left(y \cdot y\right)\right)\\
\mathbf{else}:\\
\;\;\;\;6 \cdot \left(\frac{1}{y} \cdot \frac{\frac{x}{z}}{y}\right)\\
\end{array}
\end{array}
if y < 12.5Initial program 96.9%
associate-/l*93.6%
associate-/r/78.4%
Simplified78.4%
*-un-lft-identity78.4%
frac-times76.0%
clear-num76.9%
frac-times78.8%
*-commutative78.8%
times-frac98.4%
Applied egg-rr98.4%
Taylor expanded in y around 0 68.3%
unpow268.3%
Simplified68.3%
if 12.5 < y Initial program 91.0%
associate-/l*87.6%
associate-/r/87.7%
Simplified87.7%
Taylor expanded in y around 0 36.9%
Taylor expanded in y around inf 36.8%
*-commutative36.8%
unpow236.8%
Simplified36.8%
associate-/r*36.7%
*-un-lft-identity36.7%
times-frac36.9%
Applied egg-rr36.9%
Final simplification60.6%
(FPCore (x y z) :precision binary64 (if (<= y 12.5) (* (/ x z) (+ 1.0 (* -0.16666666666666666 (* y y)))) (/ (* (* 6.0 (/ x y)) (/ 1.0 z)) y)))
double code(double x, double y, double z) {
double tmp;
if (y <= 12.5) {
tmp = (x / z) * (1.0 + (-0.16666666666666666 * (y * y)));
} else {
tmp = ((6.0 * (x / y)) * (1.0 / 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 <= 12.5d0) then
tmp = (x / z) * (1.0d0 + ((-0.16666666666666666d0) * (y * y)))
else
tmp = ((6.0d0 * (x / y)) * (1.0d0 / z)) / y
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 12.5) {
tmp = (x / z) * (1.0 + (-0.16666666666666666 * (y * y)));
} else {
tmp = ((6.0 * (x / y)) * (1.0 / z)) / y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 12.5: tmp = (x / z) * (1.0 + (-0.16666666666666666 * (y * y))) else: tmp = ((6.0 * (x / y)) * (1.0 / z)) / y return tmp
function code(x, y, z) tmp = 0.0 if (y <= 12.5) tmp = Float64(Float64(x / z) * Float64(1.0 + Float64(-0.16666666666666666 * Float64(y * y)))); else tmp = Float64(Float64(Float64(6.0 * Float64(x / y)) * Float64(1.0 / z)) / y); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 12.5) tmp = (x / z) * (1.0 + (-0.16666666666666666 * (y * y))); else tmp = ((6.0 * (x / y)) * (1.0 / z)) / y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 12.5], N[(N[(x / z), $MachinePrecision] * N[(1.0 + N[(-0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(6.0 * N[(x / y), $MachinePrecision]), $MachinePrecision] * N[(1.0 / z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 12.5:\\
\;\;\;\;\frac{x}{z} \cdot \left(1 + -0.16666666666666666 \cdot \left(y \cdot y\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(6 \cdot \frac{x}{y}\right) \cdot \frac{1}{z}}{y}\\
\end{array}
\end{array}
if y < 12.5Initial program 96.9%
associate-/l*93.6%
associate-/r/78.4%
Simplified78.4%
*-un-lft-identity78.4%
frac-times76.0%
clear-num76.9%
frac-times78.8%
*-commutative78.8%
times-frac98.4%
Applied egg-rr98.4%
Taylor expanded in y around 0 68.3%
unpow268.3%
Simplified68.3%
if 12.5 < y Initial program 91.0%
associate-/l*87.6%
associate-/r/87.7%
Simplified87.7%
Taylor expanded in y around 0 36.9%
Taylor expanded in y around inf 36.8%
*-commutative36.8%
unpow236.8%
Simplified36.8%
associate-/r*36.7%
div-inv36.7%
times-frac36.9%
Applied egg-rr36.9%
associate-*r*36.9%
associate-*r/36.9%
Applied egg-rr36.9%
Final simplification60.6%
(FPCore (x y z) :precision binary64 (if (<= y 5.5e+71) (/ x z) (* 6.0 (/ x (* z (* y y))))))
double code(double x, double y, double z) {
double tmp;
if (y <= 5.5e+71) {
tmp = x / z;
} else {
tmp = 6.0 * (x / (z * (y * 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.5d+71) then
tmp = x / z
else
tmp = 6.0d0 * (x / (z * (y * y)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 5.5e+71) {
tmp = x / z;
} else {
tmp = 6.0 * (x / (z * (y * y)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 5.5e+71: tmp = x / z else: tmp = 6.0 * (x / (z * (y * y))) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 5.5e+71) tmp = Float64(x / z); else tmp = Float64(6.0 * Float64(x / Float64(z * Float64(y * y)))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 5.5e+71) tmp = x / z; else tmp = 6.0 * (x / (z * (y * y))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 5.5e+71], N[(x / z), $MachinePrecision], N[(6.0 * N[(x / N[(z * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 5.5 \cdot 10^{+71}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;6 \cdot \frac{x}{z \cdot \left(y \cdot y\right)}\\
\end{array}
\end{array}
if y < 5.5e71Initial program 97.1%
associate-*l/98.4%
times-frac80.0%
*-commutative80.0%
associate-*r/81.2%
*-commutative81.2%
Simplified81.2%
Taylor expanded in y around 0 68.0%
if 5.5e71 < y Initial program 89.1%
associate-/l*84.8%
associate-/r/84.9%
Simplified84.9%
Taylor expanded in y around 0 40.2%
Taylor expanded in y around inf 40.1%
*-commutative40.1%
unpow240.1%
Simplified40.1%
Final simplification62.4%
(FPCore (x y z) :precision binary64 (if (<= y 4.6e+53) (/ x z) (* 6.0 (/ (/ x y) (* y z)))))
double code(double x, double y, double z) {
double tmp;
if (y <= 4.6e+53) {
tmp = x / z;
} else {
tmp = 6.0 * ((x / y) / (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 <= 4.6d+53) then
tmp = x / z
else
tmp = 6.0d0 * ((x / y) / (y * z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 4.6e+53) {
tmp = x / z;
} else {
tmp = 6.0 * ((x / y) / (y * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 4.6e+53: tmp = x / z else: tmp = 6.0 * ((x / y) / (y * z)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 4.6e+53) tmp = Float64(x / z); else tmp = Float64(6.0 * Float64(Float64(x / y) / Float64(y * z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 4.6e+53) tmp = x / z; else tmp = 6.0 * ((x / y) / (y * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 4.6e+53], N[(x / z), $MachinePrecision], N[(6.0 * N[(N[(x / y), $MachinePrecision] / N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 4.6 \cdot 10^{+53}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;6 \cdot \frac{\frac{x}{y}}{y \cdot z}\\
\end{array}
\end{array}
if y < 4.60000000000000039e53Initial program 97.0%
associate-*l/98.4%
times-frac79.7%
*-commutative79.7%
associate-*r/80.9%
*-commutative80.9%
Simplified80.9%
Taylor expanded in y around 0 68.9%
if 4.60000000000000039e53 < y Initial program 89.7%
associate-/l*85.7%
associate-/r/85.7%
Simplified85.7%
Taylor expanded in y around 0 38.2%
Taylor expanded in y around inf 38.2%
*-commutative38.2%
unpow238.2%
Simplified38.2%
Taylor expanded in x around 0 38.2%
unpow238.2%
associate-*r*38.2%
associate-/r*38.3%
*-commutative38.3%
Simplified38.3%
Final simplification62.5%
(FPCore (x y z) :precision binary64 (if (<= y 2.5) (/ x z) (/ (/ (* x 6.0) (* y z)) y)))
double code(double x, double y, double z) {
double tmp;
if (y <= 2.5) {
tmp = x / z;
} else {
tmp = ((x * 6.0) / (y * 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.5d0) then
tmp = x / z
else
tmp = ((x * 6.0d0) / (y * z)) / y
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 2.5) {
tmp = x / z;
} else {
tmp = ((x * 6.0) / (y * z)) / y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 2.5: tmp = x / z else: tmp = ((x * 6.0) / (y * z)) / y return tmp
function code(x, y, z) tmp = 0.0 if (y <= 2.5) tmp = Float64(x / z); else tmp = Float64(Float64(Float64(x * 6.0) / Float64(y * z)) / y); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 2.5) tmp = x / z; else tmp = ((x * 6.0) / (y * z)) / y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 2.5], N[(x / z), $MachinePrecision], N[(N[(N[(x * 6.0), $MachinePrecision] / N[(y * z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.5:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x \cdot 6}{y \cdot z}}{y}\\
\end{array}
\end{array}
if y < 2.5Initial program 96.9%
associate-*l/98.4%
times-frac78.7%
*-commutative78.7%
associate-*r/80.0%
*-commutative80.0%
Simplified80.0%
Taylor expanded in y around 0 71.2%
if 2.5 < y Initial program 91.1%
associate-/l*87.8%
associate-/r/87.9%
Simplified87.9%
Taylor expanded in y around 0 36.3%
Taylor expanded in y around inf 36.3%
*-commutative36.3%
unpow236.3%
Simplified36.3%
associate-*r/36.3%
associate-*r*36.3%
associate-/r*36.3%
*-commutative36.3%
*-commutative36.3%
Applied egg-rr36.3%
Final simplification62.5%
(FPCore (x y z) :precision binary64 (if (<= y 6e+46) (/ x z) (* y (/ x (* y z)))))
double code(double x, double y, double z) {
double tmp;
if (y <= 6e+46) {
tmp = x / z;
} else {
tmp = y * (x / (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 <= 6d+46) then
tmp = x / z
else
tmp = y * (x / (y * z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 6e+46) {
tmp = x / z;
} else {
tmp = y * (x / (y * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 6e+46: tmp = x / z else: tmp = y * (x / (y * z)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 6e+46) tmp = Float64(x / z); else tmp = Float64(y * Float64(x / Float64(y * z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 6e+46) tmp = x / z; else tmp = y * (x / (y * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 6e+46], N[(x / z), $MachinePrecision], N[(y * N[(x / N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 6 \cdot 10^{+46}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x}{y \cdot z}\\
\end{array}
\end{array}
if y < 6.00000000000000047e46Initial program 97.0%
associate-*l/98.4%
times-frac79.6%
*-commutative79.6%
associate-*r/80.8%
*-commutative80.8%
Simplified80.8%
Taylor expanded in y around 0 68.8%
if 6.00000000000000047e46 < y Initial program 89.8%
associate-*r/89.8%
associate-/l/86.1%
*-commutative86.1%
times-frac90.1%
Simplified90.1%
Taylor expanded in y around 0 24.2%
clear-num27.6%
un-div-inv27.6%
Applied egg-rr27.6%
div-inv27.6%
clear-num24.2%
div-inv24.2%
associate-*l*38.7%
times-frac38.8%
*-un-lft-identity38.8%
*-commutative38.8%
Applied egg-rr38.8%
Final simplification62.3%
(FPCore (x y z) :precision binary64 (/ x z))
double code(double x, double y, double z) {
return x / 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 / z
end function
public static double code(double x, double y, double z) {
return x / z;
}
def code(x, y, z): return x / z
function code(x, y, z) return Float64(x / z) end
function tmp = code(x, y, z) tmp = x / z; end
code[x_, y_, z_] := N[(x / z), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{z}
\end{array}
Initial program 95.5%
associate-*l/96.9%
times-frac81.0%
*-commutative81.0%
associate-*r/82.0%
*-commutative82.0%
Simplified82.0%
Taylor expanded in y around 0 57.5%
Final simplification57.5%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (/ y (sin y))) (t_1 (/ (* x (/ 1.0 t_0)) z)))
(if (< z -4.2173720203427147e-29)
t_1
(if (< z 4.446702369113811e+64) (/ x (* z t_0)) t_1))))
double code(double x, double y, double z) {
double t_0 = y / sin(y);
double t_1 = (x * (1.0 / t_0)) / z;
double tmp;
if (z < -4.2173720203427147e-29) {
tmp = t_1;
} else if (z < 4.446702369113811e+64) {
tmp = x / (z * t_0);
} else {
tmp = t_1;
}
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) :: t_1
real(8) :: tmp
t_0 = y / sin(y)
t_1 = (x * (1.0d0 / t_0)) / z
if (z < (-4.2173720203427147d-29)) then
tmp = t_1
else if (z < 4.446702369113811d+64) then
tmp = x / (z * t_0)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = y / Math.sin(y);
double t_1 = (x * (1.0 / t_0)) / z;
double tmp;
if (z < -4.2173720203427147e-29) {
tmp = t_1;
} else if (z < 4.446702369113811e+64) {
tmp = x / (z * t_0);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z): t_0 = y / math.sin(y) t_1 = (x * (1.0 / t_0)) / z tmp = 0 if z < -4.2173720203427147e-29: tmp = t_1 elif z < 4.446702369113811e+64: tmp = x / (z * t_0) else: tmp = t_1 return tmp
function code(x, y, z) t_0 = Float64(y / sin(y)) t_1 = Float64(Float64(x * Float64(1.0 / t_0)) / z) tmp = 0.0 if (z < -4.2173720203427147e-29) tmp = t_1; elseif (z < 4.446702369113811e+64) tmp = Float64(x / Float64(z * t_0)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z) t_0 = y / sin(y); t_1 = (x * (1.0 / t_0)) / z; tmp = 0.0; if (z < -4.2173720203427147e-29) tmp = t_1; elseif (z < 4.446702369113811e+64) tmp = x / (z * t_0); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(y / N[Sin[y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(x * N[(1.0 / t$95$0), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]}, If[Less[z, -4.2173720203427147e-29], t$95$1, If[Less[z, 4.446702369113811e+64], N[(x / N[(z * t$95$0), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{y}{\sin y}\\
t_1 := \frac{x \cdot \frac{1}{t_0}}{z}\\
\mathbf{if}\;z < -4.2173720203427147 \cdot 10^{-29}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z < 4.446702369113811 \cdot 10^{+64}:\\
\;\;\;\;\frac{x}{z \cdot t_0}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
herbie shell --seed 2023207
(FPCore (x y z)
:name "Linear.Quaternion:$ctanh from linear-1.19.1.3"
:precision binary64
:herbie-target
(if (< z -4.2173720203427147e-29) (/ (* x (/ 1.0 (/ y (sin y)))) z) (if (< z 4.446702369113811e+64) (/ x (* z (/ y (sin y)))) (/ (* x (/ 1.0 (/ y (sin y)))) z)))
(/ (* x (/ (sin y) y)) z))