
(FPCore (d1 d2 d3 d4) :precision binary64 (- (+ (- (* d1 d2) (* d1 d3)) (* d4 d1)) (* d1 d1)))
double code(double d1, double d2, double d3, double d4) {
return (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1);
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
code = (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1)
end function
public static double code(double d1, double d2, double d3, double d4) {
return (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1);
}
def code(d1, d2, d3, d4): return (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1)
function code(d1, d2, d3, d4) return Float64(Float64(Float64(Float64(d1 * d2) - Float64(d1 * d3)) + Float64(d4 * d1)) - Float64(d1 * d1)) end
function tmp = code(d1, d2, d3, d4) tmp = (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1); end
code[d1_, d2_, d3_, d4_] := N[(N[(N[(N[(d1 * d2), $MachinePrecision] - N[(d1 * d3), $MachinePrecision]), $MachinePrecision] + N[(d4 * d1), $MachinePrecision]), $MachinePrecision] - N[(d1 * d1), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(d1 \cdot d2 - d1 \cdot d3\right) + d4 \cdot d1\right) - d1 \cdot d1
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (d1 d2 d3 d4) :precision binary64 (- (+ (- (* d1 d2) (* d1 d3)) (* d4 d1)) (* d1 d1)))
double code(double d1, double d2, double d3, double d4) {
return (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1);
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
code = (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1)
end function
public static double code(double d1, double d2, double d3, double d4) {
return (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1);
}
def code(d1, d2, d3, d4): return (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1)
function code(d1, d2, d3, d4) return Float64(Float64(Float64(Float64(d1 * d2) - Float64(d1 * d3)) + Float64(d4 * d1)) - Float64(d1 * d1)) end
function tmp = code(d1, d2, d3, d4) tmp = (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1); end
code[d1_, d2_, d3_, d4_] := N[(N[(N[(N[(d1 * d2), $MachinePrecision] - N[(d1 * d3), $MachinePrecision]), $MachinePrecision] + N[(d4 * d1), $MachinePrecision]), $MachinePrecision] - N[(d1 * d1), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(d1 \cdot d2 - d1 \cdot d3\right) + d4 \cdot d1\right) - d1 \cdot d1
\end{array}
(FPCore (d1 d2 d3 d4) :precision binary64 (* d1 (+ (- d2 d1) (- d4 d3))))
double code(double d1, double d2, double d3, double d4) {
return d1 * ((d2 - d1) + (d4 - d3));
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
code = d1 * ((d2 - d1) + (d4 - d3))
end function
public static double code(double d1, double d2, double d3, double d4) {
return d1 * ((d2 - d1) + (d4 - d3));
}
def code(d1, d2, d3, d4): return d1 * ((d2 - d1) + (d4 - d3))
function code(d1, d2, d3, d4) return Float64(d1 * Float64(Float64(d2 - d1) + Float64(d4 - d3))) end
function tmp = code(d1, d2, d3, d4) tmp = d1 * ((d2 - d1) + (d4 - d3)); end
code[d1_, d2_, d3_, d4_] := N[(d1 * N[(N[(d2 - d1), $MachinePrecision] + N[(d4 - d3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
d1 \cdot \left(\left(d2 - d1\right) + \left(d4 - d3\right)\right)
\end{array}
Initial program 86.3%
sub-neg86.3%
associate-+l+86.3%
*-commutative86.3%
+-commutative86.3%
*-commutative86.3%
sub-neg86.3%
+-commutative86.3%
associate--l+86.3%
distribute-lft-out--87.5%
distribute-rgt-out--91.8%
distribute-lft-out100.0%
+-commutative100.0%
Simplified100.0%
(FPCore (d1 d2 d3 d4)
:precision binary64
(if (<= d4 4.8e-161)
(* d1 (- d2 d1))
(if (or (<= d4 2.5e+22) (and (not (<= d4 1.75e+69)) (<= d4 1.65e+98)))
(* d1 (- d2 d3))
(* d1 (+ d2 d4)))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 4.8e-161) {
tmp = d1 * (d2 - d1);
} else if ((d4 <= 2.5e+22) || (!(d4 <= 1.75e+69) && (d4 <= 1.65e+98))) {
tmp = d1 * (d2 - d3);
} else {
tmp = d1 * (d2 + d4);
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: tmp
if (d4 <= 4.8d-161) then
tmp = d1 * (d2 - d1)
else if ((d4 <= 2.5d+22) .or. (.not. (d4 <= 1.75d+69)) .and. (d4 <= 1.65d+98)) then
tmp = d1 * (d2 - d3)
else
tmp = d1 * (d2 + d4)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 4.8e-161) {
tmp = d1 * (d2 - d1);
} else if ((d4 <= 2.5e+22) || (!(d4 <= 1.75e+69) && (d4 <= 1.65e+98))) {
tmp = d1 * (d2 - d3);
} else {
tmp = d1 * (d2 + d4);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= 4.8e-161: tmp = d1 * (d2 - d1) elif (d4 <= 2.5e+22) or (not (d4 <= 1.75e+69) and (d4 <= 1.65e+98)): tmp = d1 * (d2 - d3) else: tmp = d1 * (d2 + d4) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= 4.8e-161) tmp = Float64(d1 * Float64(d2 - d1)); elseif ((d4 <= 2.5e+22) || (!(d4 <= 1.75e+69) && (d4 <= 1.65e+98))) tmp = Float64(d1 * Float64(d2 - d3)); else tmp = Float64(d1 * Float64(d2 + d4)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d4 <= 4.8e-161) tmp = d1 * (d2 - d1); elseif ((d4 <= 2.5e+22) || (~((d4 <= 1.75e+69)) && (d4 <= 1.65e+98))) tmp = d1 * (d2 - d3); else tmp = d1 * (d2 + d4); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, 4.8e-161], N[(d1 * N[(d2 - d1), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[d4, 2.5e+22], And[N[Not[LessEqual[d4, 1.75e+69]], $MachinePrecision], LessEqual[d4, 1.65e+98]]], N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(d2 + d4), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq 4.8 \cdot 10^{-161}:\\
\;\;\;\;d1 \cdot \left(d2 - d1\right)\\
\mathbf{elif}\;d4 \leq 2.5 \cdot 10^{+22} \lor \neg \left(d4 \leq 1.75 \cdot 10^{+69}\right) \land d4 \leq 1.65 \cdot 10^{+98}:\\
\;\;\;\;d1 \cdot \left(d2 - d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d2 + d4\right)\\
\end{array}
\end{array}
if d4 < 4.79999999999999998e-161Initial program 88.5%
sub-neg88.5%
associate-+l+88.5%
*-commutative88.5%
+-commutative88.5%
*-commutative88.5%
sub-neg88.5%
+-commutative88.5%
associate--l+88.5%
distribute-lft-out--89.1%
distribute-rgt-out--93.6%
distribute-lft-out100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in d3 around 0 75.2%
Taylor expanded in d4 around 0 60.3%
if 4.79999999999999998e-161 < d4 < 2.4999999999999998e22 or 1.74999999999999994e69 < d4 < 1.65000000000000014e98Initial program 90.7%
sub-neg90.7%
associate-+l+90.7%
*-commutative90.7%
+-commutative90.7%
*-commutative90.7%
sub-neg90.7%
+-commutative90.7%
associate--l+90.7%
distribute-lft-out--90.7%
distribute-rgt-out--93.0%
distribute-lft-out99.9%
+-commutative99.9%
Simplified99.9%
+-commutative99.9%
distribute-lft-in93.0%
Applied egg-rr93.0%
Taylor expanded in d1 around 0 81.9%
distribute-lft-out81.9%
*-commutative81.9%
associate-+l-81.9%
Applied egg-rr81.9%
Taylor expanded in d4 around 0 77.5%
if 2.4999999999999998e22 < d4 < 1.74999999999999994e69 or 1.65000000000000014e98 < d4 Initial program 76.8%
sub-neg76.8%
associate-+l+76.8%
*-commutative76.8%
+-commutative76.8%
*-commutative76.8%
sub-neg76.8%
+-commutative76.8%
associate--l+76.8%
distribute-lft-out--80.3%
distribute-rgt-out--85.7%
distribute-lft-out100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in d3 around 0 89.5%
Taylor expanded in d1 around 0 85.9%
Final simplification68.8%
(FPCore (d1 d2 d3 d4)
:precision binary64
(if (<= d4 4.9e-161)
(* d1 (- d2 d1))
(if (<= d4 1.7e-81)
(* d1 (- d2 d3))
(if (<= d4 1.12e-44) (* d1 (- d1)) (* d1 (- d4 d3))))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 4.9e-161) {
tmp = d1 * (d2 - d1);
} else if (d4 <= 1.7e-81) {
tmp = d1 * (d2 - d3);
} else if (d4 <= 1.12e-44) {
tmp = d1 * -d1;
} else {
tmp = d1 * (d4 - d3);
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: tmp
if (d4 <= 4.9d-161) then
tmp = d1 * (d2 - d1)
else if (d4 <= 1.7d-81) then
tmp = d1 * (d2 - d3)
else if (d4 <= 1.12d-44) then
tmp = d1 * -d1
else
tmp = d1 * (d4 - d3)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 4.9e-161) {
tmp = d1 * (d2 - d1);
} else if (d4 <= 1.7e-81) {
tmp = d1 * (d2 - d3);
} else if (d4 <= 1.12e-44) {
tmp = d1 * -d1;
} else {
tmp = d1 * (d4 - d3);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= 4.9e-161: tmp = d1 * (d2 - d1) elif d4 <= 1.7e-81: tmp = d1 * (d2 - d3) elif d4 <= 1.12e-44: tmp = d1 * -d1 else: tmp = d1 * (d4 - d3) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= 4.9e-161) tmp = Float64(d1 * Float64(d2 - d1)); elseif (d4 <= 1.7e-81) tmp = Float64(d1 * Float64(d2 - d3)); elseif (d4 <= 1.12e-44) tmp = Float64(d1 * Float64(-d1)); else tmp = Float64(d1 * Float64(d4 - d3)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d4 <= 4.9e-161) tmp = d1 * (d2 - d1); elseif (d4 <= 1.7e-81) tmp = d1 * (d2 - d3); elseif (d4 <= 1.12e-44) tmp = d1 * -d1; else tmp = d1 * (d4 - d3); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, 4.9e-161], N[(d1 * N[(d2 - d1), $MachinePrecision]), $MachinePrecision], If[LessEqual[d4, 1.7e-81], N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision], If[LessEqual[d4, 1.12e-44], N[(d1 * (-d1)), $MachinePrecision], N[(d1 * N[(d4 - d3), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq 4.9 \cdot 10^{-161}:\\
\;\;\;\;d1 \cdot \left(d2 - d1\right)\\
\mathbf{elif}\;d4 \leq 1.7 \cdot 10^{-81}:\\
\;\;\;\;d1 \cdot \left(d2 - d3\right)\\
\mathbf{elif}\;d4 \leq 1.12 \cdot 10^{-44}:\\
\;\;\;\;d1 \cdot \left(-d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - d3\right)\\
\end{array}
\end{array}
if d4 < 4.90000000000000035e-161Initial program 88.5%
sub-neg88.5%
associate-+l+88.5%
*-commutative88.5%
+-commutative88.5%
*-commutative88.5%
sub-neg88.5%
+-commutative88.5%
associate--l+88.5%
distribute-lft-out--89.1%
distribute-rgt-out--93.6%
distribute-lft-out100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in d3 around 0 75.2%
Taylor expanded in d4 around 0 60.3%
if 4.90000000000000035e-161 < d4 < 1.6999999999999999e-81Initial program 93.8%
sub-neg93.8%
associate-+l+93.8%
*-commutative93.8%
+-commutative93.8%
*-commutative93.8%
sub-neg93.8%
+-commutative93.8%
associate--l+93.8%
distribute-lft-out--93.8%
distribute-rgt-out--100.0%
distribute-lft-out99.9%
+-commutative99.9%
Simplified99.9%
+-commutative99.9%
distribute-lft-in100.0%
Applied egg-rr100.0%
Taylor expanded in d1 around 0 82.4%
distribute-lft-out82.3%
*-commutative82.3%
associate-+l-82.3%
Applied egg-rr82.3%
Taylor expanded in d4 around 0 82.3%
if 1.6999999999999999e-81 < d4 < 1.1200000000000001e-44Initial program 81.8%
sub-neg81.8%
associate-+l+81.8%
*-commutative81.8%
+-commutative81.8%
*-commutative81.8%
sub-neg81.8%
+-commutative81.8%
associate--l+81.8%
distribute-lft-out--81.8%
distribute-rgt-out--81.8%
distribute-lft-out100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in d1 around inf 55.6%
unpow255.6%
mul-1-neg55.6%
sub0-neg55.6%
Simplified55.6%
if 1.1200000000000001e-44 < d4 Initial program 80.5%
sub-neg80.5%
associate-+l+80.5%
*-commutative80.5%
+-commutative80.5%
*-commutative80.5%
sub-neg80.5%
+-commutative80.5%
associate--l+80.5%
distribute-lft-out--83.3%
distribute-rgt-out--87.5%
distribute-lft-out100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in d2 around 0 85.0%
+-commutative85.0%
associate--r+85.0%
Simplified85.0%
Taylor expanded in d1 around 0 83.7%
Final simplification68.1%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d2 d1))))
(if (<= d4 1.65e-161)
t_0
(if (<= d4 4e-81)
(* d1 (- d2 d3))
(if (<= d4 3e-44) t_0 (* d1 (- d4 d3)))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d2 - d1);
double tmp;
if (d4 <= 1.65e-161) {
tmp = t_0;
} else if (d4 <= 4e-81) {
tmp = d1 * (d2 - d3);
} else if (d4 <= 3e-44) {
tmp = t_0;
} else {
tmp = d1 * (d4 - d3);
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: t_0
real(8) :: tmp
t_0 = d1 * (d2 - d1)
if (d4 <= 1.65d-161) then
tmp = t_0
else if (d4 <= 4d-81) then
tmp = d1 * (d2 - d3)
else if (d4 <= 3d-44) then
tmp = t_0
else
tmp = d1 * (d4 - d3)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d2 - d1);
double tmp;
if (d4 <= 1.65e-161) {
tmp = t_0;
} else if (d4 <= 4e-81) {
tmp = d1 * (d2 - d3);
} else if (d4 <= 3e-44) {
tmp = t_0;
} else {
tmp = d1 * (d4 - d3);
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * (d2 - d1) tmp = 0 if d4 <= 1.65e-161: tmp = t_0 elif d4 <= 4e-81: tmp = d1 * (d2 - d3) elif d4 <= 3e-44: tmp = t_0 else: tmp = d1 * (d4 - d3) return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(d2 - d1)) tmp = 0.0 if (d4 <= 1.65e-161) tmp = t_0; elseif (d4 <= 4e-81) tmp = Float64(d1 * Float64(d2 - d3)); elseif (d4 <= 3e-44) tmp = t_0; else tmp = Float64(d1 * Float64(d4 - d3)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) t_0 = d1 * (d2 - d1); tmp = 0.0; if (d4 <= 1.65e-161) tmp = t_0; elseif (d4 <= 4e-81) tmp = d1 * (d2 - d3); elseif (d4 <= 3e-44) tmp = t_0; else tmp = d1 * (d4 - d3); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := Block[{t$95$0 = N[(d1 * N[(d2 - d1), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d4, 1.65e-161], t$95$0, If[LessEqual[d4, 4e-81], N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision], If[LessEqual[d4, 3e-44], t$95$0, N[(d1 * N[(d4 - d3), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(d2 - d1\right)\\
\mathbf{if}\;d4 \leq 1.65 \cdot 10^{-161}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d4 \leq 4 \cdot 10^{-81}:\\
\;\;\;\;d1 \cdot \left(d2 - d3\right)\\
\mathbf{elif}\;d4 \leq 3 \cdot 10^{-44}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - d3\right)\\
\end{array}
\end{array}
if d4 < 1.6499999999999999e-161 or 3.9999999999999998e-81 < d4 < 3.0000000000000002e-44Initial program 88.1%
sub-neg88.1%
associate-+l+88.1%
*-commutative88.1%
+-commutative88.1%
*-commutative88.1%
sub-neg88.1%
+-commutative88.1%
associate--l+88.1%
distribute-lft-out--88.7%
distribute-rgt-out--92.8%
distribute-lft-out100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in d3 around 0 76.3%
Taylor expanded in d4 around 0 62.4%
if 1.6499999999999999e-161 < d4 < 3.9999999999999998e-81Initial program 93.8%
sub-neg93.8%
associate-+l+93.8%
*-commutative93.8%
+-commutative93.8%
*-commutative93.8%
sub-neg93.8%
+-commutative93.8%
associate--l+93.8%
distribute-lft-out--93.8%
distribute-rgt-out--100.0%
distribute-lft-out99.9%
+-commutative99.9%
Simplified99.9%
+-commutative99.9%
distribute-lft-in100.0%
Applied egg-rr100.0%
Taylor expanded in d1 around 0 82.4%
distribute-lft-out82.3%
*-commutative82.3%
associate-+l-82.3%
Applied egg-rr82.3%
Taylor expanded in d4 around 0 82.3%
if 3.0000000000000002e-44 < d4 Initial program 80.5%
sub-neg80.5%
associate-+l+80.5%
*-commutative80.5%
+-commutative80.5%
*-commutative80.5%
sub-neg80.5%
+-commutative80.5%
associate--l+80.5%
distribute-lft-out--83.3%
distribute-rgt-out--87.5%
distribute-lft-out100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in d2 around 0 85.0%
+-commutative85.0%
associate--r+85.0%
Simplified85.0%
Taylor expanded in d1 around 0 83.7%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d2 d3))))
(if (<= d3 -1.8e+66)
t_0
(if (<= d3 1.12e-213)
(* d1 (+ d2 d4))
(if (<= d3 1.16e+36) (* d1 (- d4 d1)) t_0)))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d2 - d3);
double tmp;
if (d3 <= -1.8e+66) {
tmp = t_0;
} else if (d3 <= 1.12e-213) {
tmp = d1 * (d2 + d4);
} else if (d3 <= 1.16e+36) {
tmp = d1 * (d4 - d1);
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: t_0
real(8) :: tmp
t_0 = d1 * (d2 - d3)
if (d3 <= (-1.8d+66)) then
tmp = t_0
else if (d3 <= 1.12d-213) then
tmp = d1 * (d2 + d4)
else if (d3 <= 1.16d+36) then
tmp = d1 * (d4 - d1)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d2 - d3);
double tmp;
if (d3 <= -1.8e+66) {
tmp = t_0;
} else if (d3 <= 1.12e-213) {
tmp = d1 * (d2 + d4);
} else if (d3 <= 1.16e+36) {
tmp = d1 * (d4 - d1);
} else {
tmp = t_0;
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * (d2 - d3) tmp = 0 if d3 <= -1.8e+66: tmp = t_0 elif d3 <= 1.12e-213: tmp = d1 * (d2 + d4) elif d3 <= 1.16e+36: tmp = d1 * (d4 - d1) else: tmp = t_0 return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(d2 - d3)) tmp = 0.0 if (d3 <= -1.8e+66) tmp = t_0; elseif (d3 <= 1.12e-213) tmp = Float64(d1 * Float64(d2 + d4)); elseif (d3 <= 1.16e+36) tmp = Float64(d1 * Float64(d4 - d1)); else tmp = t_0; end return tmp end
function tmp_2 = code(d1, d2, d3, d4) t_0 = d1 * (d2 - d3); tmp = 0.0; if (d3 <= -1.8e+66) tmp = t_0; elseif (d3 <= 1.12e-213) tmp = d1 * (d2 + d4); elseif (d3 <= 1.16e+36) tmp = d1 * (d4 - d1); else tmp = t_0; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := Block[{t$95$0 = N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d3, -1.8e+66], t$95$0, If[LessEqual[d3, 1.12e-213], N[(d1 * N[(d2 + d4), $MachinePrecision]), $MachinePrecision], If[LessEqual[d3, 1.16e+36], N[(d1 * N[(d4 - d1), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(d2 - d3\right)\\
\mathbf{if}\;d3 \leq -1.8 \cdot 10^{+66}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d3 \leq 1.12 \cdot 10^{-213}:\\
\;\;\;\;d1 \cdot \left(d2 + d4\right)\\
\mathbf{elif}\;d3 \leq 1.16 \cdot 10^{+36}:\\
\;\;\;\;d1 \cdot \left(d4 - d1\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if d3 < -1.8e66 or 1.15999999999999998e36 < d3 Initial program 81.3%
sub-neg81.3%
associate-+l+81.3%
*-commutative81.3%
+-commutative81.3%
*-commutative81.3%
sub-neg81.3%
+-commutative81.3%
associate--l+81.3%
distribute-lft-out--83.1%
distribute-rgt-out--87.8%
distribute-lft-out99.9%
+-commutative99.9%
Simplified99.9%
+-commutative99.9%
distribute-lft-in87.8%
Applied egg-rr87.8%
Taylor expanded in d1 around 0 87.1%
distribute-lft-out89.0%
*-commutative89.0%
associate-+l-89.0%
Applied egg-rr89.0%
Taylor expanded in d4 around 0 77.2%
if -1.8e66 < d3 < 1.1200000000000001e-213Initial program 91.0%
sub-neg91.0%
associate-+l+91.0%
*-commutative91.0%
+-commutative91.0%
*-commutative91.0%
sub-neg91.0%
+-commutative91.0%
associate--l+91.0%
distribute-lft-out--91.0%
distribute-rgt-out--93.2%
distribute-lft-out99.9%
+-commutative99.9%
Simplified99.9%
Taylor expanded in d3 around 0 98.9%
Taylor expanded in d1 around 0 80.6%
if 1.1200000000000001e-213 < d3 < 1.15999999999999998e36Initial program 88.3%
sub-neg88.3%
associate-+l+88.3%
*-commutative88.3%
+-commutative88.3%
*-commutative88.3%
sub-neg88.3%
+-commutative88.3%
associate--l+88.3%
distribute-lft-out--90.0%
distribute-rgt-out--96.7%
distribute-lft-out100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in d3 around 0 96.5%
Taylor expanded in d2 around 0 67.4%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (or (<= d3 -7.5e+68) (not (<= d3 3.5e+32))) (* d1 (- (+ d2 d4) d3)) (* d1 (- (+ d2 d4) d1))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d3 <= -7.5e+68) || !(d3 <= 3.5e+32)) {
tmp = d1 * ((d2 + d4) - d3);
} else {
tmp = d1 * ((d2 + d4) - d1);
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: tmp
if ((d3 <= (-7.5d+68)) .or. (.not. (d3 <= 3.5d+32))) then
tmp = d1 * ((d2 + d4) - d3)
else
tmp = d1 * ((d2 + d4) - d1)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d3 <= -7.5e+68) || !(d3 <= 3.5e+32)) {
tmp = d1 * ((d2 + d4) - d3);
} else {
tmp = d1 * ((d2 + d4) - d1);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if (d3 <= -7.5e+68) or not (d3 <= 3.5e+32): tmp = d1 * ((d2 + d4) - d3) else: tmp = d1 * ((d2 + d4) - d1) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if ((d3 <= -7.5e+68) || !(d3 <= 3.5e+32)) tmp = Float64(d1 * Float64(Float64(d2 + d4) - d3)); else tmp = Float64(d1 * Float64(Float64(d2 + d4) - d1)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if ((d3 <= -7.5e+68) || ~((d3 <= 3.5e+32))) tmp = d1 * ((d2 + d4) - d3); else tmp = d1 * ((d2 + d4) - d1); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[Or[LessEqual[d3, -7.5e+68], N[Not[LessEqual[d3, 3.5e+32]], $MachinePrecision]], N[(d1 * N[(N[(d2 + d4), $MachinePrecision] - d3), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(N[(d2 + d4), $MachinePrecision] - d1), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d3 \leq -7.5 \cdot 10^{+68} \lor \neg \left(d3 \leq 3.5 \cdot 10^{+32}\right):\\
\;\;\;\;d1 \cdot \left(\left(d2 + d4\right) - d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(\left(d2 + d4\right) - d1\right)\\
\end{array}
\end{array}
if d3 < -7.49999999999999959e68 or 3.5000000000000001e32 < d3 Initial program 80.7%
sub-neg80.7%
associate-+l+80.7%
*-commutative80.7%
+-commutative80.7%
*-commutative80.7%
sub-neg80.7%
+-commutative80.7%
associate--l+80.7%
distribute-lft-out--83.4%
distribute-rgt-out--88.0%
distribute-lft-out99.9%
+-commutative99.9%
Simplified99.9%
Taylor expanded in d1 around 0 89.2%
if -7.49999999999999959e68 < d3 < 3.5000000000000001e32Initial program 90.5%
sub-neg90.5%
associate-+l+90.5%
*-commutative90.5%
+-commutative90.5%
*-commutative90.5%
sub-neg90.5%
+-commutative90.5%
associate--l+90.5%
distribute-lft-out--90.5%
distribute-rgt-out--94.5%
distribute-lft-out100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in d3 around 0 97.9%
Final simplification94.2%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (or (<= d3 -9.5e+84) (not (<= d3 7.6e+96))) (* d1 (- d4 d3)) (* d1 (- (+ d2 d4) d1))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d3 <= -9.5e+84) || !(d3 <= 7.6e+96)) {
tmp = d1 * (d4 - d3);
} else {
tmp = d1 * ((d2 + d4) - d1);
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: tmp
if ((d3 <= (-9.5d+84)) .or. (.not. (d3 <= 7.6d+96))) then
tmp = d1 * (d4 - d3)
else
tmp = d1 * ((d2 + d4) - d1)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d3 <= -9.5e+84) || !(d3 <= 7.6e+96)) {
tmp = d1 * (d4 - d3);
} else {
tmp = d1 * ((d2 + d4) - d1);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if (d3 <= -9.5e+84) or not (d3 <= 7.6e+96): tmp = d1 * (d4 - d3) else: tmp = d1 * ((d2 + d4) - d1) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if ((d3 <= -9.5e+84) || !(d3 <= 7.6e+96)) tmp = Float64(d1 * Float64(d4 - d3)); else tmp = Float64(d1 * Float64(Float64(d2 + d4) - d1)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if ((d3 <= -9.5e+84) || ~((d3 <= 7.6e+96))) tmp = d1 * (d4 - d3); else tmp = d1 * ((d2 + d4) - d1); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[Or[LessEqual[d3, -9.5e+84], N[Not[LessEqual[d3, 7.6e+96]], $MachinePrecision]], N[(d1 * N[(d4 - d3), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(N[(d2 + d4), $MachinePrecision] - d1), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d3 \leq -9.5 \cdot 10^{+84} \lor \neg \left(d3 \leq 7.6 \cdot 10^{+96}\right):\\
\;\;\;\;d1 \cdot \left(d4 - d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(\left(d2 + d4\right) - d1\right)\\
\end{array}
\end{array}
if d3 < -9.49999999999999979e84 or 7.6000000000000003e96 < d3 Initial program 81.7%
sub-neg81.7%
associate-+l+81.7%
*-commutative81.7%
+-commutative81.7%
*-commutative81.7%
sub-neg81.7%
+-commutative81.7%
associate--l+81.7%
distribute-lft-out--83.8%
distribute-rgt-out--87.0%
distribute-lft-out99.9%
+-commutative99.9%
Simplified99.9%
Taylor expanded in d2 around 0 85.9%
+-commutative85.9%
associate--r+85.9%
Simplified85.9%
Taylor expanded in d1 around 0 76.2%
if -9.49999999999999979e84 < d3 < 7.6000000000000003e96Initial program 88.9%
sub-neg88.9%
associate-+l+88.9%
*-commutative88.9%
+-commutative88.9%
*-commutative88.9%
sub-neg88.9%
+-commutative88.9%
associate--l+88.9%
distribute-lft-out--89.6%
distribute-rgt-out--94.5%
distribute-lft-out100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in d3 around 0 95.7%
Final simplification88.6%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d2 -5.2e+98) (* d1 (- (+ d2 d4) d3)) (* d1 (- (- d4 d3) d1))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -5.2e+98) {
tmp = d1 * ((d2 + d4) - d3);
} else {
tmp = d1 * ((d4 - d3) - d1);
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: tmp
if (d2 <= (-5.2d+98)) then
tmp = d1 * ((d2 + d4) - d3)
else
tmp = d1 * ((d4 - d3) - d1)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -5.2e+98) {
tmp = d1 * ((d2 + d4) - d3);
} else {
tmp = d1 * ((d4 - d3) - d1);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d2 <= -5.2e+98: tmp = d1 * ((d2 + d4) - d3) else: tmp = d1 * ((d4 - d3) - d1) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d2 <= -5.2e+98) tmp = Float64(d1 * Float64(Float64(d2 + d4) - d3)); else tmp = Float64(d1 * Float64(Float64(d4 - d3) - d1)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d2 <= -5.2e+98) tmp = d1 * ((d2 + d4) - d3); else tmp = d1 * ((d4 - d3) - d1); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d2, -5.2e+98], N[(d1 * N[(N[(d2 + d4), $MachinePrecision] - d3), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(N[(d4 - d3), $MachinePrecision] - d1), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d2 \leq -5.2 \cdot 10^{+98}:\\
\;\;\;\;d1 \cdot \left(\left(d2 + d4\right) - d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(\left(d4 - d3\right) - d1\right)\\
\end{array}
\end{array}
if d2 < -5.1999999999999999e98Initial program 73.3%
sub-neg73.3%
associate-+l+73.3%
*-commutative73.3%
+-commutative73.3%
*-commutative73.3%
sub-neg73.3%
+-commutative73.3%
associate--l+73.3%
distribute-lft-out--73.3%
distribute-rgt-out--88.9%
distribute-lft-out99.9%
+-commutative99.9%
Simplified99.9%
Taylor expanded in d1 around 0 93.3%
if -5.1999999999999999e98 < d2 Initial program 89.1%
sub-neg89.1%
associate-+l+89.1%
*-commutative89.1%
+-commutative89.1%
*-commutative89.1%
sub-neg89.1%
+-commutative89.1%
associate--l+89.1%
distribute-lft-out--90.5%
distribute-rgt-out--92.4%
distribute-lft-out100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in d2 around 0 79.1%
+-commutative79.1%
associate--r+79.1%
Simplified79.1%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d4 1.85e-34) (* d1 (- d2 d1)) (* d1 (+ d2 d4))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 1.85e-34) {
tmp = d1 * (d2 - d1);
} else {
tmp = d1 * (d2 + d4);
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: tmp
if (d4 <= 1.85d-34) then
tmp = d1 * (d2 - d1)
else
tmp = d1 * (d2 + d4)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 1.85e-34) {
tmp = d1 * (d2 - d1);
} else {
tmp = d1 * (d2 + d4);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= 1.85e-34: tmp = d1 * (d2 - d1) else: tmp = d1 * (d2 + d4) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= 1.85e-34) tmp = Float64(d1 * Float64(d2 - d1)); else tmp = Float64(d1 * Float64(d2 + d4)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d4 <= 1.85e-34) tmp = d1 * (d2 - d1); else tmp = d1 * (d2 + d4); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, 1.85e-34], N[(d1 * N[(d2 - d1), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(d2 + d4), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq 1.85 \cdot 10^{-34}:\\
\;\;\;\;d1 \cdot \left(d2 - d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d2 + d4\right)\\
\end{array}
\end{array}
if d4 < 1.84999999999999994e-34Initial program 88.7%
sub-neg88.7%
associate-+l+88.7%
*-commutative88.7%
+-commutative88.7%
*-commutative88.7%
sub-neg88.7%
+-commutative88.7%
associate--l+88.7%
distribute-lft-out--89.3%
distribute-rgt-out--93.6%
distribute-lft-out100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in d3 around 0 74.1%
Taylor expanded in d4 around 0 61.6%
if 1.84999999999999994e-34 < d4 Initial program 79.7%
sub-neg79.7%
associate-+l+79.7%
*-commutative79.7%
+-commutative79.7%
*-commutative79.7%
sub-neg79.7%
+-commutative79.7%
associate--l+79.7%
distribute-lft-out--82.6%
distribute-rgt-out--86.9%
distribute-lft-out100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in d3 around 0 82.1%
Taylor expanded in d1 around 0 79.2%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d4 9e+22) (* d1 d2) (* d1 d4)))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 9e+22) {
tmp = d1 * d2;
} else {
tmp = d1 * d4;
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: tmp
if (d4 <= 9d+22) then
tmp = d1 * d2
else
tmp = d1 * d4
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 9e+22) {
tmp = d1 * d2;
} else {
tmp = d1 * d4;
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= 9e+22: tmp = d1 * d2 else: tmp = d1 * d4 return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= 9e+22) tmp = Float64(d1 * d2); else tmp = Float64(d1 * d4); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d4 <= 9e+22) tmp = d1 * d2; else tmp = d1 * d4; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, 9e+22], N[(d1 * d2), $MachinePrecision], N[(d1 * d4), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq 9 \cdot 10^{+22}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\end{array}
if d4 < 8.9999999999999996e22Initial program 88.6%
sub-neg88.6%
associate-+l+88.6%
*-commutative88.6%
+-commutative88.6%
*-commutative88.6%
sub-neg88.6%
+-commutative88.6%
associate--l+88.6%
distribute-lft-out--89.1%
distribute-rgt-out--93.2%
distribute-lft-out100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in d2 around inf 35.4%
if 8.9999999999999996e22 < d4 Initial program 79.3%
sub-neg79.3%
associate-+l+79.3%
*-commutative79.3%
+-commutative79.3%
*-commutative79.3%
sub-neg79.3%
+-commutative79.3%
associate--l+79.3%
distribute-lft-out--82.5%
distribute-rgt-out--87.3%
distribute-lft-out100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in d4 around inf 69.2%
(FPCore (d1 d2 d3 d4) :precision binary64 (* d1 (+ d2 d4)))
double code(double d1, double d2, double d3, double d4) {
return d1 * (d2 + d4);
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
code = d1 * (d2 + d4)
end function
public static double code(double d1, double d2, double d3, double d4) {
return d1 * (d2 + d4);
}
def code(d1, d2, d3, d4): return d1 * (d2 + d4)
function code(d1, d2, d3, d4) return Float64(d1 * Float64(d2 + d4)) end
function tmp = code(d1, d2, d3, d4) tmp = d1 * (d2 + d4); end
code[d1_, d2_, d3_, d4_] := N[(d1 * N[(d2 + d4), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
d1 \cdot \left(d2 + d4\right)
\end{array}
Initial program 86.3%
sub-neg86.3%
associate-+l+86.3%
*-commutative86.3%
+-commutative86.3%
*-commutative86.3%
sub-neg86.3%
+-commutative86.3%
associate--l+86.3%
distribute-lft-out--87.5%
distribute-rgt-out--91.8%
distribute-lft-out100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in d3 around 0 76.2%
Taylor expanded in d1 around 0 56.3%
(FPCore (d1 d2 d3 d4) :precision binary64 (* d1 d2))
double code(double d1, double d2, double d3, double d4) {
return d1 * d2;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
code = d1 * d2
end function
public static double code(double d1, double d2, double d3, double d4) {
return d1 * d2;
}
def code(d1, d2, d3, d4): return d1 * d2
function code(d1, d2, d3, d4) return Float64(d1 * d2) end
function tmp = code(d1, d2, d3, d4) tmp = d1 * d2; end
code[d1_, d2_, d3_, d4_] := N[(d1 * d2), $MachinePrecision]
\begin{array}{l}
\\
d1 \cdot d2
\end{array}
Initial program 86.3%
sub-neg86.3%
associate-+l+86.3%
*-commutative86.3%
+-commutative86.3%
*-commutative86.3%
sub-neg86.3%
+-commutative86.3%
associate--l+86.3%
distribute-lft-out--87.5%
distribute-rgt-out--91.8%
distribute-lft-out100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in d2 around inf 31.9%
(FPCore (d1 d2 d3 d4) :precision binary64 (* d1 (- (+ (- d2 d3) d4) d1)))
double code(double d1, double d2, double d3, double d4) {
return d1 * (((d2 - d3) + d4) - d1);
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
code = d1 * (((d2 - d3) + d4) - d1)
end function
public static double code(double d1, double d2, double d3, double d4) {
return d1 * (((d2 - d3) + d4) - d1);
}
def code(d1, d2, d3, d4): return d1 * (((d2 - d3) + d4) - d1)
function code(d1, d2, d3, d4) return Float64(d1 * Float64(Float64(Float64(d2 - d3) + d4) - d1)) end
function tmp = code(d1, d2, d3, d4) tmp = d1 * (((d2 - d3) + d4) - d1); end
code[d1_, d2_, d3_, d4_] := N[(d1 * N[(N[(N[(d2 - d3), $MachinePrecision] + d4), $MachinePrecision] - d1), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
d1 \cdot \left(\left(\left(d2 - d3\right) + d4\right) - d1\right)
\end{array}
herbie shell --seed 2024107
(FPCore (d1 d2 d3 d4)
:name "FastMath dist4"
:precision binary64
:alt
(* d1 (- (+ (- d2 d3) d4) d1))
(- (+ (- (* d1 d2) (* d1 d3)) (* d4 d1)) (* d1 d1)))