
(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 12 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 (fma (/ z t) (- y x) x))
double code(double x, double y, double z, double t) {
return fma((z / t), (y - x), x);
}
function code(x, y, z, t) return fma(Float64(z / t), Float64(y - x), x) end
code[x_, y_, z_, t_] := N[(N[(z / t), $MachinePrecision] * N[(y - x), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\frac{z}{t}, y - x, x\right)
\end{array}
Initial program 95.3%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6497.4
Applied rewrites97.4%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (+ (/ (* (- y x) z) t) x)) (t_2 (* y (/ z t)))) (if (<= t_1 -5e+43) t_2 (if (<= t_1 2e+151) (/ (* x t) t) t_2))))
double code(double x, double y, double z, double t) {
double t_1 = (((y - x) * z) / t) + x;
double t_2 = y * (z / t);
double tmp;
if (t_1 <= -5e+43) {
tmp = t_2;
} else if (t_1 <= 2e+151) {
tmp = (x * t) / t;
} else {
tmp = t_2;
}
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) :: t_2
real(8) :: tmp
t_1 = (((y - x) * z) / t) + x
t_2 = y * (z / t)
if (t_1 <= (-5d+43)) then
tmp = t_2
else if (t_1 <= 2d+151) then
tmp = (x * t) / t
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (((y - x) * z) / t) + x;
double t_2 = y * (z / t);
double tmp;
if (t_1 <= -5e+43) {
tmp = t_2;
} else if (t_1 <= 2e+151) {
tmp = (x * t) / t;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t): t_1 = (((y - x) * z) / t) + x t_2 = y * (z / t) tmp = 0 if t_1 <= -5e+43: tmp = t_2 elif t_1 <= 2e+151: tmp = (x * t) / t else: tmp = t_2 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(Float64(Float64(y - x) * z) / t) + x) t_2 = Float64(y * Float64(z / t)) tmp = 0.0 if (t_1 <= -5e+43) tmp = t_2; elseif (t_1 <= 2e+151) tmp = Float64(Float64(x * t) / t); else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (((y - x) * z) / t) + x; t_2 = y * (z / t); tmp = 0.0; if (t_1 <= -5e+43) tmp = t_2; elseif (t_1 <= 2e+151) tmp = (x * t) / t; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision] / t), $MachinePrecision] + x), $MachinePrecision]}, Block[{t$95$2 = N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -5e+43], t$95$2, If[LessEqual[t$95$1, 2e+151], N[(N[(x * t), $MachinePrecision] / t), $MachinePrecision], t$95$2]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\left(y - x\right) \cdot z}{t} + x\\
t_2 := y \cdot \frac{z}{t}\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+43}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+151}:\\
\;\;\;\;\frac{x \cdot t}{t}\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (+.f64 x (/.f64 (*.f64 (-.f64 y x) z) t)) < -5.0000000000000004e43 or 2.00000000000000003e151 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) z) t)) Initial program 93.0%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6497.3
Applied rewrites97.3%
Taylor expanded in y around inf
*-commutativeN/A
associate-*l/N/A
lower-*.f64N/A
lower-/.f6446.3
Applied rewrites46.3%
if -5.0000000000000004e43 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) z) t)) < 2.00000000000000003e151Initial program 98.5%
Taylor expanded in t around 0
lower-/.f64N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f6494.7
Applied rewrites94.7%
Taylor expanded in t around inf
Applied rewrites58.2%
Final simplification51.2%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (+ (/ (* (- y x) z) t) x)))
(if (<= t_1 -5e+43)
(/ (* y z) t)
(if (<= t_1 2e+151) (/ (* x t) t) (* (/ y t) z)))))
double code(double x, double y, double z, double t) {
double t_1 = (((y - x) * z) / t) + x;
double tmp;
if (t_1 <= -5e+43) {
tmp = (y * z) / t;
} else if (t_1 <= 2e+151) {
tmp = (x * t) / t;
} else {
tmp = (y / 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) :: t_1
real(8) :: tmp
t_1 = (((y - x) * z) / t) + x
if (t_1 <= (-5d+43)) then
tmp = (y * z) / t
else if (t_1 <= 2d+151) then
tmp = (x * t) / t
else
tmp = (y / t) * z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (((y - x) * z) / t) + x;
double tmp;
if (t_1 <= -5e+43) {
tmp = (y * z) / t;
} else if (t_1 <= 2e+151) {
tmp = (x * t) / t;
} else {
tmp = (y / t) * z;
}
return tmp;
}
def code(x, y, z, t): t_1 = (((y - x) * z) / t) + x tmp = 0 if t_1 <= -5e+43: tmp = (y * z) / t elif t_1 <= 2e+151: tmp = (x * t) / t else: tmp = (y / t) * z return tmp
function code(x, y, z, t) t_1 = Float64(Float64(Float64(Float64(y - x) * z) / t) + x) tmp = 0.0 if (t_1 <= -5e+43) tmp = Float64(Float64(y * z) / t); elseif (t_1 <= 2e+151) tmp = Float64(Float64(x * t) / t); else tmp = Float64(Float64(y / t) * z); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (((y - x) * z) / t) + x; tmp = 0.0; if (t_1 <= -5e+43) tmp = (y * z) / t; elseif (t_1 <= 2e+151) tmp = (x * t) / t; else tmp = (y / t) * z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision] / t), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[t$95$1, -5e+43], N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[t$95$1, 2e+151], N[(N[(x * t), $MachinePrecision] / t), $MachinePrecision], N[(N[(y / t), $MachinePrecision] * z), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\left(y - x\right) \cdot z}{t} + x\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+43}:\\
\;\;\;\;\frac{y \cdot z}{t}\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+151}:\\
\;\;\;\;\frac{x \cdot t}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{t} \cdot z\\
\end{array}
\end{array}
if (+.f64 x (/.f64 (*.f64 (-.f64 y x) z) t)) < -5.0000000000000004e43Initial program 96.3%
Taylor expanded in y around inf
associate-*l/N/A
lower-*.f64N/A
lower-/.f6440.2
Applied rewrites40.2%
Applied rewrites43.7%
if -5.0000000000000004e43 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) z) t)) < 2.00000000000000003e151Initial program 98.5%
Taylor expanded in t around 0
lower-/.f64N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f6494.7
Applied rewrites94.7%
Taylor expanded in t around inf
Applied rewrites58.2%
if 2.00000000000000003e151 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) z) t)) Initial program 89.3%
Taylor expanded in y around inf
associate-*l/N/A
lower-*.f64N/A
lower-/.f6439.5
Applied rewrites39.5%
Final simplification48.6%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ (* x t) t)))
(if (<= x -1.8e+55)
(* (/ (- x) t) z)
(if (<= x -1.2e-165)
t_1
(if (<= x 4.1e-94)
(/ (* y z) t)
(if (<= x 9.5e+69) t_1 (* (- x) (/ z t))))))))
double code(double x, double y, double z, double t) {
double t_1 = (x * t) / t;
double tmp;
if (x <= -1.8e+55) {
tmp = (-x / t) * z;
} else if (x <= -1.2e-165) {
tmp = t_1;
} else if (x <= 4.1e-94) {
tmp = (y * z) / t;
} else if (x <= 9.5e+69) {
tmp = t_1;
} else {
tmp = -x * (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) :: t_1
real(8) :: tmp
t_1 = (x * t) / t
if (x <= (-1.8d+55)) then
tmp = (-x / t) * z
else if (x <= (-1.2d-165)) then
tmp = t_1
else if (x <= 4.1d-94) then
tmp = (y * z) / t
else if (x <= 9.5d+69) then
tmp = t_1
else
tmp = -x * (z / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (x * t) / t;
double tmp;
if (x <= -1.8e+55) {
tmp = (-x / t) * z;
} else if (x <= -1.2e-165) {
tmp = t_1;
} else if (x <= 4.1e-94) {
tmp = (y * z) / t;
} else if (x <= 9.5e+69) {
tmp = t_1;
} else {
tmp = -x * (z / t);
}
return tmp;
}
def code(x, y, z, t): t_1 = (x * t) / t tmp = 0 if x <= -1.8e+55: tmp = (-x / t) * z elif x <= -1.2e-165: tmp = t_1 elif x <= 4.1e-94: tmp = (y * z) / t elif x <= 9.5e+69: tmp = t_1 else: tmp = -x * (z / t) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x * t) / t) tmp = 0.0 if (x <= -1.8e+55) tmp = Float64(Float64(Float64(-x) / t) * z); elseif (x <= -1.2e-165) tmp = t_1; elseif (x <= 4.1e-94) tmp = Float64(Float64(y * z) / t); elseif (x <= 9.5e+69) tmp = t_1; else tmp = Float64(Float64(-x) * Float64(z / t)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x * t) / t; tmp = 0.0; if (x <= -1.8e+55) tmp = (-x / t) * z; elseif (x <= -1.2e-165) tmp = t_1; elseif (x <= 4.1e-94) tmp = (y * z) / t; elseif (x <= 9.5e+69) tmp = t_1; else tmp = -x * (z / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x * t), $MachinePrecision] / t), $MachinePrecision]}, If[LessEqual[x, -1.8e+55], N[(N[((-x) / t), $MachinePrecision] * z), $MachinePrecision], If[LessEqual[x, -1.2e-165], t$95$1, If[LessEqual[x, 4.1e-94], N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[x, 9.5e+69], t$95$1, N[((-x) * N[(z / t), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x \cdot t}{t}\\
\mathbf{if}\;x \leq -1.8 \cdot 10^{+55}:\\
\;\;\;\;\frac{-x}{t} \cdot z\\
\mathbf{elif}\;x \leq -1.2 \cdot 10^{-165}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 4.1 \cdot 10^{-94}:\\
\;\;\;\;\frac{y \cdot z}{t}\\
\mathbf{elif}\;x \leq 9.5 \cdot 10^{+69}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\left(-x\right) \cdot \frac{z}{t}\\
\end{array}
\end{array}
if x < -1.79999999999999994e55Initial program 93.9%
Taylor expanded in t around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f6449.4
Applied rewrites49.4%
Taylor expanded in y around 0
Applied rewrites51.2%
if -1.79999999999999994e55 < x < -1.2000000000000001e-165 or 4.10000000000000001e-94 < x < 9.4999999999999995e69Initial program 96.0%
Taylor expanded in t around 0
lower-/.f64N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f6495.9
Applied rewrites95.9%
Taylor expanded in t around inf
Applied rewrites53.3%
if -1.2000000000000001e-165 < x < 4.10000000000000001e-94Initial program 97.0%
Taylor expanded in y around inf
associate-*l/N/A
lower-*.f64N/A
lower-/.f6465.3
Applied rewrites65.3%
Applied rewrites70.0%
if 9.4999999999999995e69 < x Initial program 92.9%
Taylor expanded in t around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f6452.8
Applied rewrites52.8%
Taylor expanded in y around 0
Applied rewrites48.6%
Applied rewrites52.0%
Final simplification57.7%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ (* x t) t)) (t_2 (* (/ (- x) t) z)))
(if (<= x -1.8e+55)
t_2
(if (<= x -1.2e-165)
t_1
(if (<= x 4.1e-94) (/ (* y z) t) (if (<= x 9.5e+69) t_1 t_2))))))
double code(double x, double y, double z, double t) {
double t_1 = (x * t) / t;
double t_2 = (-x / t) * z;
double tmp;
if (x <= -1.8e+55) {
tmp = t_2;
} else if (x <= -1.2e-165) {
tmp = t_1;
} else if (x <= 4.1e-94) {
tmp = (y * z) / t;
} else if (x <= 9.5e+69) {
tmp = t_1;
} else {
tmp = t_2;
}
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) :: t_2
real(8) :: tmp
t_1 = (x * t) / t
t_2 = (-x / t) * z
if (x <= (-1.8d+55)) then
tmp = t_2
else if (x <= (-1.2d-165)) then
tmp = t_1
else if (x <= 4.1d-94) then
tmp = (y * z) / t
else if (x <= 9.5d+69) then
tmp = t_1
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (x * t) / t;
double t_2 = (-x / t) * z;
double tmp;
if (x <= -1.8e+55) {
tmp = t_2;
} else if (x <= -1.2e-165) {
tmp = t_1;
} else if (x <= 4.1e-94) {
tmp = (y * z) / t;
} else if (x <= 9.5e+69) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x * t) / t t_2 = (-x / t) * z tmp = 0 if x <= -1.8e+55: tmp = t_2 elif x <= -1.2e-165: tmp = t_1 elif x <= 4.1e-94: tmp = (y * z) / t elif x <= 9.5e+69: tmp = t_1 else: tmp = t_2 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x * t) / t) t_2 = Float64(Float64(Float64(-x) / t) * z) tmp = 0.0 if (x <= -1.8e+55) tmp = t_2; elseif (x <= -1.2e-165) tmp = t_1; elseif (x <= 4.1e-94) tmp = Float64(Float64(y * z) / t); elseif (x <= 9.5e+69) tmp = t_1; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x * t) / t; t_2 = (-x / t) * z; tmp = 0.0; if (x <= -1.8e+55) tmp = t_2; elseif (x <= -1.2e-165) tmp = t_1; elseif (x <= 4.1e-94) tmp = (y * z) / t; elseif (x <= 9.5e+69) tmp = t_1; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x * t), $MachinePrecision] / t), $MachinePrecision]}, Block[{t$95$2 = N[(N[((-x) / t), $MachinePrecision] * z), $MachinePrecision]}, If[LessEqual[x, -1.8e+55], t$95$2, If[LessEqual[x, -1.2e-165], t$95$1, If[LessEqual[x, 4.1e-94], N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[x, 9.5e+69], t$95$1, t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x \cdot t}{t}\\
t_2 := \frac{-x}{t} \cdot z\\
\mathbf{if}\;x \leq -1.8 \cdot 10^{+55}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;x \leq -1.2 \cdot 10^{-165}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 4.1 \cdot 10^{-94}:\\
\;\;\;\;\frac{y \cdot z}{t}\\
\mathbf{elif}\;x \leq 9.5 \cdot 10^{+69}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if x < -1.79999999999999994e55 or 9.4999999999999995e69 < x Initial program 93.4%
Taylor expanded in t around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f6451.2
Applied rewrites51.2%
Taylor expanded in y around 0
Applied rewrites51.4%
if -1.79999999999999994e55 < x < -1.2000000000000001e-165 or 4.10000000000000001e-94 < x < 9.4999999999999995e69Initial program 96.0%
Taylor expanded in t around 0
lower-/.f64N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f6495.9
Applied rewrites95.9%
Taylor expanded in t around inf
Applied rewrites53.3%
if -1.2000000000000001e-165 < x < 4.10000000000000001e-94Initial program 97.0%
Taylor expanded in y around inf
associate-*l/N/A
lower-*.f64N/A
lower-/.f6465.3
Applied rewrites65.3%
Applied rewrites70.0%
Final simplification57.6%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (fma (/ z t) (- x) x))) (if (<= x -9e+17) t_1 (if (<= x 0.000175) (+ (/ (* y z) t) x) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = fma((z / t), -x, x);
double tmp;
if (x <= -9e+17) {
tmp = t_1;
} else if (x <= 0.000175) {
tmp = ((y * z) / t) + x;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = fma(Float64(z / t), Float64(-x), x) tmp = 0.0 if (x <= -9e+17) tmp = t_1; elseif (x <= 0.000175) tmp = Float64(Float64(Float64(y * z) / t) + x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(z / t), $MachinePrecision] * (-x) + x), $MachinePrecision]}, If[LessEqual[x, -9e+17], t$95$1, If[LessEqual[x, 0.000175], N[(N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{z}{t}, -x, x\right)\\
\mathbf{if}\;x \leq -9 \cdot 10^{+17}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 0.000175:\\
\;\;\;\;\frac{y \cdot z}{t} + x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -9e17 or 1.74999999999999998e-4 < x Initial program 94.6%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6499.9
Applied rewrites99.9%
Taylor expanded in y around 0
mul-1-negN/A
lower-neg.f6495.0
Applied rewrites95.0%
if -9e17 < x < 1.74999999999999998e-4Initial program 95.9%
Taylor expanded in y around inf
lower-*.f6484.3
Applied rewrites84.3%
Final simplification89.4%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (- x (* (/ x t) z)))) (if (<= x -9e+17) t_1 (if (<= x 0.000175) (+ (/ (* y z) t) x) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = x - ((x / t) * z);
double tmp;
if (x <= -9e+17) {
tmp = t_1;
} else if (x <= 0.000175) {
tmp = ((y * z) / t) + x;
} 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 - ((x / t) * z)
if (x <= (-9d+17)) then
tmp = t_1
else if (x <= 0.000175d0) then
tmp = ((y * z) / 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 t_1 = x - ((x / t) * z);
double tmp;
if (x <= -9e+17) {
tmp = t_1;
} else if (x <= 0.000175) {
tmp = ((y * z) / t) + x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x - ((x / t) * z) tmp = 0 if x <= -9e+17: tmp = t_1 elif x <= 0.000175: tmp = ((y * z) / t) + x else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x - Float64(Float64(x / t) * z)) tmp = 0.0 if (x <= -9e+17) tmp = t_1; elseif (x <= 0.000175) tmp = Float64(Float64(Float64(y * z) / t) + x); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x - ((x / t) * z); tmp = 0.0; if (x <= -9e+17) tmp = t_1; elseif (x <= 0.000175) tmp = ((y * z) / t) + x; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x - N[(N[(x / t), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -9e+17], t$95$1, If[LessEqual[x, 0.000175], N[(N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x - \frac{x}{t} \cdot z\\
\mathbf{if}\;x \leq -9 \cdot 10^{+17}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 0.000175:\\
\;\;\;\;\frac{y \cdot z}{t} + x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -9e17 or 1.74999999999999998e-4 < x Initial program 94.6%
Taylor expanded in y around 0
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
associate-*l/N/A
lower-*.f64N/A
lower-/.f6493.4
Applied rewrites93.4%
if -9e17 < x < 1.74999999999999998e-4Initial program 95.9%
Taylor expanded in y around inf
lower-*.f6484.3
Applied rewrites84.3%
Final simplification88.6%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (- x (* (/ x t) z)))) (if (<= x -9.5e-166) t_1 (if (<= x 4.1e-94) (/ (* (- y x) z) t) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = x - ((x / t) * z);
double tmp;
if (x <= -9.5e-166) {
tmp = t_1;
} else if (x <= 4.1e-94) {
tmp = ((y - x) * z) / 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 - ((x / t) * z)
if (x <= (-9.5d-166)) then
tmp = t_1
else if (x <= 4.1d-94) then
tmp = ((y - x) * z) / 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 - ((x / t) * z);
double tmp;
if (x <= -9.5e-166) {
tmp = t_1;
} else if (x <= 4.1e-94) {
tmp = ((y - x) * z) / t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x - ((x / t) * z) tmp = 0 if x <= -9.5e-166: tmp = t_1 elif x <= 4.1e-94: tmp = ((y - x) * z) / t else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x - Float64(Float64(x / t) * z)) tmp = 0.0 if (x <= -9.5e-166) tmp = t_1; elseif (x <= 4.1e-94) tmp = Float64(Float64(Float64(y - x) * z) / t); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x - ((x / t) * z); tmp = 0.0; if (x <= -9.5e-166) tmp = t_1; elseif (x <= 4.1e-94) tmp = ((y - x) * z) / t; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x - N[(N[(x / t), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -9.5e-166], t$95$1, If[LessEqual[x, 4.1e-94], N[(N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision] / t), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x - \frac{x}{t} \cdot z\\
\mathbf{if}\;x \leq -9.5 \cdot 10^{-166}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 4.1 \cdot 10^{-94}:\\
\;\;\;\;\frac{\left(y - x\right) \cdot z}{t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -9.50000000000000046e-166 or 4.10000000000000001e-94 < x Initial program 94.6%
Taylor expanded in y around 0
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
associate-*l/N/A
lower-*.f64N/A
lower-/.f6484.6
Applied rewrites84.6%
if -9.50000000000000046e-166 < x < 4.10000000000000001e-94Initial program 97.0%
Taylor expanded in t around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f6476.7
Applied rewrites76.7%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (- x (* (/ x t) z)))) (if (<= x -9e-37) t_1 (if (<= x 6.8e-96) (* (- y x) (/ z t)) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = x - ((x / t) * z);
double tmp;
if (x <= -9e-37) {
tmp = t_1;
} else if (x <= 6.8e-96) {
tmp = (y - x) * (z / 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 - ((x / t) * z)
if (x <= (-9d-37)) then
tmp = t_1
else if (x <= 6.8d-96) then
tmp = (y - x) * (z / 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 - ((x / t) * z);
double tmp;
if (x <= -9e-37) {
tmp = t_1;
} else if (x <= 6.8e-96) {
tmp = (y - x) * (z / t);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x - ((x / t) * z) tmp = 0 if x <= -9e-37: tmp = t_1 elif x <= 6.8e-96: tmp = (y - x) * (z / t) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x - Float64(Float64(x / t) * z)) tmp = 0.0 if (x <= -9e-37) tmp = t_1; elseif (x <= 6.8e-96) tmp = Float64(Float64(y - x) * Float64(z / t)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x - ((x / t) * z); tmp = 0.0; if (x <= -9e-37) tmp = t_1; elseif (x <= 6.8e-96) tmp = (y - x) * (z / t); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x - N[(N[(x / t), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -9e-37], t$95$1, If[LessEqual[x, 6.8e-96], N[(N[(y - x), $MachinePrecision] * N[(z / t), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x - \frac{x}{t} \cdot z\\
\mathbf{if}\;x \leq -9 \cdot 10^{-37}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 6.8 \cdot 10^{-96}:\\
\;\;\;\;\left(y - x\right) \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -9.00000000000000081e-37 or 6.8000000000000002e-96 < x Initial program 95.9%
Taylor expanded in y around 0
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
associate-*l/N/A
lower-*.f64N/A
lower-/.f6488.4
Applied rewrites88.4%
if -9.00000000000000081e-37 < x < 6.8000000000000002e-96Initial program 94.4%
Taylor expanded in t around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f6470.6
Applied rewrites70.6%
Applied rewrites69.7%
Final simplification81.3%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* (- y x) (/ z t)))) (if (<= z -1.75e-211) t_1 (if (<= z 2.7e-184) (/ (* x t) t) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = (y - x) * (z / t);
double tmp;
if (z <= -1.75e-211) {
tmp = t_1;
} else if (z <= 2.7e-184) {
tmp = (x * t) / 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 = (y - x) * (z / t)
if (z <= (-1.75d-211)) then
tmp = t_1
else if (z <= 2.7d-184) then
tmp = (x * t) / 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 = (y - x) * (z / t);
double tmp;
if (z <= -1.75e-211) {
tmp = t_1;
} else if (z <= 2.7e-184) {
tmp = (x * t) / t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (y - x) * (z / t) tmp = 0 if z <= -1.75e-211: tmp = t_1 elif z <= 2.7e-184: tmp = (x * t) / t else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(y - x) * Float64(z / t)) tmp = 0.0 if (z <= -1.75e-211) tmp = t_1; elseif (z <= 2.7e-184) tmp = Float64(Float64(x * t) / t); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (y - x) * (z / t); tmp = 0.0; if (z <= -1.75e-211) tmp = t_1; elseif (z <= 2.7e-184) tmp = (x * t) / t; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(y - x), $MachinePrecision] * N[(z / t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.75e-211], t$95$1, If[LessEqual[z, 2.7e-184], N[(N[(x * t), $MachinePrecision] / t), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(y - x\right) \cdot \frac{z}{t}\\
\mathbf{if}\;z \leq -1.75 \cdot 10^{-211}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 2.7 \cdot 10^{-184}:\\
\;\;\;\;\frac{x \cdot t}{t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.75e-211 or 2.7000000000000001e-184 < z Initial program 94.3%
Taylor expanded in t around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f6466.1
Applied rewrites66.1%
Applied rewrites67.7%
if -1.75e-211 < z < 2.7000000000000001e-184Initial program 99.4%
Taylor expanded in t around 0
lower-/.f64N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f6487.9
Applied rewrites87.9%
Taylor expanded in t around inf
Applied rewrites70.7%
Final simplification68.3%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* (/ y t) z))) (if (<= z -6.5e-129) t_1 (if (<= z 1.15e-44) (/ (* x t) t) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = (y / t) * z;
double tmp;
if (z <= -6.5e-129) {
tmp = t_1;
} else if (z <= 1.15e-44) {
tmp = (x * t) / 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 = (y / t) * z
if (z <= (-6.5d-129)) then
tmp = t_1
else if (z <= 1.15d-44) then
tmp = (x * t) / 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 = (y / t) * z;
double tmp;
if (z <= -6.5e-129) {
tmp = t_1;
} else if (z <= 1.15e-44) {
tmp = (x * t) / t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (y / t) * z tmp = 0 if z <= -6.5e-129: tmp = t_1 elif z <= 1.15e-44: tmp = (x * t) / t else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(y / t) * z) tmp = 0.0 if (z <= -6.5e-129) tmp = t_1; elseif (z <= 1.15e-44) tmp = Float64(Float64(x * t) / t); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (y / t) * z; tmp = 0.0; if (z <= -6.5e-129) tmp = t_1; elseif (z <= 1.15e-44) tmp = (x * t) / t; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(y / t), $MachinePrecision] * z), $MachinePrecision]}, If[LessEqual[z, -6.5e-129], t$95$1, If[LessEqual[z, 1.15e-44], N[(N[(x * t), $MachinePrecision] / t), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y}{t} \cdot z\\
\mathbf{if}\;z \leq -6.5 \cdot 10^{-129}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.15 \cdot 10^{-44}:\\
\;\;\;\;\frac{x \cdot t}{t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -6.49999999999999952e-129 or 1.14999999999999999e-44 < z Initial program 93.1%
Taylor expanded in y around inf
associate-*l/N/A
lower-*.f64N/A
lower-/.f6445.3
Applied rewrites45.3%
if -6.49999999999999952e-129 < z < 1.14999999999999999e-44Initial program 98.5%
Taylor expanded in t around 0
lower-/.f64N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f6483.3
Applied rewrites83.3%
Taylor expanded in t around inf
Applied rewrites51.1%
Final simplification47.7%
(FPCore (x y z t) :precision binary64 (* (/ y t) z))
double code(double x, double y, double z, double t) {
return (y / t) * 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 = (y / t) * z
end function
public static double code(double x, double y, double z, double t) {
return (y / t) * z;
}
def code(x, y, z, t): return (y / t) * z
function code(x, y, z, t) return Float64(Float64(y / t) * z) end
function tmp = code(x, y, z, t) tmp = (y / t) * z; end
code[x_, y_, z_, t_] := N[(N[(y / t), $MachinePrecision] * z), $MachinePrecision]
\begin{array}{l}
\\
\frac{y}{t} \cdot z
\end{array}
Initial program 95.3%
Taylor expanded in y around inf
associate-*l/N/A
lower-*.f64N/A
lower-/.f6433.8
Applied rewrites33.8%
(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 2024276
(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)))