
(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 13 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))) (if (<= x 3.6e-29) (* t_0 (/ x z)) (/ (* x t_0) z))))
double code(double x, double y, double z) {
double t_0 = sin(y) / y;
double tmp;
if (x <= 3.6e-29) {
tmp = t_0 * (x / z);
} else {
tmp = (x * t_0) / 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) :: tmp
t_0 = sin(y) / y
if (x <= 3.6d-29) then
tmp = t_0 * (x / z)
else
tmp = (x * t_0) / 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 tmp;
if (x <= 3.6e-29) {
tmp = t_0 * (x / z);
} else {
tmp = (x * t_0) / z;
}
return tmp;
}
def code(x, y, z): t_0 = math.sin(y) / y tmp = 0 if x <= 3.6e-29: tmp = t_0 * (x / z) else: tmp = (x * t_0) / z return tmp
function code(x, y, z) t_0 = Float64(sin(y) / y) tmp = 0.0 if (x <= 3.6e-29) tmp = Float64(t_0 * Float64(x / z)); else tmp = Float64(Float64(x * t_0) / z); end return tmp end
function tmp_2 = code(x, y, z) t_0 = sin(y) / y; tmp = 0.0; if (x <= 3.6e-29) tmp = t_0 * (x / z); else tmp = (x * t_0) / z; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[Sin[y], $MachinePrecision] / y), $MachinePrecision]}, If[LessEqual[x, 3.6e-29], N[(t$95$0 * N[(x / z), $MachinePrecision]), $MachinePrecision], N[(N[(x * t$95$0), $MachinePrecision] / z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\sin y}{y}\\
\mathbf{if}\;x \leq 3.6 \cdot 10^{-29}:\\
\;\;\;\;t_0 \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot t_0}{z}\\
\end{array}
\end{array}
if x < 3.59999999999999974e-29Initial program 95.8%
associate-/l*95.9%
associate-/r/89.1%
Simplified89.1%
*-un-lft-identity89.1%
frac-times83.0%
clear-num83.3%
frac-times85.2%
*-commutative85.2%
times-frac98.3%
Applied egg-rr98.3%
if 3.59999999999999974e-29 < x Initial program 99.8%
Final simplification98.7%
(FPCore (x y z) :precision binary64 (if (<= y 7.5e-5) (* (/ 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 <= 7.5e-5) {
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 <= 7.5d-5) 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 <= 7.5e-5) {
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 <= 7.5e-5: 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 <= 7.5e-5) 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 <= 7.5e-5) 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, 7.5e-5], 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 7.5 \cdot 10^{-5}:\\
\;\;\;\;\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 < 7.49999999999999934e-5Initial program 98.4%
associate-/l*95.6%
associate-/r/85.2%
Simplified85.2%
*-un-lft-identity85.2%
frac-times80.7%
clear-num81.0%
frac-times83.8%
*-commutative83.8%
times-frac98.4%
Applied egg-rr98.4%
Taylor expanded in y around 0 67.7%
unpow267.7%
Simplified67.7%
if 7.49999999999999934e-5 < y Initial program 91.1%
associate-*l/91.1%
times-frac93.3%
*-commutative93.3%
associate-*r/93.2%
*-commutative93.2%
Simplified93.2%
Final simplification73.3%
(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 96.8%
associate-/l*95.1%
associate-/r/86.9%
Simplified86.9%
*-un-lft-identity86.9%
frac-times83.0%
clear-num83.2%
frac-times85.9%
*-commutative85.9%
times-frac96.8%
Applied egg-rr96.8%
Final simplification96.8%
(FPCore (x y z) :precision binary64 (if (<= y 130000000000.0) (* (/ x z) (+ 1.0 (* -0.16666666666666666 (* y y)))) (/ (/ 6.0 y) (* y (/ z x)))))
double code(double x, double y, double z) {
double tmp;
if (y <= 130000000000.0) {
tmp = (x / z) * (1.0 + (-0.16666666666666666 * (y * y)));
} else {
tmp = (6.0 / y) / (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 <= 130000000000.0d0) then
tmp = (x / z) * (1.0d0 + ((-0.16666666666666666d0) * (y * y)))
else
tmp = (6.0d0 / y) / (y * (z / x))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 130000000000.0) {
tmp = (x / z) * (1.0 + (-0.16666666666666666 * (y * y)));
} else {
tmp = (6.0 / y) / (y * (z / x));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 130000000000.0: tmp = (x / z) * (1.0 + (-0.16666666666666666 * (y * y))) else: tmp = (6.0 / y) / (y * (z / x)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 130000000000.0) tmp = Float64(Float64(x / z) * Float64(1.0 + Float64(-0.16666666666666666 * Float64(y * y)))); else tmp = Float64(Float64(6.0 / y) / Float64(y * Float64(z / x))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 130000000000.0) tmp = (x / z) * (1.0 + (-0.16666666666666666 * (y * y))); else tmp = (6.0 / y) / (y * (z / x)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 130000000000.0], N[(N[(x / z), $MachinePrecision] * N[(1.0 + N[(-0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(6.0 / y), $MachinePrecision] / N[(y * N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 130000000000:\\
\;\;\;\;\frac{x}{z} \cdot \left(1 + -0.16666666666666666 \cdot \left(y \cdot y\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{6}{y}}{y \cdot \frac{z}{x}}\\
\end{array}
\end{array}
if y < 1.3e11Initial program 98.4%
associate-/l*95.7%
associate-/r/85.4%
Simplified85.4%
*-un-lft-identity85.4%
frac-times81.0%
clear-num81.3%
frac-times84.0%
*-commutative84.0%
times-frac98.4%
Applied egg-rr98.4%
Taylor expanded in y around 0 67.3%
unpow267.3%
Simplified67.3%
if 1.3e11 < y Initial program 90.6%
associate-/l*92.9%
associate-/r/92.9%
Simplified92.9%
Taylor expanded in y around 0 41.4%
Taylor expanded in y around inf 41.4%
associate-*r/41.4%
times-frac43.0%
unpow243.0%
Simplified43.0%
*-commutative43.0%
clear-num43.0%
associate-/r*43.0%
frac-times43.2%
*-un-lft-identity43.2%
Applied egg-rr43.2%
Final simplification62.3%
(FPCore (x y z) :precision binary64 (if (<= y 3.95e+108) (/ x z) (if (<= y 1.16e+230) (* (/ x y) (/ y z)) (/ x (/ (* y z) y)))))
double code(double x, double y, double z) {
double tmp;
if (y <= 3.95e+108) {
tmp = x / z;
} else if (y <= 1.16e+230) {
tmp = (x / y) * (y / z);
} else {
tmp = x / ((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 <= 3.95d+108) then
tmp = x / z
else if (y <= 1.16d+230) then
tmp = (x / y) * (y / z)
else
tmp = x / ((y * z) / y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 3.95e+108) {
tmp = x / z;
} else if (y <= 1.16e+230) {
tmp = (x / y) * (y / z);
} else {
tmp = x / ((y * z) / y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 3.95e+108: tmp = x / z elif y <= 1.16e+230: tmp = (x / y) * (y / z) else: tmp = x / ((y * z) / y) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 3.95e+108) tmp = Float64(x / z); elseif (y <= 1.16e+230) tmp = Float64(Float64(x / y) * Float64(y / z)); else tmp = Float64(x / Float64(Float64(y * z) / y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 3.95e+108) tmp = x / z; elseif (y <= 1.16e+230) tmp = (x / y) * (y / z); else tmp = x / ((y * z) / y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 3.95e+108], N[(x / z), $MachinePrecision], If[LessEqual[y, 1.16e+230], N[(N[(x / y), $MachinePrecision] * N[(y / z), $MachinePrecision]), $MachinePrecision], N[(x / N[(N[(y * z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 3.95 \cdot 10^{+108}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{elif}\;y \leq 1.16 \cdot 10^{+230}:\\
\;\;\;\;\frac{x}{y} \cdot \frac{y}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{y \cdot z}{y}}\\
\end{array}
\end{array}
if y < 3.9500000000000003e108Initial program 98.4%
associate-*l/98.5%
times-frac84.8%
*-commutative84.8%
associate-*r/82.4%
*-commutative82.4%
Simplified82.4%
Taylor expanded in y around 0 69.4%
if 3.9500000000000003e108 < y < 1.15999999999999993e230Initial program 89.7%
associate-*r/89.5%
associate-/l/96.2%
*-commutative96.2%
times-frac89.6%
Simplified89.6%
Taylor expanded in y around 0 47.6%
if 1.15999999999999993e230 < y Initial program 88.2%
associate-/l*83.7%
associate-/r/83.8%
Simplified83.8%
Taylor expanded in y around 0 9.4%
associate-*l/32.6%
*-commutative32.6%
Applied egg-rr32.6%
Final simplification64.8%
(FPCore (x y z) :precision binary64 (if (<= y 0.00041) (/ x z) (* (/ x z) (/ 6.0 (* y y)))))
double code(double x, double y, double z) {
double tmp;
if (y <= 0.00041) {
tmp = x / z;
} else {
tmp = (x / z) * (6.0 / (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 <= 0.00041d0) then
tmp = x / z
else
tmp = (x / z) * (6.0d0 / (y * y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 0.00041) {
tmp = x / z;
} else {
tmp = (x / z) * (6.0 / (y * y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 0.00041: tmp = x / z else: tmp = (x / z) * (6.0 / (y * y)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 0.00041) tmp = Float64(x / z); else tmp = Float64(Float64(x / z) * Float64(6.0 / Float64(y * y))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 0.00041) tmp = x / z; else tmp = (x / z) * (6.0 / (y * y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 0.00041], N[(x / z), $MachinePrecision], N[(N[(x / z), $MachinePrecision] * N[(6.0 / N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 0.00041:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z} \cdot \frac{6}{y \cdot y}\\
\end{array}
\end{array}
if y < 4.0999999999999999e-4Initial program 98.4%
associate-*l/98.4%
times-frac83.8%
*-commutative83.8%
associate-*r/81.3%
*-commutative81.3%
Simplified81.3%
Taylor expanded in y around 0 71.8%
if 4.0999999999999999e-4 < y Initial program 91.1%
associate-/l*93.2%
associate-/r/93.2%
Simplified93.2%
Taylor expanded in y around 0 41.0%
Taylor expanded in y around inf 41.0%
associate-*r/41.0%
times-frac42.5%
unpow242.5%
Simplified42.5%
Final simplification65.4%
(FPCore (x y z) :precision binary64 (if (<= y 0.00041) (/ x z) (/ 6.0 (* (* y y) (/ z x)))))
double code(double x, double y, double z) {
double tmp;
if (y <= 0.00041) {
tmp = x / z;
} else {
tmp = 6.0 / ((y * 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 <= 0.00041d0) then
tmp = x / z
else
tmp = 6.0d0 / ((y * y) * (z / x))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 0.00041) {
tmp = x / z;
} else {
tmp = 6.0 / ((y * y) * (z / x));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 0.00041: tmp = x / z else: tmp = 6.0 / ((y * y) * (z / x)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 0.00041) tmp = Float64(x / z); else tmp = Float64(6.0 / Float64(Float64(y * y) * Float64(z / x))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 0.00041) tmp = x / z; else tmp = 6.0 / ((y * y) * (z / x)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 0.00041], N[(x / z), $MachinePrecision], N[(6.0 / N[(N[(y * y), $MachinePrecision] * N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 0.00041:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{6}{\left(y \cdot y\right) \cdot \frac{z}{x}}\\
\end{array}
\end{array}
if y < 4.0999999999999999e-4Initial program 98.4%
associate-*l/98.4%
times-frac83.8%
*-commutative83.8%
associate-*r/81.3%
*-commutative81.3%
Simplified81.3%
Taylor expanded in y around 0 71.8%
if 4.0999999999999999e-4 < y Initial program 91.1%
associate-/l*93.2%
associate-/r/93.2%
Simplified93.2%
Taylor expanded in y around 0 41.0%
Taylor expanded in y around inf 41.0%
associate-*r/41.0%
times-frac42.5%
unpow242.5%
Simplified42.5%
*-commutative42.5%
clear-num42.5%
frac-times42.6%
metadata-eval42.6%
Applied egg-rr42.6%
Final simplification65.4%
(FPCore (x y z) :precision binary64 (if (<= y 0.00041) (/ x z) (/ (* (/ 6.0 z) (/ x y)) y)))
double code(double x, double y, double z) {
double tmp;
if (y <= 0.00041) {
tmp = x / z;
} else {
tmp = ((6.0 / z) * (x / 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 <= 0.00041d0) then
tmp = x / z
else
tmp = ((6.0d0 / z) * (x / y)) / y
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 0.00041) {
tmp = x / z;
} else {
tmp = ((6.0 / z) * (x / y)) / y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 0.00041: tmp = x / z else: tmp = ((6.0 / z) * (x / y)) / y return tmp
function code(x, y, z) tmp = 0.0 if (y <= 0.00041) tmp = Float64(x / z); else tmp = Float64(Float64(Float64(6.0 / z) * Float64(x / y)) / y); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 0.00041) tmp = x / z; else tmp = ((6.0 / z) * (x / y)) / y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 0.00041], N[(x / z), $MachinePrecision], N[(N[(N[(6.0 / z), $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 0.00041:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{6}{z} \cdot \frac{x}{y}}{y}\\
\end{array}
\end{array}
if y < 4.0999999999999999e-4Initial program 98.4%
associate-*l/98.4%
times-frac83.8%
*-commutative83.8%
associate-*r/81.3%
*-commutative81.3%
Simplified81.3%
Taylor expanded in y around 0 71.8%
if 4.0999999999999999e-4 < y Initial program 91.1%
associate-/l*93.2%
associate-/r/93.2%
Simplified93.2%
Taylor expanded in y around 0 41.0%
Taylor expanded in y around inf 41.0%
*-commutative41.0%
unpow241.0%
Simplified41.0%
Taylor expanded in x around 0 41.0%
associate-*r/41.0%
*-commutative41.0%
unpow241.0%
*-commutative41.0%
associate-*l*41.0%
associate-/l*41.0%
associate-*l*41.0%
*-commutative41.0%
associate-/l*41.0%
metadata-eval41.0%
associate-/r*41.0%
*-commutative41.0%
associate-/l*42.5%
associate-*l/41.0%
*-commutative41.0%
associate-/r*41.0%
associate-*r/42.7%
*-commutative42.7%
associate-/r*42.7%
metadata-eval42.7%
Simplified42.7%
Final simplification65.4%
(FPCore (x y z) :precision binary64 (if (<= y 0.00041) (/ x z) (/ (/ 6.0 y) (* y (/ z x)))))
double code(double x, double y, double z) {
double tmp;
if (y <= 0.00041) {
tmp = x / z;
} else {
tmp = (6.0 / y) / (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 <= 0.00041d0) then
tmp = x / z
else
tmp = (6.0d0 / y) / (y * (z / x))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 0.00041) {
tmp = x / z;
} else {
tmp = (6.0 / y) / (y * (z / x));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 0.00041: tmp = x / z else: tmp = (6.0 / y) / (y * (z / x)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 0.00041) tmp = Float64(x / z); else tmp = Float64(Float64(6.0 / y) / Float64(y * Float64(z / x))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 0.00041) tmp = x / z; else tmp = (6.0 / y) / (y * (z / x)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 0.00041], N[(x / z), $MachinePrecision], N[(N[(6.0 / y), $MachinePrecision] / N[(y * N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 0.00041:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{6}{y}}{y \cdot \frac{z}{x}}\\
\end{array}
\end{array}
if y < 4.0999999999999999e-4Initial program 98.4%
associate-*l/98.4%
times-frac83.8%
*-commutative83.8%
associate-*r/81.3%
*-commutative81.3%
Simplified81.3%
Taylor expanded in y around 0 71.8%
if 4.0999999999999999e-4 < y Initial program 91.1%
associate-/l*93.2%
associate-/r/93.2%
Simplified93.2%
Taylor expanded in y around 0 41.0%
Taylor expanded in y around inf 41.0%
associate-*r/41.0%
times-frac42.5%
unpow242.5%
Simplified42.5%
*-commutative42.5%
clear-num42.5%
associate-/r*42.5%
frac-times42.7%
*-un-lft-identity42.7%
Applied egg-rr42.7%
Final simplification65.5%
(FPCore (x y z) :precision binary64 (if (<= y 8.8e+108) (/ x z) (* (/ x y) (/ y z))))
double code(double x, double y, double z) {
double tmp;
if (y <= 8.8e+108) {
tmp = x / z;
} else {
tmp = (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 <= 8.8d+108) then
tmp = x / z
else
tmp = (x / y) * (y / z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 8.8e+108) {
tmp = x / z;
} else {
tmp = (x / y) * (y / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 8.8e+108: tmp = x / z else: tmp = (x / y) * (y / z) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 8.8e+108) tmp = Float64(x / z); else tmp = Float64(Float64(x / y) * Float64(y / z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 8.8e+108) tmp = x / z; else tmp = (x / y) * (y / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 8.8e+108], N[(x / z), $MachinePrecision], N[(N[(x / y), $MachinePrecision] * N[(y / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 8.8 \cdot 10^{+108}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} \cdot \frac{y}{z}\\
\end{array}
\end{array}
if y < 8.8000000000000005e108Initial program 98.4%
associate-*l/98.5%
times-frac84.8%
*-commutative84.8%
associate-*r/82.4%
*-commutative82.4%
Simplified82.4%
Taylor expanded in y around 0 69.4%
if 8.8000000000000005e108 < y Initial program 89.1%
associate-*r/89.0%
associate-/l/91.3%
*-commutative91.3%
times-frac89.1%
Simplified89.1%
Taylor expanded in y around 0 32.4%
Final simplification63.2%
(FPCore (x y z) :precision binary64 (if (<= y 2.75e-11) (/ x z) (/ y (* z (/ y x)))))
double code(double x, double y, double z) {
double tmp;
if (y <= 2.75e-11) {
tmp = x / z;
} else {
tmp = y / (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 <= 2.75d-11) then
tmp = x / z
else
tmp = y / (z * (y / x))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 2.75e-11) {
tmp = x / z;
} else {
tmp = y / (z * (y / x));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 2.75e-11: tmp = x / z else: tmp = y / (z * (y / x)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 2.75e-11) tmp = Float64(x / z); else tmp = Float64(y / Float64(z * Float64(y / x))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 2.75e-11) tmp = x / z; else tmp = y / (z * (y / x)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 2.75e-11], N[(x / z), $MachinePrecision], N[(y / N[(z * N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.75 \cdot 10^{-11}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{z \cdot \frac{y}{x}}\\
\end{array}
\end{array}
if y < 2.74999999999999987e-11Initial program 98.4%
associate-*l/98.4%
times-frac83.6%
*-commutative83.6%
associate-*r/81.1%
*-commutative81.1%
Simplified81.1%
Taylor expanded in y around 0 71.7%
if 2.74999999999999987e-11 < y Initial program 91.3%
associate-*r/91.1%
associate-/l/93.5%
*-commutative93.5%
times-frac91.3%
Simplified91.3%
Taylor expanded in y around 0 34.3%
*-commutative34.3%
clear-num35.9%
frac-times43.1%
*-un-lft-identity43.1%
Applied egg-rr43.1%
Final simplification65.2%
(FPCore (x y z) :precision binary64 (if (<= y 1.9e-5) (/ x z) (/ y (/ z (/ x y)))))
double code(double x, double y, double z) {
double tmp;
if (y <= 1.9e-5) {
tmp = x / z;
} else {
tmp = y / (z / (x / 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 <= 1.9d-5) then
tmp = x / z
else
tmp = y / (z / (x / y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 1.9e-5) {
tmp = x / z;
} else {
tmp = y / (z / (x / y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 1.9e-5: tmp = x / z else: tmp = y / (z / (x / y)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 1.9e-5) tmp = Float64(x / z); else tmp = Float64(y / Float64(z / Float64(x / y))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 1.9e-5) tmp = x / z; else tmp = y / (z / (x / y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 1.9e-5], N[(x / z), $MachinePrecision], N[(y / N[(z / N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.9 \cdot 10^{-5}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{\frac{z}{\frac{x}{y}}}\\
\end{array}
\end{array}
if y < 1.9000000000000001e-5Initial program 98.4%
associate-*l/98.4%
times-frac83.8%
*-commutative83.8%
associate-*r/81.3%
*-commutative81.3%
Simplified81.3%
Taylor expanded in y around 0 71.8%
if 1.9000000000000001e-5 < y Initial program 91.1%
associate-*r/90.9%
associate-/l/93.3%
*-commutative93.3%
times-frac91.0%
Simplified91.0%
Taylor expanded in y around 0 32.5%
expm1-log1p-u30.2%
expm1-udef39.3%
Applied egg-rr39.3%
expm1-def30.2%
expm1-log1p32.5%
associate-*l/33.3%
associate-/l*41.7%
Simplified41.7%
Final simplification65.2%
(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 96.8%
associate-*l/96.8%
times-frac85.9%
*-commutative85.9%
associate-*r/83.9%
*-commutative83.9%
Simplified83.9%
Taylor expanded in y around 0 61.1%
Final simplification61.1%
(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 2023230
(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))