
(FPCore (x y z t) :precision binary64 (/ (* x (- y z)) (- t z)))
double code(double x, double y, double z, double t) {
return (x * (y - z)) / (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 = (x * (y - z)) / (t - z)
end function
public static double code(double x, double y, double z, double t) {
return (x * (y - z)) / (t - z);
}
def code(x, y, z, t): return (x * (y - z)) / (t - z)
function code(x, y, z, t) return Float64(Float64(x * Float64(y - z)) / Float64(t - z)) end
function tmp = code(x, y, z, t) tmp = (x * (y - z)) / (t - z); end
code[x_, y_, z_, t_] := N[(N[(x * N[(y - z), $MachinePrecision]), $MachinePrecision] / N[(t - z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot \left(y - z\right)}{t - z}
\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 z)))
double code(double x, double y, double z, double t) {
return (x * (y - z)) / (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 = (x * (y - z)) / (t - z)
end function
public static double code(double x, double y, double z, double t) {
return (x * (y - z)) / (t - z);
}
def code(x, y, z, t): return (x * (y - z)) / (t - z)
function code(x, y, z, t) return Float64(Float64(x * Float64(y - z)) / Float64(t - z)) end
function tmp = code(x, y, z, t) tmp = (x * (y - z)) / (t - z); end
code[x_, y_, z_, t_] := N[(N[(x * N[(y - z), $MachinePrecision]), $MachinePrecision] / N[(t - z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot \left(y - z\right)}{t - z}
\end{array}
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m y z t)
:precision binary64
(*
x_s
(if (<= x_m 3.3e-38)
(* (/ (- y z) (- t z)) x_m)
(* (/ x_m (- t z)) (- y z)))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z, double t) {
double tmp;
if (x_m <= 3.3e-38) {
tmp = ((y - z) / (t - z)) * x_m;
} else {
tmp = (x_m / (t - z)) * (y - z);
}
return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z, t)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (x_m <= 3.3d-38) then
tmp = ((y - z) / (t - z)) * x_m
else
tmp = (x_m / (t - z)) * (y - z)
end if
code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z, double t) {
double tmp;
if (x_m <= 3.3e-38) {
tmp = ((y - z) / (t - z)) * x_m;
} else {
tmp = (x_m / (t - z)) * (y - z);
}
return x_s * tmp;
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) def code(x_s, x_m, y, z, t): tmp = 0 if x_m <= 3.3e-38: tmp = ((y - z) / (t - z)) * x_m else: tmp = (x_m / (t - z)) * (y - z) return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y, z, t) tmp = 0.0 if (x_m <= 3.3e-38) tmp = Float64(Float64(Float64(y - z) / Float64(t - z)) * x_m); else tmp = Float64(Float64(x_m / Float64(t - z)) * Float64(y - z)); end return Float64(x_s * tmp) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); function tmp_2 = code(x_s, x_m, y, z, t) tmp = 0.0; if (x_m <= 3.3e-38) tmp = ((y - z) / (t - z)) * x_m; else tmp = (x_m / (t - z)) * (y - z); end tmp_2 = x_s * tmp; end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_, t_] := N[(x$95$s * If[LessEqual[x$95$m, 3.3e-38], N[(N[(N[(y - z), $MachinePrecision] / N[(t - z), $MachinePrecision]), $MachinePrecision] * x$95$m), $MachinePrecision], N[(N[(x$95$m / N[(t - z), $MachinePrecision]), $MachinePrecision] * N[(y - z), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;x\_m \leq 3.3 \cdot 10^{-38}:\\
\;\;\;\;\frac{y - z}{t - z} \cdot x\_m\\
\mathbf{else}:\\
\;\;\;\;\frac{x\_m}{t - z} \cdot \left(y - z\right)\\
\end{array}
\end{array}
if x < 3.3000000000000002e-38Initial program 89.9%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6496.5
Applied rewrites96.5%
if 3.3000000000000002e-38 < x Initial program 75.6%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6498.5
Applied rewrites98.5%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m y z t)
:precision binary64
(*
x_s
(if (<= z -1.45e+154)
(fma (/ (- x_m) z) y x_m)
(if (<= z 1.25e+140) (* (/ x_m (- t z)) (- y z)) (* (/ z (- z t)) x_m)))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z, double t) {
double tmp;
if (z <= -1.45e+154) {
tmp = fma((-x_m / z), y, x_m);
} else if (z <= 1.25e+140) {
tmp = (x_m / (t - z)) * (y - z);
} else {
tmp = (z / (z - t)) * x_m;
}
return x_s * tmp;
}
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y, z, t) tmp = 0.0 if (z <= -1.45e+154) tmp = fma(Float64(Float64(-x_m) / z), y, x_m); elseif (z <= 1.25e+140) tmp = Float64(Float64(x_m / Float64(t - z)) * Float64(y - z)); else tmp = Float64(Float64(z / Float64(z - t)) * x_m); end return Float64(x_s * tmp) end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_, t_] := N[(x$95$s * If[LessEqual[z, -1.45e+154], N[(N[((-x$95$m) / z), $MachinePrecision] * y + x$95$m), $MachinePrecision], If[LessEqual[z, 1.25e+140], N[(N[(x$95$m / N[(t - z), $MachinePrecision]), $MachinePrecision] * N[(y - z), $MachinePrecision]), $MachinePrecision], N[(N[(z / N[(z - t), $MachinePrecision]), $MachinePrecision] * x$95$m), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq -1.45 \cdot 10^{+154}:\\
\;\;\;\;\mathsf{fma}\left(\frac{-x\_m}{z}, y, x\_m\right)\\
\mathbf{elif}\;z \leq 1.25 \cdot 10^{+140}:\\
\;\;\;\;\frac{x\_m}{t - z} \cdot \left(y - z\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{z}{z - t} \cdot x\_m\\
\end{array}
\end{array}
if z < -1.4499999999999999e154Initial program 67.4%
Taylor expanded in t around 0
mul-1-negN/A
neg-sub0N/A
associate-/l*N/A
div-subN/A
sub-negN/A
*-inversesN/A
metadata-evalN/A
distribute-lft-outN/A
associate-/l*N/A
*-commutativeN/A
mul-1-negN/A
unsub-negN/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-/.f64N/A
*-commutativeN/A
lower-*.f6489.2
Applied rewrites89.2%
Applied rewrites97.1%
if -1.4499999999999999e154 < z < 1.25000000000000002e140Initial program 92.8%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6492.9
Applied rewrites92.9%
if 1.25000000000000002e140 < z Initial program 65.9%
Taylor expanded in y around 0
associate-/l*N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
mul-1-negN/A
lower-neg.f6490.8
Applied rewrites90.8%
Applied rewrites61.1%
Applied rewrites90.8%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m y z t)
:precision binary64
(*
x_s
(if (<= z -3700000000.0)
(fma (/ (- x_m) z) y x_m)
(if (<= z 0.47) (* (/ x_m (- t z)) y) (* (/ z (- z t)) x_m)))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z, double t) {
double tmp;
if (z <= -3700000000.0) {
tmp = fma((-x_m / z), y, x_m);
} else if (z <= 0.47) {
tmp = (x_m / (t - z)) * y;
} else {
tmp = (z / (z - t)) * x_m;
}
return x_s * tmp;
}
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y, z, t) tmp = 0.0 if (z <= -3700000000.0) tmp = fma(Float64(Float64(-x_m) / z), y, x_m); elseif (z <= 0.47) tmp = Float64(Float64(x_m / Float64(t - z)) * y); else tmp = Float64(Float64(z / Float64(z - t)) * x_m); end return Float64(x_s * tmp) end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_, t_] := N[(x$95$s * If[LessEqual[z, -3700000000.0], N[(N[((-x$95$m) / z), $MachinePrecision] * y + x$95$m), $MachinePrecision], If[LessEqual[z, 0.47], N[(N[(x$95$m / N[(t - z), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision], N[(N[(z / N[(z - t), $MachinePrecision]), $MachinePrecision] * x$95$m), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq -3700000000:\\
\;\;\;\;\mathsf{fma}\left(\frac{-x\_m}{z}, y, x\_m\right)\\
\mathbf{elif}\;z \leq 0.47:\\
\;\;\;\;\frac{x\_m}{t - z} \cdot y\\
\mathbf{else}:\\
\;\;\;\;\frac{z}{z - t} \cdot x\_m\\
\end{array}
\end{array}
if z < -3.7e9Initial program 75.0%
Taylor expanded in t around 0
mul-1-negN/A
neg-sub0N/A
associate-/l*N/A
div-subN/A
sub-negN/A
*-inversesN/A
metadata-evalN/A
distribute-lft-outN/A
associate-/l*N/A
*-commutativeN/A
mul-1-negN/A
unsub-negN/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-/.f64N/A
*-commutativeN/A
lower-*.f6483.3
Applied rewrites83.3%
Applied rewrites84.7%
if -3.7e9 < z < 0.46999999999999997Initial program 95.1%
Taylor expanded in y around inf
associate-*l/N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6477.5
Applied rewrites77.5%
if 0.46999999999999997 < z Initial program 74.1%
Taylor expanded in y around 0
associate-/l*N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
mul-1-negN/A
lower-neg.f6485.5
Applied rewrites85.5%
Applied rewrites67.0%
Applied rewrites85.5%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m y z t)
:precision binary64
(*
x_s
(if (<= z -3700000000.0)
(- x_m (/ (* y x_m) z))
(if (<= z 0.47) (* (/ x_m (- t z)) y) (* (/ z (- z t)) x_m)))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z, double t) {
double tmp;
if (z <= -3700000000.0) {
tmp = x_m - ((y * x_m) / z);
} else if (z <= 0.47) {
tmp = (x_m / (t - z)) * y;
} else {
tmp = (z / (z - t)) * x_m;
}
return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z, t)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= (-3700000000.0d0)) then
tmp = x_m - ((y * x_m) / z)
else if (z <= 0.47d0) then
tmp = (x_m / (t - z)) * y
else
tmp = (z / (z - t)) * x_m
end if
code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z, double t) {
double tmp;
if (z <= -3700000000.0) {
tmp = x_m - ((y * x_m) / z);
} else if (z <= 0.47) {
tmp = (x_m / (t - z)) * y;
} else {
tmp = (z / (z - t)) * x_m;
}
return x_s * tmp;
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) def code(x_s, x_m, y, z, t): tmp = 0 if z <= -3700000000.0: tmp = x_m - ((y * x_m) / z) elif z <= 0.47: tmp = (x_m / (t - z)) * y else: tmp = (z / (z - t)) * x_m return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y, z, t) tmp = 0.0 if (z <= -3700000000.0) tmp = Float64(x_m - Float64(Float64(y * x_m) / z)); elseif (z <= 0.47) tmp = Float64(Float64(x_m / Float64(t - z)) * y); else tmp = Float64(Float64(z / Float64(z - t)) * x_m); end return Float64(x_s * tmp) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); function tmp_2 = code(x_s, x_m, y, z, t) tmp = 0.0; if (z <= -3700000000.0) tmp = x_m - ((y * x_m) / z); elseif (z <= 0.47) tmp = (x_m / (t - z)) * y; else tmp = (z / (z - t)) * x_m; end tmp_2 = x_s * tmp; end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_, t_] := N[(x$95$s * If[LessEqual[z, -3700000000.0], N[(x$95$m - N[(N[(y * x$95$m), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 0.47], N[(N[(x$95$m / N[(t - z), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision], N[(N[(z / N[(z - t), $MachinePrecision]), $MachinePrecision] * x$95$m), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq -3700000000:\\
\;\;\;\;x\_m - \frac{y \cdot x\_m}{z}\\
\mathbf{elif}\;z \leq 0.47:\\
\;\;\;\;\frac{x\_m}{t - z} \cdot y\\
\mathbf{else}:\\
\;\;\;\;\frac{z}{z - t} \cdot x\_m\\
\end{array}
\end{array}
if z < -3.7e9Initial program 75.0%
Taylor expanded in t around 0
mul-1-negN/A
neg-sub0N/A
associate-/l*N/A
div-subN/A
sub-negN/A
*-inversesN/A
metadata-evalN/A
distribute-lft-outN/A
associate-/l*N/A
*-commutativeN/A
mul-1-negN/A
unsub-negN/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-/.f64N/A
*-commutativeN/A
lower-*.f6483.3
Applied rewrites83.3%
if -3.7e9 < z < 0.46999999999999997Initial program 95.1%
Taylor expanded in y around inf
associate-*l/N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6477.5
Applied rewrites77.5%
if 0.46999999999999997 < z Initial program 74.1%
Taylor expanded in y around 0
associate-/l*N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
mul-1-negN/A
lower-neg.f6485.5
Applied rewrites85.5%
Applied rewrites67.0%
Applied rewrites85.5%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m y z t)
:precision binary64
(let* ((t_1 (* (/ z (- z t)) x_m)))
(*
x_s
(if (<= z -7.5e+86) t_1 (if (<= z 0.47) (* (/ x_m (- t z)) y) t_1)))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z, double t) {
double t_1 = (z / (z - t)) * x_m;
double tmp;
if (z <= -7.5e+86) {
tmp = t_1;
} else if (z <= 0.47) {
tmp = (x_m / (t - z)) * y;
} else {
tmp = t_1;
}
return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z, t)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = (z / (z - t)) * x_m
if (z <= (-7.5d+86)) then
tmp = t_1
else if (z <= 0.47d0) then
tmp = (x_m / (t - z)) * y
else
tmp = t_1
end if
code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z, double t) {
double t_1 = (z / (z - t)) * x_m;
double tmp;
if (z <= -7.5e+86) {
tmp = t_1;
} else if (z <= 0.47) {
tmp = (x_m / (t - z)) * y;
} else {
tmp = t_1;
}
return x_s * tmp;
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) def code(x_s, x_m, y, z, t): t_1 = (z / (z - t)) * x_m tmp = 0 if z <= -7.5e+86: tmp = t_1 elif z <= 0.47: tmp = (x_m / (t - z)) * y else: tmp = t_1 return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y, z, t) t_1 = Float64(Float64(z / Float64(z - t)) * x_m) tmp = 0.0 if (z <= -7.5e+86) tmp = t_1; elseif (z <= 0.47) tmp = Float64(Float64(x_m / Float64(t - z)) * y); else tmp = t_1; end return Float64(x_s * tmp) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); function tmp_2 = code(x_s, x_m, y, z, t) t_1 = (z / (z - t)) * x_m; tmp = 0.0; if (z <= -7.5e+86) tmp = t_1; elseif (z <= 0.47) tmp = (x_m / (t - z)) * y; else tmp = t_1; end tmp_2 = x_s * tmp; end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_, t_] := Block[{t$95$1 = N[(N[(z / N[(z - t), $MachinePrecision]), $MachinePrecision] * x$95$m), $MachinePrecision]}, N[(x$95$s * If[LessEqual[z, -7.5e+86], t$95$1, If[LessEqual[z, 0.47], N[(N[(x$95$m / N[(t - z), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision], t$95$1]]), $MachinePrecision]]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
\begin{array}{l}
t_1 := \frac{z}{z - t} \cdot x\_m\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq -7.5 \cdot 10^{+86}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 0.47:\\
\;\;\;\;\frac{x\_m}{t - z} \cdot y\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
\end{array}
if z < -7.4999999999999997e86 or 0.46999999999999997 < z Initial program 72.6%
Taylor expanded in y around 0
associate-/l*N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
mul-1-negN/A
lower-neg.f6483.8
Applied rewrites83.8%
Applied rewrites62.5%
Applied rewrites83.8%
if -7.4999999999999997e86 < z < 0.46999999999999997Initial program 94.9%
Taylor expanded in y around inf
associate-*l/N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6476.0
Applied rewrites76.0%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m y z t)
:precision binary64
(*
x_s
(if (<= z -1.95e+87)
(* 1.0 x_m)
(if (<= z 110.0) (* (/ x_m (- t z)) y) (fma (/ x_m z) t x_m)))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z, double t) {
double tmp;
if (z <= -1.95e+87) {
tmp = 1.0 * x_m;
} else if (z <= 110.0) {
tmp = (x_m / (t - z)) * y;
} else {
tmp = fma((x_m / z), t, x_m);
}
return x_s * tmp;
}
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y, z, t) tmp = 0.0 if (z <= -1.95e+87) tmp = Float64(1.0 * x_m); elseif (z <= 110.0) tmp = Float64(Float64(x_m / Float64(t - z)) * y); else tmp = fma(Float64(x_m / z), t, x_m); end return Float64(x_s * tmp) end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_, t_] := N[(x$95$s * If[LessEqual[z, -1.95e+87], N[(1.0 * x$95$m), $MachinePrecision], If[LessEqual[z, 110.0], N[(N[(x$95$m / N[(t - z), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision], N[(N[(x$95$m / z), $MachinePrecision] * t + x$95$m), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq -1.95 \cdot 10^{+87}:\\
\;\;\;\;1 \cdot x\_m\\
\mathbf{elif}\;z \leq 110:\\
\;\;\;\;\frac{x\_m}{t - z} \cdot y\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{x\_m}{z}, t, x\_m\right)\\
\end{array}
\end{array}
if z < -1.9500000000000001e87Initial program 70.9%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6499.9
Applied rewrites99.9%
Taylor expanded in z around inf
Applied rewrites78.1%
if -1.9500000000000001e87 < z < 110Initial program 94.9%
Taylor expanded in y around inf
associate-*l/N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6475.5
Applied rewrites75.5%
if 110 < z Initial program 73.6%
Taylor expanded in y around 0
associate-/l*N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
mul-1-negN/A
lower-neg.f6485.2
Applied rewrites85.2%
Taylor expanded in t around 0
Applied rewrites69.0%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m y z t)
:precision binary64
(let* ((t_1 (fma (/ x_m z) t x_m)))
(*
x_s
(if (<= z -3700000000.0) t_1 (if (<= z 1.65e-17) (/ (* y x_m) t) t_1)))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z, double t) {
double t_1 = fma((x_m / z), t, x_m);
double tmp;
if (z <= -3700000000.0) {
tmp = t_1;
} else if (z <= 1.65e-17) {
tmp = (y * x_m) / t;
} else {
tmp = t_1;
}
return x_s * tmp;
}
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y, z, t) t_1 = fma(Float64(x_m / z), t, x_m) tmp = 0.0 if (z <= -3700000000.0) tmp = t_1; elseif (z <= 1.65e-17) tmp = Float64(Float64(y * x_m) / t); else tmp = t_1; end return Float64(x_s * tmp) end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x$95$m / z), $MachinePrecision] * t + x$95$m), $MachinePrecision]}, N[(x$95$s * If[LessEqual[z, -3700000000.0], t$95$1, If[LessEqual[z, 1.65e-17], N[(N[(y * x$95$m), $MachinePrecision] / t), $MachinePrecision], t$95$1]]), $MachinePrecision]]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{x\_m}{z}, t, x\_m\right)\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq -3700000000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.65 \cdot 10^{-17}:\\
\;\;\;\;\frac{y \cdot x\_m}{t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
\end{array}
if z < -3.7e9 or 1.65e-17 < z Initial program 75.8%
Taylor expanded in y around 0
associate-/l*N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
mul-1-negN/A
lower-neg.f6477.6
Applied rewrites77.6%
Taylor expanded in t around 0
Applied rewrites67.3%
if -3.7e9 < z < 1.65e-17Initial program 94.9%
Taylor expanded in z around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f6467.7
Applied rewrites67.7%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m y z t)
:precision binary64
(*
x_s
(if (<= z -3700000000.0)
(* 1.0 x_m)
(if (<= z 6.2e-29) (/ (* y x_m) t) (* 1.0 x_m)))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z, double t) {
double tmp;
if (z <= -3700000000.0) {
tmp = 1.0 * x_m;
} else if (z <= 6.2e-29) {
tmp = (y * x_m) / t;
} else {
tmp = 1.0 * x_m;
}
return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z, t)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= (-3700000000.0d0)) then
tmp = 1.0d0 * x_m
else if (z <= 6.2d-29) then
tmp = (y * x_m) / t
else
tmp = 1.0d0 * x_m
end if
code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z, double t) {
double tmp;
if (z <= -3700000000.0) {
tmp = 1.0 * x_m;
} else if (z <= 6.2e-29) {
tmp = (y * x_m) / t;
} else {
tmp = 1.0 * x_m;
}
return x_s * tmp;
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) def code(x_s, x_m, y, z, t): tmp = 0 if z <= -3700000000.0: tmp = 1.0 * x_m elif z <= 6.2e-29: tmp = (y * x_m) / t else: tmp = 1.0 * x_m return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y, z, t) tmp = 0.0 if (z <= -3700000000.0) tmp = Float64(1.0 * x_m); elseif (z <= 6.2e-29) tmp = Float64(Float64(y * x_m) / t); else tmp = Float64(1.0 * x_m); end return Float64(x_s * tmp) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); function tmp_2 = code(x_s, x_m, y, z, t) tmp = 0.0; if (z <= -3700000000.0) tmp = 1.0 * x_m; elseif (z <= 6.2e-29) tmp = (y * x_m) / t; else tmp = 1.0 * x_m; end tmp_2 = x_s * tmp; end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_, t_] := N[(x$95$s * If[LessEqual[z, -3700000000.0], N[(1.0 * x$95$m), $MachinePrecision], If[LessEqual[z, 6.2e-29], N[(N[(y * x$95$m), $MachinePrecision] / t), $MachinePrecision], N[(1.0 * x$95$m), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq -3700000000:\\
\;\;\;\;1 \cdot x\_m\\
\mathbf{elif}\;z \leq 6.2 \cdot 10^{-29}:\\
\;\;\;\;\frac{y \cdot x\_m}{t}\\
\mathbf{else}:\\
\;\;\;\;1 \cdot x\_m\\
\end{array}
\end{array}
if z < -3.7e9 or 6.20000000000000052e-29 < z Initial program 76.0%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6499.8
Applied rewrites99.8%
Taylor expanded in z around inf
Applied rewrites64.9%
if -3.7e9 < z < 6.20000000000000052e-29Initial program 94.9%
Taylor expanded in z around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f6468.2
Applied rewrites68.2%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m y z t)
:precision binary64
(*
x_s
(if (<= z -3700000000.0)
(* 1.0 x_m)
(if (<= z 5.8e-29) (* (/ x_m t) y) (* 1.0 x_m)))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z, double t) {
double tmp;
if (z <= -3700000000.0) {
tmp = 1.0 * x_m;
} else if (z <= 5.8e-29) {
tmp = (x_m / t) * y;
} else {
tmp = 1.0 * x_m;
}
return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z, t)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= (-3700000000.0d0)) then
tmp = 1.0d0 * x_m
else if (z <= 5.8d-29) then
tmp = (x_m / t) * y
else
tmp = 1.0d0 * x_m
end if
code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z, double t) {
double tmp;
if (z <= -3700000000.0) {
tmp = 1.0 * x_m;
} else if (z <= 5.8e-29) {
tmp = (x_m / t) * y;
} else {
tmp = 1.0 * x_m;
}
return x_s * tmp;
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) def code(x_s, x_m, y, z, t): tmp = 0 if z <= -3700000000.0: tmp = 1.0 * x_m elif z <= 5.8e-29: tmp = (x_m / t) * y else: tmp = 1.0 * x_m return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y, z, t) tmp = 0.0 if (z <= -3700000000.0) tmp = Float64(1.0 * x_m); elseif (z <= 5.8e-29) tmp = Float64(Float64(x_m / t) * y); else tmp = Float64(1.0 * x_m); end return Float64(x_s * tmp) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); function tmp_2 = code(x_s, x_m, y, z, t) tmp = 0.0; if (z <= -3700000000.0) tmp = 1.0 * x_m; elseif (z <= 5.8e-29) tmp = (x_m / t) * y; else tmp = 1.0 * x_m; end tmp_2 = x_s * tmp; end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_, t_] := N[(x$95$s * If[LessEqual[z, -3700000000.0], N[(1.0 * x$95$m), $MachinePrecision], If[LessEqual[z, 5.8e-29], N[(N[(x$95$m / t), $MachinePrecision] * y), $MachinePrecision], N[(1.0 * x$95$m), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq -3700000000:\\
\;\;\;\;1 \cdot x\_m\\
\mathbf{elif}\;z \leq 5.8 \cdot 10^{-29}:\\
\;\;\;\;\frac{x\_m}{t} \cdot y\\
\mathbf{else}:\\
\;\;\;\;1 \cdot x\_m\\
\end{array}
\end{array}
if z < -3.7e9 or 5.80000000000000048e-29 < z Initial program 76.0%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6499.8
Applied rewrites99.8%
Taylor expanded in z around inf
Applied rewrites64.9%
if -3.7e9 < z < 5.80000000000000048e-29Initial program 94.9%
Taylor expanded in z around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f6468.2
Applied rewrites68.2%
Applied rewrites65.2%
x\_m = (fabs.f64 x) x\_s = (copysign.f64 #s(literal 1 binary64) x) (FPCore (x_s x_m y z t) :precision binary64 (* x_s (* 1.0 x_m)))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z, double t) {
return x_s * (1.0 * x_m);
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z, t)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x_s * (1.0d0 * x_m)
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z, double t) {
return x_s * (1.0 * x_m);
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) def code(x_s, x_m, y, z, t): return x_s * (1.0 * x_m)
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y, z, t) return Float64(x_s * Float64(1.0 * x_m)) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); function tmp = code(x_s, x_m, y, z, t) tmp = x_s * (1.0 * x_m); end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_, t_] := N[(x$95$s * N[(1.0 * x$95$m), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
x\_s \cdot \left(1 \cdot x\_m\right)
\end{array}
Initial program 85.6%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6496.4
Applied rewrites96.4%
Taylor expanded in z around inf
Applied rewrites36.7%
(FPCore (x y z t) :precision binary64 (/ x (/ (- t z) (- y z))))
double code(double x, double y, double z, double t) {
return x / ((t - z) / (y - 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 = x / ((t - z) / (y - z))
end function
public static double code(double x, double y, double z, double t) {
return x / ((t - z) / (y - z));
}
def code(x, y, z, t): return x / ((t - z) / (y - z))
function code(x, y, z, t) return Float64(x / Float64(Float64(t - z) / Float64(y - z))) end
function tmp = code(x, y, z, t) tmp = x / ((t - z) / (y - z)); end
code[x_, y_, z_, t_] := N[(x / N[(N[(t - z), $MachinePrecision] / N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{\frac{t - z}{y - z}}
\end{array}
herbie shell --seed 2024255
(FPCore (x y z t)
:name "Graphics.Rendering.Chart.Plot.AreaSpots:renderAreaSpots4D from Chart-1.5.3"
:precision binary64
:alt
(! :herbie-platform default (/ x (/ (- t z) (- y z))))
(/ (* x (- y z)) (- t z)))