
(FPCore (J K U) :precision binary64 (let* ((t_0 (cos (/ K 2.0)))) (* (* (* -2.0 J) t_0) (sqrt (+ 1.0 (pow (/ U (* (* 2.0 J) t_0)) 2.0))))))
double code(double J, double K, double U) {
double t_0 = cos((K / 2.0));
return ((-2.0 * J) * t_0) * sqrt((1.0 + pow((U / ((2.0 * J) * t_0)), 2.0)));
}
real(8) function code(j, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: t_0
t_0 = cos((k / 2.0d0))
code = (((-2.0d0) * j) * t_0) * sqrt((1.0d0 + ((u / ((2.0d0 * j) * t_0)) ** 2.0d0)))
end function
public static double code(double J, double K, double U) {
double t_0 = Math.cos((K / 2.0));
return ((-2.0 * J) * t_0) * Math.sqrt((1.0 + Math.pow((U / ((2.0 * J) * t_0)), 2.0)));
}
def code(J, K, U): t_0 = math.cos((K / 2.0)) return ((-2.0 * J) * t_0) * math.sqrt((1.0 + math.pow((U / ((2.0 * J) * t_0)), 2.0)))
function code(J, K, U) t_0 = cos(Float64(K / 2.0)) return Float64(Float64(Float64(-2.0 * J) * t_0) * sqrt(Float64(1.0 + (Float64(U / Float64(Float64(2.0 * J) * t_0)) ^ 2.0)))) end
function tmp = code(J, K, U) t_0 = cos((K / 2.0)); tmp = ((-2.0 * J) * t_0) * sqrt((1.0 + ((U / ((2.0 * J) * t_0)) ^ 2.0))); end
code[J_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, N[(N[(N[(-2.0 * J), $MachinePrecision] * t$95$0), $MachinePrecision] * N[Sqrt[N[(1.0 + N[Power[N[(U / N[(N[(2.0 * J), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
\left(\left(-2 \cdot J\right) \cdot t_0\right) \cdot \sqrt{1 + {\left(\frac{U}{\left(2 \cdot J\right) \cdot t_0}\right)}^{2}}
\end{array}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 6 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (J K U) :precision binary64 (let* ((t_0 (cos (/ K 2.0)))) (* (* (* -2.0 J) t_0) (sqrt (+ 1.0 (pow (/ U (* (* 2.0 J) t_0)) 2.0))))))
double code(double J, double K, double U) {
double t_0 = cos((K / 2.0));
return ((-2.0 * J) * t_0) * sqrt((1.0 + pow((U / ((2.0 * J) * t_0)), 2.0)));
}
real(8) function code(j, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: t_0
t_0 = cos((k / 2.0d0))
code = (((-2.0d0) * j) * t_0) * sqrt((1.0d0 + ((u / ((2.0d0 * j) * t_0)) ** 2.0d0)))
end function
public static double code(double J, double K, double U) {
double t_0 = Math.cos((K / 2.0));
return ((-2.0 * J) * t_0) * Math.sqrt((1.0 + Math.pow((U / ((2.0 * J) * t_0)), 2.0)));
}
def code(J, K, U): t_0 = math.cos((K / 2.0)) return ((-2.0 * J) * t_0) * math.sqrt((1.0 + math.pow((U / ((2.0 * J) * t_0)), 2.0)))
function code(J, K, U) t_0 = cos(Float64(K / 2.0)) return Float64(Float64(Float64(-2.0 * J) * t_0) * sqrt(Float64(1.0 + (Float64(U / Float64(Float64(2.0 * J) * t_0)) ^ 2.0)))) end
function tmp = code(J, K, U) t_0 = cos((K / 2.0)); tmp = ((-2.0 * J) * t_0) * sqrt((1.0 + ((U / ((2.0 * J) * t_0)) ^ 2.0))); end
code[J_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, N[(N[(N[(-2.0 * J), $MachinePrecision] * t$95$0), $MachinePrecision] * N[Sqrt[N[(1.0 + N[Power[N[(U / N[(N[(2.0 * J), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
\left(\left(-2 \cdot J\right) \cdot t_0\right) \cdot \sqrt{1 + {\left(\frac{U}{\left(2 \cdot J\right) \cdot t_0}\right)}^{2}}
\end{array}
\end{array}
U_m = (fabs.f64 U)
(FPCore (J K U_m)
:precision binary64
(let* ((t_0 (cos (/ K 2.0)))
(t_1
(*
(* (* -2.0 J) t_0)
(sqrt (+ 1.0 (pow (/ U_m (* t_0 (* J 2.0))) 2.0))))))
(if (<= t_1 (- INFINITY))
(- U_m)
(if (<= t_1 2e+306)
(* (* -2.0 J) (* t_0 (hypot 1.0 (/ (/ U_m (* J 2.0)) t_0))))
U_m))))U_m = fabs(U);
double code(double J, double K, double U_m) {
double t_0 = cos((K / 2.0));
double t_1 = ((-2.0 * J) * t_0) * sqrt((1.0 + pow((U_m / (t_0 * (J * 2.0))), 2.0)));
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = -U_m;
} else if (t_1 <= 2e+306) {
tmp = (-2.0 * J) * (t_0 * hypot(1.0, ((U_m / (J * 2.0)) / t_0)));
} else {
tmp = U_m;
}
return tmp;
}
U_m = Math.abs(U);
public static double code(double J, double K, double U_m) {
double t_0 = Math.cos((K / 2.0));
double t_1 = ((-2.0 * J) * t_0) * Math.sqrt((1.0 + Math.pow((U_m / (t_0 * (J * 2.0))), 2.0)));
double tmp;
if (t_1 <= -Double.POSITIVE_INFINITY) {
tmp = -U_m;
} else if (t_1 <= 2e+306) {
tmp = (-2.0 * J) * (t_0 * Math.hypot(1.0, ((U_m / (J * 2.0)) / t_0)));
} else {
tmp = U_m;
}
return tmp;
}
U_m = math.fabs(U) def code(J, K, U_m): t_0 = math.cos((K / 2.0)) t_1 = ((-2.0 * J) * t_0) * math.sqrt((1.0 + math.pow((U_m / (t_0 * (J * 2.0))), 2.0))) tmp = 0 if t_1 <= -math.inf: tmp = -U_m elif t_1 <= 2e+306: tmp = (-2.0 * J) * (t_0 * math.hypot(1.0, ((U_m / (J * 2.0)) / t_0))) else: tmp = U_m return tmp
U_m = abs(U) function code(J, K, U_m) t_0 = cos(Float64(K / 2.0)) t_1 = Float64(Float64(Float64(-2.0 * J) * t_0) * sqrt(Float64(1.0 + (Float64(U_m / Float64(t_0 * Float64(J * 2.0))) ^ 2.0)))) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(-U_m); elseif (t_1 <= 2e+306) tmp = Float64(Float64(-2.0 * J) * Float64(t_0 * hypot(1.0, Float64(Float64(U_m / Float64(J * 2.0)) / t_0)))); else tmp = U_m; end return tmp end
U_m = abs(U); function tmp_2 = code(J, K, U_m) t_0 = cos((K / 2.0)); t_1 = ((-2.0 * J) * t_0) * sqrt((1.0 + ((U_m / (t_0 * (J * 2.0))) ^ 2.0))); tmp = 0.0; if (t_1 <= -Inf) tmp = -U_m; elseif (t_1 <= 2e+306) tmp = (-2.0 * J) * (t_0 * hypot(1.0, ((U_m / (J * 2.0)) / t_0))); else tmp = U_m; end tmp_2 = tmp; end
U_m = N[Abs[U], $MachinePrecision]
code[J_, K_, U$95$m_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(-2.0 * J), $MachinePrecision] * t$95$0), $MachinePrecision] * N[Sqrt[N[(1.0 + N[Power[N[(U$95$m / N[(t$95$0 * N[(J * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], (-U$95$m), If[LessEqual[t$95$1, 2e+306], N[(N[(-2.0 * J), $MachinePrecision] * N[(t$95$0 * N[Sqrt[1.0 ^ 2 + N[(N[(U$95$m / N[(J * 2.0), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], U$95$m]]]]
\begin{array}{l}
U_m = \left|U\right|
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
t_1 := \left(\left(-2 \cdot J\right) \cdot t_0\right) \cdot \sqrt{1 + {\left(\frac{U_m}{t_0 \cdot \left(J \cdot 2\right)}\right)}^{2}}\\
\mathbf{if}\;t_1 \leq -\infty:\\
\;\;\;\;-U_m\\
\mathbf{elif}\;t_1 \leq 2 \cdot 10^{+306}:\\
\;\;\;\;\left(-2 \cdot J\right) \cdot \left(t_0 \cdot \mathsf{hypot}\left(1, \frac{\frac{U_m}{J \cdot 2}}{t_0}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U_m\\
\end{array}
\end{array}
if (*.f64 (*.f64 (*.f64 -2 J) (cos.f64 (/.f64 K 2))) (sqrt.f64 (+.f64 1 (pow.f64 (/.f64 U (*.f64 (*.f64 2 J) (cos.f64 (/.f64 K 2)))) 2)))) < -inf.0Initial program 5.2%
Simplified64.1%
Taylor expanded in J around 0 65.9%
mul-1-neg65.9%
Simplified65.9%
if -inf.0 < (*.f64 (*.f64 (*.f64 -2 J) (cos.f64 (/.f64 K 2))) (sqrt.f64 (+.f64 1 (pow.f64 (/.f64 U (*.f64 (*.f64 2 J) (cos.f64 (/.f64 K 2)))) 2)))) < 2.00000000000000003e306Initial program 99.8%
Simplified99.8%
if 2.00000000000000003e306 < (*.f64 (*.f64 (*.f64 -2 J) (cos.f64 (/.f64 K 2))) (sqrt.f64 (+.f64 1 (pow.f64 (/.f64 U (*.f64 (*.f64 2 J) (cos.f64 (/.f64 K 2)))) 2)))) Initial program 5.9%
Simplified58.3%
Taylor expanded in U around -inf 48.4%
Final simplification91.0%
U_m = (fabs.f64 U) (FPCore (J K U_m) :precision binary64 (if (<= J 6.9e-181) (- U_m) (* (* -2.0 J) (* (cos (/ K 2.0)) (hypot 1.0 (* 0.5 (/ U_m J)))))))
U_m = fabs(U);
double code(double J, double K, double U_m) {
double tmp;
if (J <= 6.9e-181) {
tmp = -U_m;
} else {
tmp = (-2.0 * J) * (cos((K / 2.0)) * hypot(1.0, (0.5 * (U_m / J))));
}
return tmp;
}
U_m = Math.abs(U);
public static double code(double J, double K, double U_m) {
double tmp;
if (J <= 6.9e-181) {
tmp = -U_m;
} else {
tmp = (-2.0 * J) * (Math.cos((K / 2.0)) * Math.hypot(1.0, (0.5 * (U_m / J))));
}
return tmp;
}
U_m = math.fabs(U) def code(J, K, U_m): tmp = 0 if J <= 6.9e-181: tmp = -U_m else: tmp = (-2.0 * J) * (math.cos((K / 2.0)) * math.hypot(1.0, (0.5 * (U_m / J)))) return tmp
U_m = abs(U) function code(J, K, U_m) tmp = 0.0 if (J <= 6.9e-181) tmp = Float64(-U_m); else tmp = Float64(Float64(-2.0 * J) * Float64(cos(Float64(K / 2.0)) * hypot(1.0, Float64(0.5 * Float64(U_m / J))))); end return tmp end
U_m = abs(U); function tmp_2 = code(J, K, U_m) tmp = 0.0; if (J <= 6.9e-181) tmp = -U_m; else tmp = (-2.0 * J) * (cos((K / 2.0)) * hypot(1.0, (0.5 * (U_m / J)))); end tmp_2 = tmp; end
U_m = N[Abs[U], $MachinePrecision] code[J_, K_, U$95$m_] := If[LessEqual[J, 6.9e-181], (-U$95$m), N[(N[(-2.0 * J), $MachinePrecision] * N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[Sqrt[1.0 ^ 2 + N[(0.5 * N[(U$95$m / J), $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
U_m = \left|U\right|
\\
\begin{array}{l}
\mathbf{if}\;J \leq 6.9 \cdot 10^{-181}:\\
\;\;\;\;-U_m\\
\mathbf{else}:\\
\;\;\;\;\left(-2 \cdot J\right) \cdot \left(\cos \left(\frac{K}{2}\right) \cdot \mathsf{hypot}\left(1, 0.5 \cdot \frac{U_m}{J}\right)\right)\\
\end{array}
\end{array}
if J < 6.90000000000000053e-181Initial program 73.3%
Simplified87.4%
Taylor expanded in J around 0 28.6%
mul-1-neg28.6%
Simplified28.6%
if 6.90000000000000053e-181 < J Initial program 90.1%
Simplified98.1%
Taylor expanded in K around 0 85.3%
Final simplification52.3%
U_m = (fabs.f64 U) (FPCore (J K U_m) :precision binary64 (if (<= U_m 1.02e+140) (* (* -2.0 J) (cos (* K 0.5))) (if (or (<= U_m 2.7e+216) (not (<= U_m 1.4e+230))) (- U_m) U_m)))
U_m = fabs(U);
double code(double J, double K, double U_m) {
double tmp;
if (U_m <= 1.02e+140) {
tmp = (-2.0 * J) * cos((K * 0.5));
} else if ((U_m <= 2.7e+216) || !(U_m <= 1.4e+230)) {
tmp = -U_m;
} else {
tmp = U_m;
}
return tmp;
}
U_m = abs(U)
real(8) function code(j, k, u_m)
real(8), intent (in) :: j
real(8), intent (in) :: k
real(8), intent (in) :: u_m
real(8) :: tmp
if (u_m <= 1.02d+140) then
tmp = ((-2.0d0) * j) * cos((k * 0.5d0))
else if ((u_m <= 2.7d+216) .or. (.not. (u_m <= 1.4d+230))) then
tmp = -u_m
else
tmp = u_m
end if
code = tmp
end function
U_m = Math.abs(U);
public static double code(double J, double K, double U_m) {
double tmp;
if (U_m <= 1.02e+140) {
tmp = (-2.0 * J) * Math.cos((K * 0.5));
} else if ((U_m <= 2.7e+216) || !(U_m <= 1.4e+230)) {
tmp = -U_m;
} else {
tmp = U_m;
}
return tmp;
}
U_m = math.fabs(U) def code(J, K, U_m): tmp = 0 if U_m <= 1.02e+140: tmp = (-2.0 * J) * math.cos((K * 0.5)) elif (U_m <= 2.7e+216) or not (U_m <= 1.4e+230): tmp = -U_m else: tmp = U_m return tmp
U_m = abs(U) function code(J, K, U_m) tmp = 0.0 if (U_m <= 1.02e+140) tmp = Float64(Float64(-2.0 * J) * cos(Float64(K * 0.5))); elseif ((U_m <= 2.7e+216) || !(U_m <= 1.4e+230)) tmp = Float64(-U_m); else tmp = U_m; end return tmp end
U_m = abs(U); function tmp_2 = code(J, K, U_m) tmp = 0.0; if (U_m <= 1.02e+140) tmp = (-2.0 * J) * cos((K * 0.5)); elseif ((U_m <= 2.7e+216) || ~((U_m <= 1.4e+230))) tmp = -U_m; else tmp = U_m; end tmp_2 = tmp; end
U_m = N[Abs[U], $MachinePrecision] code[J_, K_, U$95$m_] := If[LessEqual[U$95$m, 1.02e+140], N[(N[(-2.0 * J), $MachinePrecision] * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[U$95$m, 2.7e+216], N[Not[LessEqual[U$95$m, 1.4e+230]], $MachinePrecision]], (-U$95$m), U$95$m]]
\begin{array}{l}
U_m = \left|U\right|
\\
\begin{array}{l}
\mathbf{if}\;U_m \leq 1.02 \cdot 10^{+140}:\\
\;\;\;\;\left(-2 \cdot J\right) \cdot \cos \left(K \cdot 0.5\right)\\
\mathbf{elif}\;U_m \leq 2.7 \cdot 10^{+216} \lor \neg \left(U_m \leq 1.4 \cdot 10^{+230}\right):\\
\;\;\;\;-U_m\\
\mathbf{else}:\\
\;\;\;\;U_m\\
\end{array}
\end{array}
if U < 1.02000000000000007e140Initial program 84.9%
Simplified95.9%
Taylor expanded in J around inf 63.5%
associate-*r*63.5%
Simplified63.5%
if 1.02000000000000007e140 < U < 2.7000000000000001e216 or 1.4000000000000001e230 < U Initial program 55.9%
Simplified68.9%
Taylor expanded in J around 0 53.2%
mul-1-neg53.2%
Simplified53.2%
if 2.7000000000000001e216 < U < 1.4000000000000001e230Initial program 53.0%
Simplified76.5%
Taylor expanded in U around -inf 26.7%
Final simplification61.5%
U_m = (fabs.f64 U) (FPCore (J K U_m) :precision binary64 (if (<= U_m 6500000.0) (* -2.0 J) (if (or (<= U_m 2.7e+216) (not (<= U_m 1.4e+230))) (- U_m) U_m)))
U_m = fabs(U);
double code(double J, double K, double U_m) {
double tmp;
if (U_m <= 6500000.0) {
tmp = -2.0 * J;
} else if ((U_m <= 2.7e+216) || !(U_m <= 1.4e+230)) {
tmp = -U_m;
} else {
tmp = U_m;
}
return tmp;
}
U_m = abs(U)
real(8) function code(j, k, u_m)
real(8), intent (in) :: j
real(8), intent (in) :: k
real(8), intent (in) :: u_m
real(8) :: tmp
if (u_m <= 6500000.0d0) then
tmp = (-2.0d0) * j
else if ((u_m <= 2.7d+216) .or. (.not. (u_m <= 1.4d+230))) then
tmp = -u_m
else
tmp = u_m
end if
code = tmp
end function
U_m = Math.abs(U);
public static double code(double J, double K, double U_m) {
double tmp;
if (U_m <= 6500000.0) {
tmp = -2.0 * J;
} else if ((U_m <= 2.7e+216) || !(U_m <= 1.4e+230)) {
tmp = -U_m;
} else {
tmp = U_m;
}
return tmp;
}
U_m = math.fabs(U) def code(J, K, U_m): tmp = 0 if U_m <= 6500000.0: tmp = -2.0 * J elif (U_m <= 2.7e+216) or not (U_m <= 1.4e+230): tmp = -U_m else: tmp = U_m return tmp
U_m = abs(U) function code(J, K, U_m) tmp = 0.0 if (U_m <= 6500000.0) tmp = Float64(-2.0 * J); elseif ((U_m <= 2.7e+216) || !(U_m <= 1.4e+230)) tmp = Float64(-U_m); else tmp = U_m; end return tmp end
U_m = abs(U); function tmp_2 = code(J, K, U_m) tmp = 0.0; if (U_m <= 6500000.0) tmp = -2.0 * J; elseif ((U_m <= 2.7e+216) || ~((U_m <= 1.4e+230))) tmp = -U_m; else tmp = U_m; end tmp_2 = tmp; end
U_m = N[Abs[U], $MachinePrecision] code[J_, K_, U$95$m_] := If[LessEqual[U$95$m, 6500000.0], N[(-2.0 * J), $MachinePrecision], If[Or[LessEqual[U$95$m, 2.7e+216], N[Not[LessEqual[U$95$m, 1.4e+230]], $MachinePrecision]], (-U$95$m), U$95$m]]
\begin{array}{l}
U_m = \left|U\right|
\\
\begin{array}{l}
\mathbf{if}\;U_m \leq 6500000:\\
\;\;\;\;-2 \cdot J\\
\mathbf{elif}\;U_m \leq 2.7 \cdot 10^{+216} \lor \neg \left(U_m \leq 1.4 \cdot 10^{+230}\right):\\
\;\;\;\;-U_m\\
\mathbf{else}:\\
\;\;\;\;U_m\\
\end{array}
\end{array}
if U < 6.5e6Initial program 86.0%
Simplified96.4%
Taylor expanded in J around inf 67.1%
associate-*r*67.1%
Simplified67.1%
Taylor expanded in K around 0 39.2%
if 6.5e6 < U < 2.7000000000000001e216 or 1.4000000000000001e230 < U Initial program 64.4%
Simplified78.4%
Taylor expanded in J around 0 46.7%
mul-1-neg46.7%
Simplified46.7%
if 2.7000000000000001e216 < U < 1.4000000000000001e230Initial program 53.0%
Simplified76.5%
Taylor expanded in U around -inf 26.7%
Final simplification40.8%
U_m = (fabs.f64 U) (FPCore (J K U_m) :precision binary64 (if (<= K 3.1) (- U_m) U_m))
U_m = fabs(U);
double code(double J, double K, double U_m) {
double tmp;
if (K <= 3.1) {
tmp = -U_m;
} else {
tmp = U_m;
}
return tmp;
}
U_m = abs(U)
real(8) function code(j, k, u_m)
real(8), intent (in) :: j
real(8), intent (in) :: k
real(8), intent (in) :: u_m
real(8) :: tmp
if (k <= 3.1d0) then
tmp = -u_m
else
tmp = u_m
end if
code = tmp
end function
U_m = Math.abs(U);
public static double code(double J, double K, double U_m) {
double tmp;
if (K <= 3.1) {
tmp = -U_m;
} else {
tmp = U_m;
}
return tmp;
}
U_m = math.fabs(U) def code(J, K, U_m): tmp = 0 if K <= 3.1: tmp = -U_m else: tmp = U_m return tmp
U_m = abs(U) function code(J, K, U_m) tmp = 0.0 if (K <= 3.1) tmp = Float64(-U_m); else tmp = U_m; end return tmp end
U_m = abs(U); function tmp_2 = code(J, K, U_m) tmp = 0.0; if (K <= 3.1) tmp = -U_m; else tmp = U_m; end tmp_2 = tmp; end
U_m = N[Abs[U], $MachinePrecision] code[J_, K_, U$95$m_] := If[LessEqual[K, 3.1], (-U$95$m), U$95$m]
\begin{array}{l}
U_m = \left|U\right|
\\
\begin{array}{l}
\mathbf{if}\;K \leq 3.1:\\
\;\;\;\;-U_m\\
\mathbf{else}:\\
\;\;\;\;U_m\\
\end{array}
\end{array}
if K < 3.10000000000000009Initial program 80.3%
Simplified91.9%
Taylor expanded in J around 0 26.0%
mul-1-neg26.0%
Simplified26.0%
if 3.10000000000000009 < K Initial program 80.3%
Simplified91.8%
Taylor expanded in U around -inf 29.1%
Final simplification26.7%
U_m = (fabs.f64 U) (FPCore (J K U_m) :precision binary64 U_m)
U_m = fabs(U);
double code(double J, double K, double U_m) {
return U_m;
}
U_m = abs(U)
real(8) function code(j, k, u_m)
real(8), intent (in) :: j
real(8), intent (in) :: k
real(8), intent (in) :: u_m
code = u_m
end function
U_m = Math.abs(U);
public static double code(double J, double K, double U_m) {
return U_m;
}
U_m = math.fabs(U) def code(J, K, U_m): return U_m
U_m = abs(U) function code(J, K, U_m) return U_m end
U_m = abs(U); function tmp = code(J, K, U_m) tmp = U_m; end
U_m = N[Abs[U], $MachinePrecision] code[J_, K_, U$95$m_] := U$95$m
\begin{array}{l}
U_m = \left|U\right|
\\
U_m
\end{array}
Initial program 80.3%
Simplified91.8%
Taylor expanded in U around -inf 23.7%
Final simplification23.7%
herbie shell --seed 2023336
(FPCore (J K U)
:name "Maksimov and Kolovsky, Equation (3)"
:precision binary64
(* (* (* -2.0 J) (cos (/ K 2.0))) (sqrt (+ 1.0 (pow (/ U (* (* 2.0 J) (cos (/ K 2.0)))) 2.0)))))