
(FPCore (x y z t) :precision binary64 (+ x (/ (* (- y x) z) t)))
double code(double x, double y, double z, double t) {
return x + (((y - x) * z) / 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 = x + (((y - x) * z) / t)
end function
public static double code(double x, double y, double z, double t) {
return x + (((y - x) * z) / t);
}
def code(x, y, z, t): return x + (((y - x) * z) / t)
function code(x, y, z, t) return Float64(x + Float64(Float64(Float64(y - x) * z) / t)) end
function tmp = code(x, y, z, t) tmp = x + (((y - x) * z) / t); end
code[x_, y_, z_, t_] := N[(x + N[(N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{\left(y - x\right) \cdot z}{t}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (+ x (/ (* (- y x) z) t)))
double code(double x, double y, double z, double t) {
return x + (((y - x) * z) / 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 = x + (((y - x) * z) / t)
end function
public static double code(double x, double y, double z, double t) {
return x + (((y - x) * z) / t);
}
def code(x, y, z, t): return x + (((y - x) * z) / t)
function code(x, y, z, t) return Float64(x + Float64(Float64(Float64(y - x) * z) / t)) end
function tmp = code(x, y, z, t) tmp = x + (((y - x) * z) / t); end
code[x_, y_, z_, t_] := N[(x + N[(N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{\left(y - x\right) \cdot z}{t}
\end{array}
(FPCore (x y z t) :precision binary64 (+ x (* (/ z t) (- y x))))
double code(double x, double y, double z, double t) {
return x + ((z / t) * (y - x));
}
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 + ((z / t) * (y - x))
end function
public static double code(double x, double y, double z, double t) {
return x + ((z / t) * (y - x));
}
def code(x, y, z, t): return x + ((z / t) * (y - x))
function code(x, y, z, t) return Float64(x + Float64(Float64(z / t) * Float64(y - x))) end
function tmp = code(x, y, z, t) tmp = x + ((z / t) * (y - x)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(z / t), $MachinePrecision] * N[(y - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{z}{t} \cdot \left(y - x\right)
\end{array}
Initial program 94.6%
associate-/l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
--lowering--.f6497.3%
Applied egg-rr97.3%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (+ x (* (/ z t) y)))) (if (<= t -2.15e-137) t_1 (if (<= t 1.14e-66) (/ (* z (- y x)) t) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = x + ((z / t) * y);
double tmp;
if (t <= -2.15e-137) {
tmp = t_1;
} else if (t <= 1.14e-66) {
tmp = (z * (y - x)) / t;
} else {
tmp = t_1;
}
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) :: t_1
real(8) :: tmp
t_1 = x + ((z / t) * y)
if (t <= (-2.15d-137)) then
tmp = t_1
else if (t <= 1.14d-66) then
tmp = (z * (y - x)) / t
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x + ((z / t) * y);
double tmp;
if (t <= -2.15e-137) {
tmp = t_1;
} else if (t <= 1.14e-66) {
tmp = (z * (y - x)) / t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x + ((z / t) * y) tmp = 0 if t <= -2.15e-137: tmp = t_1 elif t <= 1.14e-66: tmp = (z * (y - x)) / t else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x + Float64(Float64(z / t) * y)) tmp = 0.0 if (t <= -2.15e-137) tmp = t_1; elseif (t <= 1.14e-66) tmp = Float64(Float64(z * Float64(y - x)) / t); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x + ((z / t) * y); tmp = 0.0; if (t <= -2.15e-137) tmp = t_1; elseif (t <= 1.14e-66) tmp = (z * (y - x)) / t; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x + N[(N[(z / t), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -2.15e-137], t$95$1, If[LessEqual[t, 1.14e-66], N[(N[(z * N[(y - x), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \frac{z}{t} \cdot y\\
\mathbf{if}\;t \leq -2.15 \cdot 10^{-137}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 1.14 \cdot 10^{-66}:\\
\;\;\;\;\frac{z \cdot \left(y - x\right)}{t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -2.1499999999999999e-137 or 1.14e-66 < t Initial program 92.4%
Taylor expanded in y around inf
/-lowering-/.f64N/A
*-lowering-*.f6485.7%
Simplified85.7%
associate-/l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
/-lowering-/.f6486.4%
Applied egg-rr86.4%
if -2.1499999999999999e-137 < t < 1.14e-66Initial program 98.7%
associate-/l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
--lowering--.f6495.7%
Applied egg-rr95.7%
Taylor expanded in z around inf
div-subN/A
associate-/l*N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
--lowering--.f6492.3%
Simplified92.3%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* x (- 1.0 (/ z t))))) (if (<= x -4e-54) t_1 (if (<= x 3e-37) (+ x (/ (* z y) t)) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = x * (1.0 - (z / t));
double tmp;
if (x <= -4e-54) {
tmp = t_1;
} else if (x <= 3e-37) {
tmp = x + ((z * y) / t);
} else {
tmp = t_1;
}
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) :: t_1
real(8) :: tmp
t_1 = x * (1.0d0 - (z / t))
if (x <= (-4d-54)) then
tmp = t_1
else if (x <= 3d-37) then
tmp = x + ((z * y) / t)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x * (1.0 - (z / t));
double tmp;
if (x <= -4e-54) {
tmp = t_1;
} else if (x <= 3e-37) {
tmp = x + ((z * y) / t);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (1.0 - (z / t)) tmp = 0 if x <= -4e-54: tmp = t_1 elif x <= 3e-37: tmp = x + ((z * y) / t) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(1.0 - Float64(z / t))) tmp = 0.0 if (x <= -4e-54) tmp = t_1; elseif (x <= 3e-37) tmp = Float64(x + Float64(Float64(z * y) / t)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (1.0 - (z / t)); tmp = 0.0; if (x <= -4e-54) tmp = t_1; elseif (x <= 3e-37) tmp = x + ((z * y) / t); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(1.0 - N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -4e-54], t$95$1, If[LessEqual[x, 3e-37], N[(x + N[(N[(z * y), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(1 - \frac{z}{t}\right)\\
\mathbf{if}\;x \leq -4 \cdot 10^{-54}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 3 \cdot 10^{-37}:\\
\;\;\;\;x + \frac{z \cdot y}{t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -4.0000000000000001e-54 or 3e-37 < x Initial program 92.3%
Taylor expanded in x around inf
*-lowering-*.f64N/A
mul-1-negN/A
unsub-negN/A
--lowering--.f64N/A
/-lowering-/.f6488.9%
Simplified88.9%
if -4.0000000000000001e-54 < x < 3e-37Initial program 97.3%
Taylor expanded in y around inf
/-lowering-/.f64N/A
*-lowering-*.f6487.6%
Simplified87.6%
Final simplification88.3%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* x (- 1.0 (/ z t))))) (if (<= x -3.5e-54) t_1 (if (<= x 4.6e-37) (+ x (* (/ z t) y)) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = x * (1.0 - (z / t));
double tmp;
if (x <= -3.5e-54) {
tmp = t_1;
} else if (x <= 4.6e-37) {
tmp = x + ((z / t) * y);
} else {
tmp = t_1;
}
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) :: t_1
real(8) :: tmp
t_1 = x * (1.0d0 - (z / t))
if (x <= (-3.5d-54)) then
tmp = t_1
else if (x <= 4.6d-37) then
tmp = x + ((z / t) * y)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x * (1.0 - (z / t));
double tmp;
if (x <= -3.5e-54) {
tmp = t_1;
} else if (x <= 4.6e-37) {
tmp = x + ((z / t) * y);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (1.0 - (z / t)) tmp = 0 if x <= -3.5e-54: tmp = t_1 elif x <= 4.6e-37: tmp = x + ((z / t) * y) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(1.0 - Float64(z / t))) tmp = 0.0 if (x <= -3.5e-54) tmp = t_1; elseif (x <= 4.6e-37) tmp = Float64(x + Float64(Float64(z / t) * y)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (1.0 - (z / t)); tmp = 0.0; if (x <= -3.5e-54) tmp = t_1; elseif (x <= 4.6e-37) tmp = x + ((z / t) * y); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(1.0 - N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -3.5e-54], t$95$1, If[LessEqual[x, 4.6e-37], N[(x + N[(N[(z / t), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(1 - \frac{z}{t}\right)\\
\mathbf{if}\;x \leq -3.5 \cdot 10^{-54}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 4.6 \cdot 10^{-37}:\\
\;\;\;\;x + \frac{z}{t} \cdot y\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -3.49999999999999982e-54 or 4.5999999999999999e-37 < x Initial program 92.3%
Taylor expanded in x around inf
*-lowering-*.f64N/A
mul-1-negN/A
unsub-negN/A
--lowering--.f64N/A
/-lowering-/.f6488.9%
Simplified88.9%
if -3.49999999999999982e-54 < x < 4.5999999999999999e-37Initial program 97.3%
Taylor expanded in y around inf
/-lowering-/.f64N/A
*-lowering-*.f6487.6%
Simplified87.6%
associate-/l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
/-lowering-/.f6485.8%
Applied egg-rr85.8%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* x (- 1.0 (/ z t))))) (if (<= x -2.6e-157) t_1 (if (<= x 1.6e-51) (* z (/ (- y x) t)) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = x * (1.0 - (z / t));
double tmp;
if (x <= -2.6e-157) {
tmp = t_1;
} else if (x <= 1.6e-51) {
tmp = z * ((y - x) / t);
} else {
tmp = t_1;
}
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) :: t_1
real(8) :: tmp
t_1 = x * (1.0d0 - (z / t))
if (x <= (-2.6d-157)) then
tmp = t_1
else if (x <= 1.6d-51) then
tmp = z * ((y - x) / t)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x * (1.0 - (z / t));
double tmp;
if (x <= -2.6e-157) {
tmp = t_1;
} else if (x <= 1.6e-51) {
tmp = z * ((y - x) / t);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (1.0 - (z / t)) tmp = 0 if x <= -2.6e-157: tmp = t_1 elif x <= 1.6e-51: tmp = z * ((y - x) / t) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(1.0 - Float64(z / t))) tmp = 0.0 if (x <= -2.6e-157) tmp = t_1; elseif (x <= 1.6e-51) tmp = Float64(z * Float64(Float64(y - x) / t)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (1.0 - (z / t)); tmp = 0.0; if (x <= -2.6e-157) tmp = t_1; elseif (x <= 1.6e-51) tmp = z * ((y - x) / t); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(1.0 - N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -2.6e-157], t$95$1, If[LessEqual[x, 1.6e-51], N[(z * N[(N[(y - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(1 - \frac{z}{t}\right)\\
\mathbf{if}\;x \leq -2.6 \cdot 10^{-157}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 1.6 \cdot 10^{-51}:\\
\;\;\;\;z \cdot \frac{y - x}{t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -2.59999999999999988e-157 or 1.6e-51 < x Initial program 93.5%
Taylor expanded in x around inf
*-lowering-*.f64N/A
mul-1-negN/A
unsub-negN/A
--lowering--.f64N/A
/-lowering-/.f6484.6%
Simplified84.6%
if -2.59999999999999988e-157 < x < 1.6e-51Initial program 96.6%
Taylor expanded in z around inf
div-subN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
--lowering--.f6471.1%
Simplified71.1%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* x (- 1.0 (/ z t))))) (if (<= x -2.65e-157) t_1 (if (<= x 2.65e-68) (/ (* z y) t) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = x * (1.0 - (z / t));
double tmp;
if (x <= -2.65e-157) {
tmp = t_1;
} else if (x <= 2.65e-68) {
tmp = (z * y) / t;
} else {
tmp = t_1;
}
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) :: t_1
real(8) :: tmp
t_1 = x * (1.0d0 - (z / t))
if (x <= (-2.65d-157)) then
tmp = t_1
else if (x <= 2.65d-68) then
tmp = (z * y) / t
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x * (1.0 - (z / t));
double tmp;
if (x <= -2.65e-157) {
tmp = t_1;
} else if (x <= 2.65e-68) {
tmp = (z * y) / t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (1.0 - (z / t)) tmp = 0 if x <= -2.65e-157: tmp = t_1 elif x <= 2.65e-68: tmp = (z * y) / t else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(1.0 - Float64(z / t))) tmp = 0.0 if (x <= -2.65e-157) tmp = t_1; elseif (x <= 2.65e-68) tmp = Float64(Float64(z * y) / t); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (1.0 - (z / t)); tmp = 0.0; if (x <= -2.65e-157) tmp = t_1; elseif (x <= 2.65e-68) tmp = (z * y) / t; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(1.0 - N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -2.65e-157], t$95$1, If[LessEqual[x, 2.65e-68], N[(N[(z * y), $MachinePrecision] / t), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(1 - \frac{z}{t}\right)\\
\mathbf{if}\;x \leq -2.65 \cdot 10^{-157}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 2.65 \cdot 10^{-68}:\\
\;\;\;\;\frac{z \cdot y}{t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -2.6500000000000001e-157 or 2.65e-68 < x Initial program 93.2%
Taylor expanded in x around inf
*-lowering-*.f64N/A
mul-1-negN/A
unsub-negN/A
--lowering--.f64N/A
/-lowering-/.f6483.4%
Simplified83.4%
if -2.6500000000000001e-157 < x < 2.65e-68Initial program 97.5%
Taylor expanded in x around 0
/-lowering-/.f64N/A
*-lowering-*.f6467.8%
Simplified67.8%
Final simplification78.1%
(FPCore (x y z t) :precision binary64 (if (<= t -1.1e+111) x (if (<= t 1.76e+43) (* (/ z t) y) x)))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1.1e+111) {
tmp = x;
} else if (t <= 1.76e+43) {
tmp = (z / t) * y;
} else {
tmp = x;
}
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 (t <= (-1.1d+111)) then
tmp = x
else if (t <= 1.76d+43) then
tmp = (z / t) * y
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1.1e+111) {
tmp = x;
} else if (t <= 1.76e+43) {
tmp = (z / t) * y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -1.1e+111: tmp = x elif t <= 1.76e+43: tmp = (z / t) * y else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -1.1e+111) tmp = x; elseif (t <= 1.76e+43) tmp = Float64(Float64(z / t) * y); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -1.1e+111) tmp = x; elseif (t <= 1.76e+43) tmp = (z / t) * y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -1.1e+111], x, If[LessEqual[t, 1.76e+43], N[(N[(z / t), $MachinePrecision] * y), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.1 \cdot 10^{+111}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq 1.76 \cdot 10^{+43}:\\
\;\;\;\;\frac{z}{t} \cdot y\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if t < -1.09999999999999999e111 or 1.7600000000000001e43 < t Initial program 89.7%
Taylor expanded in z around 0
Simplified72.6%
if -1.09999999999999999e111 < t < 1.7600000000000001e43Initial program 98.0%
Taylor expanded in x around 0
/-lowering-/.f64N/A
*-lowering-*.f6453.0%
Simplified53.0%
associate-/l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
/-lowering-/.f6453.4%
Applied egg-rr53.4%
(FPCore (x y z t) :precision binary64 (if (<= t -5.4e+110) x (if (<= t 2.4e+43) (* z (/ y t)) x)))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -5.4e+110) {
tmp = x;
} else if (t <= 2.4e+43) {
tmp = z * (y / t);
} else {
tmp = x;
}
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 (t <= (-5.4d+110)) then
tmp = x
else if (t <= 2.4d+43) then
tmp = z * (y / t)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= -5.4e+110) {
tmp = x;
} else if (t <= 2.4e+43) {
tmp = z * (y / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -5.4e+110: tmp = x elif t <= 2.4e+43: tmp = z * (y / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -5.4e+110) tmp = x; elseif (t <= 2.4e+43) tmp = Float64(z * Float64(y / t)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -5.4e+110) tmp = x; elseif (t <= 2.4e+43) tmp = z * (y / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -5.4e+110], x, If[LessEqual[t, 2.4e+43], N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -5.4 \cdot 10^{+110}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq 2.4 \cdot 10^{+43}:\\
\;\;\;\;z \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if t < -5.40000000000000019e110 or 2.40000000000000023e43 < t Initial program 89.7%
Taylor expanded in z around 0
Simplified72.6%
if -5.40000000000000019e110 < t < 2.40000000000000023e43Initial program 98.0%
Taylor expanded in x around 0
/-lowering-/.f64N/A
*-lowering-*.f6453.0%
Simplified53.0%
*-commutativeN/A
associate-/l*N/A
*-lowering-*.f64N/A
/-lowering-/.f6448.5%
Applied egg-rr48.5%
(FPCore (x y z t) :precision binary64 x)
double code(double x, double y, double z, double t) {
return x;
}
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
end function
public static double code(double x, double y, double z, double t) {
return x;
}
def code(x, y, z, t): return x
function code(x, y, z, t) return x end
function tmp = code(x, y, z, t) tmp = x; end
code[x_, y_, z_, t_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 94.6%
Taylor expanded in z around 0
Simplified39.9%
(FPCore (x y z t)
:precision binary64
(if (< x -9.025511195533005e-135)
(- x (* (/ z t) (- x y)))
(if (< x 4.275032163700715e-250)
(+ x (* (/ (- y x) t) z))
(+ x (/ (- y x) (/ t z))))))
double code(double x, double y, double z, double t) {
double tmp;
if (x < -9.025511195533005e-135) {
tmp = x - ((z / t) * (x - y));
} else if (x < 4.275032163700715e-250) {
tmp = x + (((y - x) / t) * z);
} else {
tmp = x + ((y - x) / (t / z));
}
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 < (-9.025511195533005d-135)) then
tmp = x - ((z / t) * (x - y))
else if (x < 4.275032163700715d-250) then
tmp = x + (((y - x) / t) * z)
else
tmp = x + ((y - x) / (t / z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x < -9.025511195533005e-135) {
tmp = x - ((z / t) * (x - y));
} else if (x < 4.275032163700715e-250) {
tmp = x + (((y - x) / t) * z);
} else {
tmp = x + ((y - x) / (t / z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x < -9.025511195533005e-135: tmp = x - ((z / t) * (x - y)) elif x < 4.275032163700715e-250: tmp = x + (((y - x) / t) * z) else: tmp = x + ((y - x) / (t / z)) return tmp
function code(x, y, z, t) tmp = 0.0 if (x < -9.025511195533005e-135) tmp = Float64(x - Float64(Float64(z / t) * Float64(x - y))); elseif (x < 4.275032163700715e-250) tmp = Float64(x + Float64(Float64(Float64(y - x) / t) * z)); else tmp = Float64(x + Float64(Float64(y - x) / Float64(t / z))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x < -9.025511195533005e-135) tmp = x - ((z / t) * (x - y)); elseif (x < 4.275032163700715e-250) tmp = x + (((y - x) / t) * z); else tmp = x + ((y - x) / (t / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Less[x, -9.025511195533005e-135], N[(x - N[(N[(z / t), $MachinePrecision] * N[(x - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Less[x, 4.275032163700715e-250], N[(x + N[(N[(N[(y - x), $MachinePrecision] / t), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y - x), $MachinePrecision] / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x < -9.025511195533005 \cdot 10^{-135}:\\
\;\;\;\;x - \frac{z}{t} \cdot \left(x - y\right)\\
\mathbf{elif}\;x < 4.275032163700715 \cdot 10^{-250}:\\
\;\;\;\;x + \frac{y - x}{t} \cdot z\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y - x}{\frac{t}{z}}\\
\end{array}
\end{array}
herbie shell --seed 2024152
(FPCore (x y z t)
:name "Numeric.Histogram:binBounds from Chart-1.5.3"
:precision binary64
:alt
(! :herbie-platform default (if (< x -1805102239106601/200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (- x (* (/ z t) (- x y))) (if (< x 855006432740143/2000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (+ x (* (/ (- y x) t) z)) (+ x (/ (- y x) (/ t z))))))
(+ x (/ (* (- y x) z) t)))