
(FPCore (x y z t) :precision binary64 (/ (- (+ x y) z) (* t 2.0)))
double code(double x, double y, double z, double t) {
return ((x + y) - z) / (t * 2.0);
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = ((x + y) - z) / (t * 2.0d0)
end function
public static double code(double x, double y, double z, double t) {
return ((x + y) - z) / (t * 2.0);
}
def code(x, y, z, t): return ((x + y) - z) / (t * 2.0)
function code(x, y, z, t) return Float64(Float64(Float64(x + y) - z) / Float64(t * 2.0)) end
function tmp = code(x, y, z, t) tmp = ((x + y) - z) / (t * 2.0); end
code[x_, y_, z_, t_] := N[(N[(N[(x + y), $MachinePrecision] - z), $MachinePrecision] / N[(t * 2.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(x + y\right) - z}{t \cdot 2}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (/ (- (+ x y) z) (* t 2.0)))
double code(double x, double y, double z, double t) {
return ((x + y) - z) / (t * 2.0);
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = ((x + y) - z) / (t * 2.0d0)
end function
public static double code(double x, double y, double z, double t) {
return ((x + y) - z) / (t * 2.0);
}
def code(x, y, z, t): return ((x + y) - z) / (t * 2.0)
function code(x, y, z, t) return Float64(Float64(Float64(x + y) - z) / Float64(t * 2.0)) end
function tmp = code(x, y, z, t) tmp = ((x + y) - z) / (t * 2.0); end
code[x_, y_, z_, t_] := N[(N[(N[(x + y), $MachinePrecision] - z), $MachinePrecision] / N[(t * 2.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(x + y\right) - z}{t \cdot 2}
\end{array}
(FPCore (x y z t) :precision binary64 (/ (- (+ x y) z) (* t 2.0)))
double code(double x, double y, double z, double t) {
return ((x + y) - z) / (t * 2.0);
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = ((x + y) - z) / (t * 2.0d0)
end function
public static double code(double x, double y, double z, double t) {
return ((x + y) - z) / (t * 2.0);
}
def code(x, y, z, t): return ((x + y) - z) / (t * 2.0)
function code(x, y, z, t) return Float64(Float64(Float64(x + y) - z) / Float64(t * 2.0)) end
function tmp = code(x, y, z, t) tmp = ((x + y) - z) / (t * 2.0); end
code[x_, y_, z_, t_] := N[(N[(N[(x + y), $MachinePrecision] - z), $MachinePrecision] / N[(t * 2.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(x + y\right) - z}{t \cdot 2}
\end{array}
Initial program 100.0%
Final simplification100.0%
(FPCore (x y z t)
:precision binary64
(if (<= x -850.0)
(* 0.5 (/ x t))
(if (or (<= x -2.5e-202) (and (not (<= x 2e-174)) (<= x 9.5e-138)))
(/ -0.5 (/ t z))
(* 0.5 (/ y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -850.0) {
tmp = 0.5 * (x / t);
} else if ((x <= -2.5e-202) || (!(x <= 2e-174) && (x <= 9.5e-138))) {
tmp = -0.5 / (t / z);
} else {
tmp = 0.5 * (y / t);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (x <= (-850.0d0)) then
tmp = 0.5d0 * (x / t)
else if ((x <= (-2.5d-202)) .or. (.not. (x <= 2d-174)) .and. (x <= 9.5d-138)) then
tmp = (-0.5d0) / (t / z)
else
tmp = 0.5d0 * (y / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -850.0) {
tmp = 0.5 * (x / t);
} else if ((x <= -2.5e-202) || (!(x <= 2e-174) && (x <= 9.5e-138))) {
tmp = -0.5 / (t / z);
} else {
tmp = 0.5 * (y / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -850.0: tmp = 0.5 * (x / t) elif (x <= -2.5e-202) or (not (x <= 2e-174) and (x <= 9.5e-138)): tmp = -0.5 / (t / z) else: tmp = 0.5 * (y / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -850.0) tmp = Float64(0.5 * Float64(x / t)); elseif ((x <= -2.5e-202) || (!(x <= 2e-174) && (x <= 9.5e-138))) tmp = Float64(-0.5 / Float64(t / z)); else tmp = Float64(0.5 * Float64(y / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -850.0) tmp = 0.5 * (x / t); elseif ((x <= -2.5e-202) || (~((x <= 2e-174)) && (x <= 9.5e-138))) tmp = -0.5 / (t / z); else tmp = 0.5 * (y / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -850.0], N[(0.5 * N[(x / t), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[x, -2.5e-202], And[N[Not[LessEqual[x, 2e-174]], $MachinePrecision], LessEqual[x, 9.5e-138]]], N[(-0.5 / N[(t / z), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(y / t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -850:\\
\;\;\;\;0.5 \cdot \frac{x}{t}\\
\mathbf{elif}\;x \leq -2.5 \cdot 10^{-202} \lor \neg \left(x \leq 2 \cdot 10^{-174}\right) \land x \leq 9.5 \cdot 10^{-138}:\\
\;\;\;\;\frac{-0.5}{\frac{t}{z}}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{y}{t}\\
\end{array}
\end{array}
if x < -850Initial program 100.0%
Taylor expanded in x around inf 59.0%
if -850 < x < -2.49999999999999986e-202 or 2e-174 < x < 9.49999999999999997e-138Initial program 99.9%
Taylor expanded in z around inf 44.5%
associate-*r/44.5%
associate-/l*44.4%
Simplified44.4%
if -2.49999999999999986e-202 < x < 2e-174 or 9.49999999999999997e-138 < x Initial program 100.0%
Taylor expanded in y around inf 46.1%
Final simplification49.1%
(FPCore (x y z t)
:precision binary64
(if (<= x -13.5)
(* 0.5 (/ x t))
(if (or (<= x -7e-200) (and (not (<= x 9e-175)) (<= x 2.2e-138)))
(/ (* -0.5 z) t)
(* 0.5 (/ y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -13.5) {
tmp = 0.5 * (x / t);
} else if ((x <= -7e-200) || (!(x <= 9e-175) && (x <= 2.2e-138))) {
tmp = (-0.5 * z) / t;
} else {
tmp = 0.5 * (y / t);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (x <= (-13.5d0)) then
tmp = 0.5d0 * (x / t)
else if ((x <= (-7d-200)) .or. (.not. (x <= 9d-175)) .and. (x <= 2.2d-138)) then
tmp = ((-0.5d0) * z) / t
else
tmp = 0.5d0 * (y / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -13.5) {
tmp = 0.5 * (x / t);
} else if ((x <= -7e-200) || (!(x <= 9e-175) && (x <= 2.2e-138))) {
tmp = (-0.5 * z) / t;
} else {
tmp = 0.5 * (y / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -13.5: tmp = 0.5 * (x / t) elif (x <= -7e-200) or (not (x <= 9e-175) and (x <= 2.2e-138)): tmp = (-0.5 * z) / t else: tmp = 0.5 * (y / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -13.5) tmp = Float64(0.5 * Float64(x / t)); elseif ((x <= -7e-200) || (!(x <= 9e-175) && (x <= 2.2e-138))) tmp = Float64(Float64(-0.5 * z) / t); else tmp = Float64(0.5 * Float64(y / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -13.5) tmp = 0.5 * (x / t); elseif ((x <= -7e-200) || (~((x <= 9e-175)) && (x <= 2.2e-138))) tmp = (-0.5 * z) / t; else tmp = 0.5 * (y / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -13.5], N[(0.5 * N[(x / t), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[x, -7e-200], And[N[Not[LessEqual[x, 9e-175]], $MachinePrecision], LessEqual[x, 2.2e-138]]], N[(N[(-0.5 * z), $MachinePrecision] / t), $MachinePrecision], N[(0.5 * N[(y / t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -13.5:\\
\;\;\;\;0.5 \cdot \frac{x}{t}\\
\mathbf{elif}\;x \leq -7 \cdot 10^{-200} \lor \neg \left(x \leq 9 \cdot 10^{-175}\right) \land x \leq 2.2 \cdot 10^{-138}:\\
\;\;\;\;\frac{-0.5 \cdot z}{t}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{y}{t}\\
\end{array}
\end{array}
if x < -13.5Initial program 100.0%
Taylor expanded in x around inf 59.0%
if -13.5 < x < -7.00000000000000045e-200 or 8.99999999999999996e-175 < x < 2.1999999999999999e-138Initial program 99.9%
Taylor expanded in z around inf 44.5%
*-commutative44.5%
associate-*l/44.5%
Simplified44.5%
if -7.00000000000000045e-200 < x < 8.99999999999999996e-175 or 2.1999999999999999e-138 < x Initial program 100.0%
Taylor expanded in y around inf 46.1%
Final simplification49.1%
(FPCore (x y z t) :precision binary64 (if (or (<= z -7.5e+57) (not (<= z 5.2e+180))) (/ (* -0.5 z) t) (* 0.5 (/ (+ x y) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -7.5e+57) || !(z <= 5.2e+180)) {
tmp = (-0.5 * z) / t;
} else {
tmp = 0.5 * ((x + y) / t);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((z <= (-7.5d+57)) .or. (.not. (z <= 5.2d+180))) then
tmp = ((-0.5d0) * z) / t
else
tmp = 0.5d0 * ((x + y) / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -7.5e+57) || !(z <= 5.2e+180)) {
tmp = (-0.5 * z) / t;
} else {
tmp = 0.5 * ((x + y) / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -7.5e+57) or not (z <= 5.2e+180): tmp = (-0.5 * z) / t else: tmp = 0.5 * ((x + y) / t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -7.5e+57) || !(z <= 5.2e+180)) tmp = Float64(Float64(-0.5 * z) / t); else tmp = Float64(0.5 * Float64(Float64(x + y) / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -7.5e+57) || ~((z <= 5.2e+180))) tmp = (-0.5 * z) / t; else tmp = 0.5 * ((x + y) / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -7.5e+57], N[Not[LessEqual[z, 5.2e+180]], $MachinePrecision]], N[(N[(-0.5 * z), $MachinePrecision] / t), $MachinePrecision], N[(0.5 * N[(N[(x + y), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.5 \cdot 10^{+57} \lor \neg \left(z \leq 5.2 \cdot 10^{+180}\right):\\
\;\;\;\;\frac{-0.5 \cdot z}{t}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{x + y}{t}\\
\end{array}
\end{array}
if z < -7.5000000000000006e57 or 5.20000000000000042e180 < z Initial program 100.0%
Taylor expanded in z around inf 76.7%
*-commutative76.7%
associate-*l/76.7%
Simplified76.7%
if -7.5000000000000006e57 < z < 5.20000000000000042e180Initial program 100.0%
Taylor expanded in z around 0 84.7%
+-commutative84.7%
Simplified84.7%
Final simplification82.4%
(FPCore (x y z t) :precision binary64 (if (<= x -3.6e+186) (* 0.5 (/ (+ x y) t)) (if (<= x -200000.0) (* 0.5 (/ (- x z) t)) (* (- y z) (/ 0.5 t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -3.6e+186) {
tmp = 0.5 * ((x + y) / t);
} else if (x <= -200000.0) {
tmp = 0.5 * ((x - z) / t);
} else {
tmp = (y - z) * (0.5 / t);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (x <= (-3.6d+186)) then
tmp = 0.5d0 * ((x + y) / t)
else if (x <= (-200000.0d0)) then
tmp = 0.5d0 * ((x - z) / t)
else
tmp = (y - z) * (0.5d0 / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -3.6e+186) {
tmp = 0.5 * ((x + y) / t);
} else if (x <= -200000.0) {
tmp = 0.5 * ((x - z) / t);
} else {
tmp = (y - z) * (0.5 / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -3.6e+186: tmp = 0.5 * ((x + y) / t) elif x <= -200000.0: tmp = 0.5 * ((x - z) / t) else: tmp = (y - z) * (0.5 / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -3.6e+186) tmp = Float64(0.5 * Float64(Float64(x + y) / t)); elseif (x <= -200000.0) tmp = Float64(0.5 * Float64(Float64(x - z) / t)); else tmp = Float64(Float64(y - z) * Float64(0.5 / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -3.6e+186) tmp = 0.5 * ((x + y) / t); elseif (x <= -200000.0) tmp = 0.5 * ((x - z) / t); else tmp = (y - z) * (0.5 / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -3.6e+186], N[(0.5 * N[(N[(x + y), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -200000.0], N[(0.5 * N[(N[(x - z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], N[(N[(y - z), $MachinePrecision] * N[(0.5 / t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.6 \cdot 10^{+186}:\\
\;\;\;\;0.5 \cdot \frac{x + y}{t}\\
\mathbf{elif}\;x \leq -200000:\\
\;\;\;\;0.5 \cdot \frac{x - z}{t}\\
\mathbf{else}:\\
\;\;\;\;\left(y - z\right) \cdot \frac{0.5}{t}\\
\end{array}
\end{array}
if x < -3.6000000000000002e186Initial program 100.0%
Taylor expanded in z around 0 100.0%
+-commutative100.0%
Simplified100.0%
if -3.6000000000000002e186 < x < -2e5Initial program 100.0%
Taylor expanded in y around 0 72.3%
if -2e5 < x Initial program 100.0%
Taylor expanded in x around 0 81.6%
associate-*r/81.6%
associate-*l/81.4%
*-commutative81.4%
Simplified81.4%
Final simplification81.8%
(FPCore (x y z t) :precision binary64 (if (<= x -2.9e+187) (* 0.5 (/ (+ x y) t)) (if (<= x -0.102) (* 0.5 (/ (- x z) t)) (/ (* 0.5 (- y z)) t))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -2.9e+187) {
tmp = 0.5 * ((x + y) / t);
} else if (x <= -0.102) {
tmp = 0.5 * ((x - z) / t);
} else {
tmp = (0.5 * (y - z)) / t;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (x <= (-2.9d+187)) then
tmp = 0.5d0 * ((x + y) / t)
else if (x <= (-0.102d0)) then
tmp = 0.5d0 * ((x - z) / t)
else
tmp = (0.5d0 * (y - z)) / t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -2.9e+187) {
tmp = 0.5 * ((x + y) / t);
} else if (x <= -0.102) {
tmp = 0.5 * ((x - z) / t);
} else {
tmp = (0.5 * (y - z)) / t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -2.9e+187: tmp = 0.5 * ((x + y) / t) elif x <= -0.102: tmp = 0.5 * ((x - z) / t) else: tmp = (0.5 * (y - z)) / t return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -2.9e+187) tmp = Float64(0.5 * Float64(Float64(x + y) / t)); elseif (x <= -0.102) tmp = Float64(0.5 * Float64(Float64(x - z) / t)); else tmp = Float64(Float64(0.5 * Float64(y - z)) / t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -2.9e+187) tmp = 0.5 * ((x + y) / t); elseif (x <= -0.102) tmp = 0.5 * ((x - z) / t); else tmp = (0.5 * (y - z)) / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -2.9e+187], N[(0.5 * N[(N[(x + y), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -0.102], N[(0.5 * N[(N[(x - z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 * N[(y - z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.9 \cdot 10^{+187}:\\
\;\;\;\;0.5 \cdot \frac{x + y}{t}\\
\mathbf{elif}\;x \leq -0.102:\\
\;\;\;\;0.5 \cdot \frac{x - z}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{0.5 \cdot \left(y - z\right)}{t}\\
\end{array}
\end{array}
if x < -2.9000000000000001e187Initial program 100.0%
Taylor expanded in z around 0 100.0%
+-commutative100.0%
Simplified100.0%
if -2.9000000000000001e187 < x < -0.101999999999999993Initial program 100.0%
Taylor expanded in y around 0 72.3%
if -0.101999999999999993 < x Initial program 100.0%
Taylor expanded in x around 0 81.6%
associate-*r/81.6%
Simplified81.6%
Final simplification81.9%
(FPCore (x y z t) :precision binary64 (if (<= y 9.2e+60) (* 0.5 (/ (- x z) t)) (* 0.5 (/ (+ x y) t))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 9.2e+60) {
tmp = 0.5 * ((x - z) / t);
} else {
tmp = 0.5 * ((x + y) / t);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= 9.2d+60) then
tmp = 0.5d0 * ((x - z) / t)
else
tmp = 0.5d0 * ((x + y) / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 9.2e+60) {
tmp = 0.5 * ((x - z) / t);
} else {
tmp = 0.5 * ((x + y) / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= 9.2e+60: tmp = 0.5 * ((x - z) / t) else: tmp = 0.5 * ((x + y) / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= 9.2e+60) tmp = Float64(0.5 * Float64(Float64(x - z) / t)); else tmp = Float64(0.5 * Float64(Float64(x + y) / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= 9.2e+60) tmp = 0.5 * ((x - z) / t); else tmp = 0.5 * ((x + y) / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, 9.2e+60], N[(0.5 * N[(N[(x - z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(N[(x + y), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 9.2 \cdot 10^{+60}:\\
\;\;\;\;0.5 \cdot \frac{x - z}{t}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{x + y}{t}\\
\end{array}
\end{array}
if y < 9.20000000000000068e60Initial program 100.0%
Taylor expanded in y around 0 69.3%
if 9.20000000000000068e60 < y Initial program 99.9%
Taylor expanded in z around 0 87.1%
+-commutative87.1%
Simplified87.1%
Final simplification73.3%
(FPCore (x y z t) :precision binary64 (if (<= x -140000.0) (* 0.5 (/ x t)) (* 0.5 (/ y t))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -140000.0) {
tmp = 0.5 * (x / t);
} else {
tmp = 0.5 * (y / t);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (x <= (-140000.0d0)) then
tmp = 0.5d0 * (x / t)
else
tmp = 0.5d0 * (y / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -140000.0) {
tmp = 0.5 * (x / t);
} else {
tmp = 0.5 * (y / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -140000.0: tmp = 0.5 * (x / t) else: tmp = 0.5 * (y / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -140000.0) tmp = Float64(0.5 * Float64(x / t)); else tmp = Float64(0.5 * Float64(y / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -140000.0) tmp = 0.5 * (x / t); else tmp = 0.5 * (y / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -140000.0], N[(0.5 * N[(x / t), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(y / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -140000:\\
\;\;\;\;0.5 \cdot \frac{x}{t}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{y}{t}\\
\end{array}
\end{array}
if x < -1.4e5Initial program 100.0%
Taylor expanded in x around inf 59.0%
if -1.4e5 < x Initial program 100.0%
Taylor expanded in y around inf 48.5%
Final simplification51.2%
(FPCore (x y z t) :precision binary64 (/ 0.5 (/ t (+ y (- x z)))))
double code(double x, double y, double z, double t) {
return 0.5 / (t / (y + (x - z)));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = 0.5d0 / (t / (y + (x - z)))
end function
public static double code(double x, double y, double z, double t) {
return 0.5 / (t / (y + (x - z)));
}
def code(x, y, z, t): return 0.5 / (t / (y + (x - z)))
function code(x, y, z, t) return Float64(0.5 / Float64(t / Float64(y + Float64(x - z)))) end
function tmp = code(x, y, z, t) tmp = 0.5 / (t / (y + (x - z))); end
code[x_, y_, z_, t_] := N[(0.5 / N[(t / N[(y + N[(x - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{0.5}{\frac{t}{y + \left(x - z\right)}}
\end{array}
Initial program 100.0%
clear-num99.6%
inv-pow99.6%
*-commutative99.6%
*-un-lft-identity99.6%
times-frac99.6%
metadata-eval99.6%
associate--l+99.6%
Applied egg-rr99.6%
unpow-199.6%
associate-/r*99.6%
metadata-eval99.6%
associate-+r-99.6%
+-commutative99.6%
associate--l+99.6%
Applied egg-rr99.6%
Final simplification99.6%
(FPCore (x y z t) :precision binary64 (* 0.5 (/ x t)))
double code(double x, double y, double z, double t) {
return 0.5 * (x / t);
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = 0.5d0 * (x / t)
end function
public static double code(double x, double y, double z, double t) {
return 0.5 * (x / t);
}
def code(x, y, z, t): return 0.5 * (x / t)
function code(x, y, z, t) return Float64(0.5 * Float64(x / t)) end
function tmp = code(x, y, z, t) tmp = 0.5 * (x / t); end
code[x_, y_, z_, t_] := N[(0.5 * N[(x / t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
0.5 \cdot \frac{x}{t}
\end{array}
Initial program 100.0%
Taylor expanded in x around inf 33.2%
Final simplification33.2%
herbie shell --seed 2024034
(FPCore (x y z t)
:name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, B"
:precision binary64
(/ (- (+ x y) z) (* t 2.0)))