
(FPCore (x y z t a) :precision binary64 (+ x (/ (* (- y z) t) (- a z))))
double code(double x, double y, double z, double t, double a) {
return x + (((y - z) * t) / (a - z));
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x + (((y - z) * t) / (a - z))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (((y - z) * t) / (a - z));
}
def code(x, y, z, t, a): return x + (((y - z) * t) / (a - z))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(Float64(y - z) * t) / Float64(a - z))) end
function tmp = code(x, y, z, t, a) tmp = x + (((y - z) * t) / (a - z)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{\left(y - z\right) \cdot t}{a - z}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (+ x (/ (* (- y z) t) (- a z))))
double code(double x, double y, double z, double t, double a) {
return x + (((y - z) * t) / (a - z));
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x + (((y - z) * t) / (a - z))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (((y - z) * t) / (a - z));
}
def code(x, y, z, t, a): return x + (((y - z) * t) / (a - z))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(Float64(y - z) * t) / Float64(a - z))) end
function tmp = code(x, y, z, t, a) tmp = x + (((y - z) * t) / (a - z)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{\left(y - z\right) \cdot t}{a - z}
\end{array}
(FPCore (x y z t a) :precision binary64 (fma (/ t (- a z)) (- y z) x))
double code(double x, double y, double z, double t, double a) {
return fma((t / (a - z)), (y - z), x);
}
function code(x, y, z, t, a) return fma(Float64(t / Float64(a - z)), Float64(y - z), x) end
code[x_, y_, z_, t_, a_] := N[(N[(t / N[(a - z), $MachinePrecision]), $MachinePrecision] * N[(y - z), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\frac{t}{a - z}, y - z, x\right)
\end{array}
Initial program 88.9%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6498.0
Applied rewrites98.0%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (* t (/ y a))) (t_2 (/ (* t (- y z)) (- a z)))) (if (<= t_2 -2e+232) t_1 (if (<= t_2 2e+250) (+ t x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = t * (y / a);
double t_2 = (t * (y - z)) / (a - z);
double tmp;
if (t_2 <= -2e+232) {
tmp = t_1;
} else if (t_2 <= 2e+250) {
tmp = t + x;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = t * (y / a)
t_2 = (t * (y - z)) / (a - z)
if (t_2 <= (-2d+232)) then
tmp = t_1
else if (t_2 <= 2d+250) then
tmp = t + x
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = t * (y / a);
double t_2 = (t * (y - z)) / (a - z);
double tmp;
if (t_2 <= -2e+232) {
tmp = t_1;
} else if (t_2 <= 2e+250) {
tmp = t + x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = t * (y / a) t_2 = (t * (y - z)) / (a - z) tmp = 0 if t_2 <= -2e+232: tmp = t_1 elif t_2 <= 2e+250: tmp = t + x else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(t * Float64(y / a)) t_2 = Float64(Float64(t * Float64(y - z)) / Float64(a - z)) tmp = 0.0 if (t_2 <= -2e+232) tmp = t_1; elseif (t_2 <= 2e+250) tmp = Float64(t + x); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = t * (y / a); t_2 = (t * (y - z)) / (a - z); tmp = 0.0; if (t_2 <= -2e+232) tmp = t_1; elseif (t_2 <= 2e+250) tmp = t + x; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(t * N[(y - z), $MachinePrecision]), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -2e+232], t$95$1, If[LessEqual[t$95$2, 2e+250], N[(t + x), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t \cdot \frac{y}{a}\\
t_2 := \frac{t \cdot \left(y - z\right)}{a - z}\\
\mathbf{if}\;t\_2 \leq -2 \cdot 10^{+232}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+250}:\\
\;\;\;\;t + x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (/.f64 (*.f64 (-.f64 y z) t) (-.f64 a z)) < -2.00000000000000011e232 or 1.9999999999999998e250 < (/.f64 (*.f64 (-.f64 y z) t) (-.f64 a z)) Initial program 55.0%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6498.4
Applied rewrites98.4%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6458.3
Applied rewrites58.3%
Taylor expanded in t around inf
Applied rewrites56.4%
if -2.00000000000000011e232 < (/.f64 (*.f64 (-.f64 y z) t) (-.f64 a z)) < 1.9999999999999998e250Initial program 99.7%
Taylor expanded in z around inf
lower-+.f6469.8
Applied rewrites69.8%
Final simplification66.6%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (* y (/ t a))) (t_2 (/ (* t (- y z)) (- a z)))) (if (<= t_2 -5e+130) t_1 (if (<= t_2 2e+250) (+ t x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = y * (t / a);
double t_2 = (t * (y - z)) / (a - z);
double tmp;
if (t_2 <= -5e+130) {
tmp = t_1;
} else if (t_2 <= 2e+250) {
tmp = t + x;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = y * (t / a)
t_2 = (t * (y - z)) / (a - z)
if (t_2 <= (-5d+130)) then
tmp = t_1
else if (t_2 <= 2d+250) then
tmp = t + x
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = y * (t / a);
double t_2 = (t * (y - z)) / (a - z);
double tmp;
if (t_2 <= -5e+130) {
tmp = t_1;
} else if (t_2 <= 2e+250) {
tmp = t + x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = y * (t / a) t_2 = (t * (y - z)) / (a - z) tmp = 0 if t_2 <= -5e+130: tmp = t_1 elif t_2 <= 2e+250: tmp = t + x else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(y * Float64(t / a)) t_2 = Float64(Float64(t * Float64(y - z)) / Float64(a - z)) tmp = 0.0 if (t_2 <= -5e+130) tmp = t_1; elseif (t_2 <= 2e+250) tmp = Float64(t + x); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = y * (t / a); t_2 = (t * (y - z)) / (a - z); tmp = 0.0; if (t_2 <= -5e+130) tmp = t_1; elseif (t_2 <= 2e+250) tmp = t + x; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(y * N[(t / a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(t * N[(y - z), $MachinePrecision]), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -5e+130], t$95$1, If[LessEqual[t$95$2, 2e+250], N[(t + x), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \frac{t}{a}\\
t_2 := \frac{t \cdot \left(y - z\right)}{a - z}\\
\mathbf{if}\;t\_2 \leq -5 \cdot 10^{+130}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+250}:\\
\;\;\;\;t + x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (/.f64 (*.f64 (-.f64 y z) t) (-.f64 a z)) < -4.9999999999999996e130 or 1.9999999999999998e250 < (/.f64 (*.f64 (-.f64 y z) t) (-.f64 a z)) Initial program 59.6%
Taylor expanded in y around inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f6454.6
Applied rewrites54.6%
Applied rewrites70.5%
Taylor expanded in a around inf
Applied rewrites54.5%
if -4.9999999999999996e130 < (/.f64 (*.f64 (-.f64 y z) t) (-.f64 a z)) < 1.9999999999999998e250Initial program 99.7%
Taylor expanded in z around inf
lower-+.f6470.8
Applied rewrites70.8%
Final simplification66.4%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (/ (* t y) a)) (t_2 (/ (* t (- y z)) (- a z)))) (if (<= t_2 -5e+130) t_1 (if (<= t_2 2e+250) (+ t x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (t * y) / a;
double t_2 = (t * (y - z)) / (a - z);
double tmp;
if (t_2 <= -5e+130) {
tmp = t_1;
} else if (t_2 <= 2e+250) {
tmp = t + x;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = (t * y) / a
t_2 = (t * (y - z)) / (a - z)
if (t_2 <= (-5d+130)) then
tmp = t_1
else if (t_2 <= 2d+250) then
tmp = t + x
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (t * y) / a;
double t_2 = (t * (y - z)) / (a - z);
double tmp;
if (t_2 <= -5e+130) {
tmp = t_1;
} else if (t_2 <= 2e+250) {
tmp = t + x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (t * y) / a t_2 = (t * (y - z)) / (a - z) tmp = 0 if t_2 <= -5e+130: tmp = t_1 elif t_2 <= 2e+250: tmp = t + x else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(t * y) / a) t_2 = Float64(Float64(t * Float64(y - z)) / Float64(a - z)) tmp = 0.0 if (t_2 <= -5e+130) tmp = t_1; elseif (t_2 <= 2e+250) tmp = Float64(t + x); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (t * y) / a; t_2 = (t * (y - z)) / (a - z); tmp = 0.0; if (t_2 <= -5e+130) tmp = t_1; elseif (t_2 <= 2e+250) tmp = t + x; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(t * y), $MachinePrecision] / a), $MachinePrecision]}, Block[{t$95$2 = N[(N[(t * N[(y - z), $MachinePrecision]), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -5e+130], t$95$1, If[LessEqual[t$95$2, 2e+250], N[(t + x), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t \cdot y}{a}\\
t_2 := \frac{t \cdot \left(y - z\right)}{a - z}\\
\mathbf{if}\;t\_2 \leq -5 \cdot 10^{+130}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+250}:\\
\;\;\;\;t + x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (/.f64 (*.f64 (-.f64 y z) t) (-.f64 a z)) < -4.9999999999999996e130 or 1.9999999999999998e250 < (/.f64 (*.f64 (-.f64 y z) t) (-.f64 a z)) Initial program 59.6%
Taylor expanded in x around 0
lower-/.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower--.f6458.2
Applied rewrites58.2%
Taylor expanded in z around 0
Applied rewrites42.7%
if -4.9999999999999996e130 < (/.f64 (*.f64 (-.f64 y z) t) (-.f64 a z)) < 1.9999999999999998e250Initial program 99.7%
Taylor expanded in z around inf
lower-+.f6470.8
Applied rewrites70.8%
Final simplification63.2%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma t (- 1.0 (/ y z)) x)))
(if (<= z -4.2e-38)
t_1
(if (<= z 1e-69)
(+ x (/ (* t y) (- a z)))
(if (<= z 1.3e+36) (fma t (/ (- y z) a) x) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(t, (1.0 - (y / z)), x);
double tmp;
if (z <= -4.2e-38) {
tmp = t_1;
} else if (z <= 1e-69) {
tmp = x + ((t * y) / (a - z));
} else if (z <= 1.3e+36) {
tmp = fma(t, ((y - z) / a), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(t, Float64(1.0 - Float64(y / z)), x) tmp = 0.0 if (z <= -4.2e-38) tmp = t_1; elseif (z <= 1e-69) tmp = Float64(x + Float64(Float64(t * y) / Float64(a - z))); elseif (z <= 1.3e+36) tmp = fma(t, Float64(Float64(y - z) / a), x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(t * N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[z, -4.2e-38], t$95$1, If[LessEqual[z, 1e-69], N[(x + N[(N[(t * y), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.3e+36], N[(t * N[(N[(y - z), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(t, 1 - \frac{y}{z}, x\right)\\
\mathbf{if}\;z \leq -4.2 \cdot 10^{-38}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 10^{-69}:\\
\;\;\;\;x + \frac{t \cdot y}{a - z}\\
\mathbf{elif}\;z \leq 1.3 \cdot 10^{+36}:\\
\;\;\;\;\mathsf{fma}\left(t, \frac{y - z}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -4.20000000000000026e-38 or 1.3000000000000001e36 < z Initial program 84.2%
Taylor expanded in a around 0
+-commutativeN/A
mul-1-negN/A
associate-/l*N/A
distribute-rgt-neg-inN/A
lower-fma.f64N/A
neg-sub0N/A
div-subN/A
*-inversesN/A
associate-+l-N/A
neg-sub0N/A
mul-1-negN/A
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
lower-/.f6485.2
Applied rewrites85.2%
if -4.20000000000000026e-38 < z < 9.9999999999999996e-70Initial program 95.4%
Taylor expanded in y around inf
lower-*.f6491.1
Applied rewrites91.1%
if 9.9999999999999996e-70 < z < 1.3000000000000001e36Initial program 84.2%
Taylor expanded in a around inf
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6497.1
Applied rewrites97.1%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma t (/ (- y z) a) x)))
(if (<= a -4.8e-54)
t_1
(if (<= a 1.34e-86) (fma t (- 1.0 (/ y z)) x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(t, ((y - z) / a), x);
double tmp;
if (a <= -4.8e-54) {
tmp = t_1;
} else if (a <= 1.34e-86) {
tmp = fma(t, (1.0 - (y / z)), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(t, Float64(Float64(y - z) / a), x) tmp = 0.0 if (a <= -4.8e-54) tmp = t_1; elseif (a <= 1.34e-86) tmp = fma(t, Float64(1.0 - Float64(y / z)), x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(t * N[(N[(y - z), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[a, -4.8e-54], t$95$1, If[LessEqual[a, 1.34e-86], N[(t * N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(t, \frac{y - z}{a}, x\right)\\
\mathbf{if}\;a \leq -4.8 \cdot 10^{-54}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 1.34 \cdot 10^{-86}:\\
\;\;\;\;\mathsf{fma}\left(t, 1 - \frac{y}{z}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -4.80000000000000026e-54 or 1.34e-86 < a Initial program 83.7%
Taylor expanded in a around inf
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6484.1
Applied rewrites84.1%
if -4.80000000000000026e-54 < a < 1.34e-86Initial program 96.1%
Taylor expanded in a around 0
+-commutativeN/A
mul-1-negN/A
associate-/l*N/A
distribute-rgt-neg-inN/A
lower-fma.f64N/A
neg-sub0N/A
div-subN/A
*-inversesN/A
associate-+l-N/A
neg-sub0N/A
mul-1-negN/A
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
lower-/.f6488.3
Applied rewrites88.3%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (fma t (- 1.0 (/ y z)) x))) (if (<= z -3.7e-38) t_1 (if (<= z 1.3e+36) (fma y (/ t a) x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(t, (1.0 - (y / z)), x);
double tmp;
if (z <= -3.7e-38) {
tmp = t_1;
} else if (z <= 1.3e+36) {
tmp = fma(y, (t / a), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(t, Float64(1.0 - Float64(y / z)), x) tmp = 0.0 if (z <= -3.7e-38) tmp = t_1; elseif (z <= 1.3e+36) tmp = fma(y, Float64(t / a), x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(t * N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[z, -3.7e-38], t$95$1, If[LessEqual[z, 1.3e+36], N[(y * N[(t / a), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(t, 1 - \frac{y}{z}, x\right)\\
\mathbf{if}\;z \leq -3.7 \cdot 10^{-38}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.3 \cdot 10^{+36}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{t}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -3.7e-38 or 1.3000000000000001e36 < z Initial program 84.2%
Taylor expanded in a around 0
+-commutativeN/A
mul-1-negN/A
associate-/l*N/A
distribute-rgt-neg-inN/A
lower-fma.f64N/A
neg-sub0N/A
div-subN/A
*-inversesN/A
associate-+l-N/A
neg-sub0N/A
mul-1-negN/A
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
lower-/.f6485.2
Applied rewrites85.2%
if -3.7e-38 < z < 1.3000000000000001e36Initial program 93.3%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6482.2
Applied rewrites82.2%
(FPCore (x y z t a) :precision binary64 (if (<= z -0.00135) (+ t x) (if (<= z 6.5e+36) (fma y (/ t a) x) (+ t x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -0.00135) {
tmp = t + x;
} else if (z <= 6.5e+36) {
tmp = fma(y, (t / a), x);
} else {
tmp = t + x;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -0.00135) tmp = Float64(t + x); elseif (z <= 6.5e+36) tmp = fma(y, Float64(t / a), x); else tmp = Float64(t + x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -0.00135], N[(t + x), $MachinePrecision], If[LessEqual[z, 6.5e+36], N[(y * N[(t / a), $MachinePrecision] + x), $MachinePrecision], N[(t + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.00135:\\
\;\;\;\;t + x\\
\mathbf{elif}\;z \leq 6.5 \cdot 10^{+36}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{t}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t + x\\
\end{array}
\end{array}
if z < -0.0013500000000000001 or 6.4999999999999998e36 < z Initial program 83.2%
Taylor expanded in z around inf
lower-+.f6478.0
Applied rewrites78.0%
if -0.0013500000000000001 < z < 6.4999999999999998e36Initial program 93.3%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6480.4
Applied rewrites80.4%
(FPCore (x y z t a) :precision binary64 (+ t x))
double code(double x, double y, double z, double t, double a) {
return t + x;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = t + x
end function
public static double code(double x, double y, double z, double t, double a) {
return t + x;
}
def code(x, y, z, t, a): return t + x
function code(x, y, z, t, a) return Float64(t + x) end
function tmp = code(x, y, z, t, a) tmp = t + x; end
code[x_, y_, z_, t_, a_] := N[(t + x), $MachinePrecision]
\begin{array}{l}
\\
t + x
\end{array}
Initial program 88.9%
Taylor expanded in z around inf
lower-+.f6458.1
Applied rewrites58.1%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (* (/ (- y z) (- a z)) t))))
(if (< t -1.0682974490174067e-39)
t_1
(if (< t 3.9110949887586375e-141) (+ x (/ (* (- y z) t) (- a z))) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x + (((y - z) / (a - z)) * t);
double tmp;
if (t < -1.0682974490174067e-39) {
tmp = t_1;
} else if (t < 3.9110949887586375e-141) {
tmp = x + (((y - z) * t) / (a - z));
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = x + (((y - z) / (a - z)) * t)
if (t < (-1.0682974490174067d-39)) then
tmp = t_1
else if (t < 3.9110949887586375d-141) then
tmp = x + (((y - z) * t) / (a - z))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = x + (((y - z) / (a - z)) * t);
double tmp;
if (t < -1.0682974490174067e-39) {
tmp = t_1;
} else if (t < 3.9110949887586375e-141) {
tmp = x + (((y - z) * t) / (a - z));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x + (((y - z) / (a - z)) * t) tmp = 0 if t < -1.0682974490174067e-39: tmp = t_1 elif t < 3.9110949887586375e-141: tmp = x + (((y - z) * t) / (a - z)) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(x + Float64(Float64(Float64(y - z) / Float64(a - z)) * t)) tmp = 0.0 if (t < -1.0682974490174067e-39) tmp = t_1; elseif (t < 3.9110949887586375e-141) tmp = Float64(x + Float64(Float64(Float64(y - z) * t) / Float64(a - z))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x + (((y - z) / (a - z)) * t); tmp = 0.0; if (t < -1.0682974490174067e-39) tmp = t_1; elseif (t < 3.9110949887586375e-141) tmp = x + (((y - z) * t) / (a - z)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(N[(N[(y - z), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]}, If[Less[t, -1.0682974490174067e-39], t$95$1, If[Less[t, 3.9110949887586375e-141], N[(x + N[(N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \frac{y - z}{a - z} \cdot t\\
\mathbf{if}\;t < -1.0682974490174067 \cdot 10^{-39}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t < 3.9110949887586375 \cdot 10^{-141}:\\
\;\;\;\;x + \frac{\left(y - z\right) \cdot t}{a - z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
herbie shell --seed 2024238
(FPCore (x y z t a)
:name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisTick from plot-0.2.3.4, A"
:precision binary64
:alt
(! :herbie-platform default (if (< t -10682974490174067/10000000000000000000000000000000000000000000000000000000) (+ x (* (/ (- y z) (- a z)) t)) (if (< t 312887599100691/80000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (+ x (/ (* (- y z) t) (- a z))) (+ x (* (/ (- y z) (- a z)) t)))))
(+ x (/ (* (- y z) t) (- a z))))