
(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 9 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 (- y z)) (- t z)) -5e-78)
(* (- y z) (/ x_m (- t z)))
(/ 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 * (y - z)) / (t - z)) <= -5e-78) {
tmp = (y - z) * (x_m / (t - z));
} 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 * (y - z)) / (t - z)) <= (-5d-78)) then
tmp = (y - z) * (x_m / (t - z))
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 * (y - z)) / (t - z)) <= -5e-78) {
tmp = (y - z) * (x_m / (t - z));
} 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 * (y - z)) / (t - z)) <= -5e-78: tmp = (y - z) * (x_m / (t - z)) 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 (Float64(Float64(x_m * Float64(y - z)) / Float64(t - z)) <= -5e-78) tmp = Float64(Float64(y - z) * Float64(x_m / Float64(t - z))); else tmp = Float64(x_m / Float64(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 * (y - z)) / (t - z)) <= -5e-78) tmp = (y - z) * (x_m / (t - z)); 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[N[(N[(x$95$m * N[(y - z), $MachinePrecision]), $MachinePrecision] / N[(t - z), $MachinePrecision]), $MachinePrecision], -5e-78], N[(N[(y - z), $MachinePrecision] * N[(x$95$m / N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x$95$m / N[(N[(t - z), $MachinePrecision] / N[(y - z), $MachinePrecision]), $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}\;\frac{x\_m \cdot \left(y - z\right)}{t - z} \leq -5 \cdot 10^{-78}:\\
\;\;\;\;\left(y - z\right) \cdot \frac{x\_m}{t - z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x\_m}{\frac{t - z}{y - z}}\\
\end{array}
\end{array}
if (/.f64 (*.f64 x (-.f64 y z)) (-.f64 t z)) < -4.9999999999999996e-78Initial program 77.9%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6496.5
Applied rewrites96.5%
if -4.9999999999999996e-78 < (/.f64 (*.f64 x (-.f64 y z)) (-.f64 t z)) Initial program 83.1%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
lower-/.f6496.4
Applied rewrites96.4%
Final simplification96.4%
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 (- y z)) (- t z)) -5e-78)
(* (- y z) (/ x_m (- t z)))
(* x_m (/ (- y z) (- t 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 * (y - z)) / (t - z)) <= -5e-78) {
tmp = (y - z) * (x_m / (t - z));
} else {
tmp = x_m * ((y - z) / (t - 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 * (y - z)) / (t - z)) <= (-5d-78)) then
tmp = (y - z) * (x_m / (t - z))
else
tmp = x_m * ((y - z) / (t - 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 * (y - z)) / (t - z)) <= -5e-78) {
tmp = (y - z) * (x_m / (t - z));
} else {
tmp = x_m * ((y - z) / (t - 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 * (y - z)) / (t - z)) <= -5e-78: tmp = (y - z) * (x_m / (t - z)) else: tmp = x_m * ((y - z) / (t - 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 (Float64(Float64(x_m * Float64(y - z)) / Float64(t - z)) <= -5e-78) tmp = Float64(Float64(y - z) * Float64(x_m / Float64(t - z))); else tmp = Float64(x_m * Float64(Float64(y - z) / Float64(t - 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 * (y - z)) / (t - z)) <= -5e-78) tmp = (y - z) * (x_m / (t - z)); else tmp = x_m * ((y - z) / (t - 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[N[(N[(x$95$m * N[(y - z), $MachinePrecision]), $MachinePrecision] / N[(t - z), $MachinePrecision]), $MachinePrecision], -5e-78], N[(N[(y - z), $MachinePrecision] * N[(x$95$m / N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x$95$m * N[(N[(y - z), $MachinePrecision] / N[(t - z), $MachinePrecision]), $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}\;\frac{x\_m \cdot \left(y - z\right)}{t - z} \leq -5 \cdot 10^{-78}:\\
\;\;\;\;\left(y - z\right) \cdot \frac{x\_m}{t - z}\\
\mathbf{else}:\\
\;\;\;\;x\_m \cdot \frac{y - z}{t - z}\\
\end{array}
\end{array}
if (/.f64 (*.f64 x (-.f64 y z)) (-.f64 t z)) < -4.9999999999999996e-78Initial program 77.9%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6496.5
Applied rewrites96.5%
if -4.9999999999999996e-78 < (/.f64 (*.f64 x (-.f64 y z)) (-.f64 t z)) Initial program 83.1%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6495.9
Applied rewrites95.9%
Final simplification96.1%
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 -5.5e+64)
(* x_m 1.0)
(if (<= z -3.4e-67)
(* y (/ x_m (- z)))
(if (<= z 4.4e+64) (* y (/ x_m t)) (* x_m 1.0))))))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 <= -5.5e+64) {
tmp = x_m * 1.0;
} else if (z <= -3.4e-67) {
tmp = y * (x_m / -z);
} else if (z <= 4.4e+64) {
tmp = y * (x_m / t);
} else {
tmp = x_m * 1.0;
}
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 <= (-5.5d+64)) then
tmp = x_m * 1.0d0
else if (z <= (-3.4d-67)) then
tmp = y * (x_m / -z)
else if (z <= 4.4d+64) then
tmp = y * (x_m / t)
else
tmp = x_m * 1.0d0
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 <= -5.5e+64) {
tmp = x_m * 1.0;
} else if (z <= -3.4e-67) {
tmp = y * (x_m / -z);
} else if (z <= 4.4e+64) {
tmp = y * (x_m / t);
} else {
tmp = x_m * 1.0;
}
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 <= -5.5e+64: tmp = x_m * 1.0 elif z <= -3.4e-67: tmp = y * (x_m / -z) elif z <= 4.4e+64: tmp = y * (x_m / t) else: tmp = x_m * 1.0 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 <= -5.5e+64) tmp = Float64(x_m * 1.0); elseif (z <= -3.4e-67) tmp = Float64(y * Float64(x_m / Float64(-z))); elseif (z <= 4.4e+64) tmp = Float64(y * Float64(x_m / t)); else tmp = Float64(x_m * 1.0); 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 <= -5.5e+64) tmp = x_m * 1.0; elseif (z <= -3.4e-67) tmp = y * (x_m / -z); elseif (z <= 4.4e+64) tmp = y * (x_m / t); else tmp = x_m * 1.0; 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, -5.5e+64], N[(x$95$m * 1.0), $MachinePrecision], If[LessEqual[z, -3.4e-67], N[(y * N[(x$95$m / (-z)), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 4.4e+64], N[(y * N[(x$95$m / t), $MachinePrecision]), $MachinePrecision], N[(x$95$m * 1.0), $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 -5.5 \cdot 10^{+64}:\\
\;\;\;\;x\_m \cdot 1\\
\mathbf{elif}\;z \leq -3.4 \cdot 10^{-67}:\\
\;\;\;\;y \cdot \frac{x\_m}{-z}\\
\mathbf{elif}\;z \leq 4.4 \cdot 10^{+64}:\\
\;\;\;\;y \cdot \frac{x\_m}{t}\\
\mathbf{else}:\\
\;\;\;\;x\_m \cdot 1\\
\end{array}
\end{array}
if z < -5.4999999999999996e64 or 4.40000000000000004e64 < z Initial program 72.5%
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 rewrites71.9%
if -5.4999999999999996e64 < z < -3.4000000000000001e-67Initial program 93.2%
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-rgt-inN/A
*-commutativeN/A
associate-/l*N/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
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6464.9
Applied rewrites64.9%
Taylor expanded in y around inf
Applied rewrites47.9%
Applied rewrites50.9%
if -3.4000000000000001e-67 < z < 4.40000000000000004e64Initial program 85.4%
Taylor expanded in z around 0
lower-/.f64N/A
lower-*.f6460.3
Applied rewrites60.3%
Applied rewrites69.4%
Final simplification68.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 -5.5e+64)
(* x_m 1.0)
(if (<= z -3.4e-67)
(* x_m (/ y (- z)))
(if (<= z 4.4e+64) (* y (/ x_m t)) (* x_m 1.0))))))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 <= -5.5e+64) {
tmp = x_m * 1.0;
} else if (z <= -3.4e-67) {
tmp = x_m * (y / -z);
} else if (z <= 4.4e+64) {
tmp = y * (x_m / t);
} else {
tmp = x_m * 1.0;
}
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 <= (-5.5d+64)) then
tmp = x_m * 1.0d0
else if (z <= (-3.4d-67)) then
tmp = x_m * (y / -z)
else if (z <= 4.4d+64) then
tmp = y * (x_m / t)
else
tmp = x_m * 1.0d0
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 <= -5.5e+64) {
tmp = x_m * 1.0;
} else if (z <= -3.4e-67) {
tmp = x_m * (y / -z);
} else if (z <= 4.4e+64) {
tmp = y * (x_m / t);
} else {
tmp = x_m * 1.0;
}
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 <= -5.5e+64: tmp = x_m * 1.0 elif z <= -3.4e-67: tmp = x_m * (y / -z) elif z <= 4.4e+64: tmp = y * (x_m / t) else: tmp = x_m * 1.0 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 <= -5.5e+64) tmp = Float64(x_m * 1.0); elseif (z <= -3.4e-67) tmp = Float64(x_m * Float64(y / Float64(-z))); elseif (z <= 4.4e+64) tmp = Float64(y * Float64(x_m / t)); else tmp = Float64(x_m * 1.0); 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 <= -5.5e+64) tmp = x_m * 1.0; elseif (z <= -3.4e-67) tmp = x_m * (y / -z); elseif (z <= 4.4e+64) tmp = y * (x_m / t); else tmp = x_m * 1.0; 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, -5.5e+64], N[(x$95$m * 1.0), $MachinePrecision], If[LessEqual[z, -3.4e-67], N[(x$95$m * N[(y / (-z)), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 4.4e+64], N[(y * N[(x$95$m / t), $MachinePrecision]), $MachinePrecision], N[(x$95$m * 1.0), $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 -5.5 \cdot 10^{+64}:\\
\;\;\;\;x\_m \cdot 1\\
\mathbf{elif}\;z \leq -3.4 \cdot 10^{-67}:\\
\;\;\;\;x\_m \cdot \frac{y}{-z}\\
\mathbf{elif}\;z \leq 4.4 \cdot 10^{+64}:\\
\;\;\;\;y \cdot \frac{x\_m}{t}\\
\mathbf{else}:\\
\;\;\;\;x\_m \cdot 1\\
\end{array}
\end{array}
if z < -5.4999999999999996e64 or 4.40000000000000004e64 < z Initial program 72.5%
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 rewrites71.9%
if -5.4999999999999996e64 < z < -3.4000000000000001e-67Initial program 93.2%
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-rgt-inN/A
*-commutativeN/A
associate-/l*N/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
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6464.9
Applied rewrites64.9%
Taylor expanded in y around inf
Applied rewrites47.9%
if -3.4000000000000001e-67 < z < 4.40000000000000004e64Initial program 85.4%
Taylor expanded in z around 0
lower-/.f64N/A
lower-*.f6460.3
Applied rewrites60.3%
Applied rewrites69.4%
Final simplification67.9%
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 -9e+187)
(fma (- x_m) (/ y z) x_m)
(if (<= z 5e+80) (* (- y z) (/ x_m (- t z))) (* x_m (/ z (- z t)))))))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 <= -9e+187) {
tmp = fma(-x_m, (y / z), x_m);
} else if (z <= 5e+80) {
tmp = (y - z) * (x_m / (t - z));
} else {
tmp = x_m * (z / (z - t));
}
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 <= -9e+187) tmp = fma(Float64(-x_m), Float64(y / z), x_m); elseif (z <= 5e+80) tmp = Float64(Float64(y - z) * Float64(x_m / Float64(t - z))); else tmp = Float64(x_m * Float64(z / Float64(z - t))); 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, -9e+187], N[((-x$95$m) * N[(y / z), $MachinePrecision] + x$95$m), $MachinePrecision], If[LessEqual[z, 5e+80], N[(N[(y - z), $MachinePrecision] * N[(x$95$m / N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x$95$m * N[(z / N[(z - t), $MachinePrecision]), $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}\;z \leq -9 \cdot 10^{+187}:\\
\;\;\;\;\mathsf{fma}\left(-x\_m, \frac{y}{z}, x\_m\right)\\
\mathbf{elif}\;z \leq 5 \cdot 10^{+80}:\\
\;\;\;\;\left(y - z\right) \cdot \frac{x\_m}{t - z}\\
\mathbf{else}:\\
\;\;\;\;x\_m \cdot \frac{z}{z - t}\\
\end{array}
\end{array}
if z < -9.00000000000000052e187Initial program 57.6%
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-rgt-inN/A
*-commutativeN/A
associate-/l*N/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
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6492.4
Applied rewrites92.4%
Applied rewrites95.4%
if -9.00000000000000052e187 < z < 4.99999999999999961e80Initial program 85.5%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6495.3
Applied rewrites95.3%
if 4.99999999999999961e80 < z Initial program 75.9%
Taylor expanded in z around 0
lower-/.f64N/A
lower-*.f647.6
Applied rewrites7.6%
Taylor expanded in y around 0
mul-1-negN/A
distribute-neg-frac2N/A
sub-negN/A
mul-1-negN/A
+-commutativeN/A
distribute-neg-inN/A
mul-1-negN/A
remove-double-negN/A
sub-negN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6493.4
Applied rewrites93.4%
Final simplification95.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 (* x_m (/ z (- z t)))))
(*
x_s
(if (<= z -5.2e+64) t_1 (if (<= z 4.5e+60) (* x_m (/ y (- t z))) 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 = x_m * (z / (z - t));
double tmp;
if (z <= -5.2e+64) {
tmp = t_1;
} else if (z <= 4.5e+60) {
tmp = x_m * (y / (t - z));
} 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 = x_m * (z / (z - t))
if (z <= (-5.2d+64)) then
tmp = t_1
else if (z <= 4.5d+60) then
tmp = x_m * (y / (t - z))
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 = x_m * (z / (z - t));
double tmp;
if (z <= -5.2e+64) {
tmp = t_1;
} else if (z <= 4.5e+60) {
tmp = x_m * (y / (t - z));
} 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 = x_m * (z / (z - t)) tmp = 0 if z <= -5.2e+64: tmp = t_1 elif z <= 4.5e+60: tmp = x_m * (y / (t - z)) 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(x_m * Float64(z / Float64(z - t))) tmp = 0.0 if (z <= -5.2e+64) tmp = t_1; elseif (z <= 4.5e+60) tmp = Float64(x_m * Float64(y / Float64(t - z))); 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 = x_m * (z / (z - t)); tmp = 0.0; if (z <= -5.2e+64) tmp = t_1; elseif (z <= 4.5e+60) tmp = x_m * (y / (t - z)); 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[(x$95$m * N[(z / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(x$95$s * If[LessEqual[z, -5.2e+64], t$95$1, If[LessEqual[z, 4.5e+60], N[(x$95$m * N[(y / N[(t - z), $MachinePrecision]), $MachinePrecision]), $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 := x\_m \cdot \frac{z}{z - t}\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq -5.2 \cdot 10^{+64}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 4.5 \cdot 10^{+60}:\\
\;\;\;\;x\_m \cdot \frac{y}{t - z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
\end{array}
if z < -5.19999999999999994e64 or 4.50000000000000013e60 < z Initial program 72.8%
Taylor expanded in z around 0
lower-/.f64N/A
lower-*.f646.4
Applied rewrites6.4%
Taylor expanded in y around 0
mul-1-negN/A
distribute-neg-frac2N/A
sub-negN/A
mul-1-negN/A
+-commutativeN/A
distribute-neg-inN/A
mul-1-negN/A
remove-double-negN/A
sub-negN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6489.1
Applied rewrites89.1%
if -5.19999999999999994e64 < z < 4.50000000000000013e60Initial program 86.7%
Taylor expanded in y around inf
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6478.9
Applied rewrites78.9%
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 -3e+72)
(* x_m 1.0)
(if (<= z 3.5e+66) (* x_m (/ y (- t z))) (* x_m 1.0)))))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 <= -3e+72) {
tmp = x_m * 1.0;
} else if (z <= 3.5e+66) {
tmp = x_m * (y / (t - z));
} else {
tmp = x_m * 1.0;
}
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 <= (-3d+72)) then
tmp = x_m * 1.0d0
else if (z <= 3.5d+66) then
tmp = x_m * (y / (t - z))
else
tmp = x_m * 1.0d0
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 <= -3e+72) {
tmp = x_m * 1.0;
} else if (z <= 3.5e+66) {
tmp = x_m * (y / (t - z));
} else {
tmp = x_m * 1.0;
}
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 <= -3e+72: tmp = x_m * 1.0 elif z <= 3.5e+66: tmp = x_m * (y / (t - z)) else: tmp = x_m * 1.0 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 <= -3e+72) tmp = Float64(x_m * 1.0); elseif (z <= 3.5e+66) tmp = Float64(x_m * Float64(y / Float64(t - z))); else tmp = Float64(x_m * 1.0); 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 <= -3e+72) tmp = x_m * 1.0; elseif (z <= 3.5e+66) tmp = x_m * (y / (t - z)); else tmp = x_m * 1.0; 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, -3e+72], N[(x$95$m * 1.0), $MachinePrecision], If[LessEqual[z, 3.5e+66], N[(x$95$m * N[(y / N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x$95$m * 1.0), $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 -3 \cdot 10^{+72}:\\
\;\;\;\;x\_m \cdot 1\\
\mathbf{elif}\;z \leq 3.5 \cdot 10^{+66}:\\
\;\;\;\;x\_m \cdot \frac{y}{t - z}\\
\mathbf{else}:\\
\;\;\;\;x\_m \cdot 1\\
\end{array}
\end{array}
if z < -3.00000000000000003e72 or 3.4999999999999997e66 < z Initial program 72.5%
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 rewrites71.9%
if -3.00000000000000003e72 < z < 3.4999999999999997e66Initial program 86.8%
Taylor expanded in y around inf
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6478.4
Applied rewrites78.4%
Final simplification76.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 -3.2e+71)
(* x_m 1.0)
(if (<= z 4.4e+64) (* y (/ x_m t)) (* x_m 1.0)))))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 <= -3.2e+71) {
tmp = x_m * 1.0;
} else if (z <= 4.4e+64) {
tmp = y * (x_m / t);
} else {
tmp = x_m * 1.0;
}
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 <= (-3.2d+71)) then
tmp = x_m * 1.0d0
else if (z <= 4.4d+64) then
tmp = y * (x_m / t)
else
tmp = x_m * 1.0d0
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 <= -3.2e+71) {
tmp = x_m * 1.0;
} else if (z <= 4.4e+64) {
tmp = y * (x_m / t);
} else {
tmp = x_m * 1.0;
}
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 <= -3.2e+71: tmp = x_m * 1.0 elif z <= 4.4e+64: tmp = y * (x_m / t) else: tmp = x_m * 1.0 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 <= -3.2e+71) tmp = Float64(x_m * 1.0); elseif (z <= 4.4e+64) tmp = Float64(y * Float64(x_m / t)); else tmp = Float64(x_m * 1.0); 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 <= -3.2e+71) tmp = x_m * 1.0; elseif (z <= 4.4e+64) tmp = y * (x_m / t); else tmp = x_m * 1.0; 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, -3.2e+71], N[(x$95$m * 1.0), $MachinePrecision], If[LessEqual[z, 4.4e+64], N[(y * N[(x$95$m / t), $MachinePrecision]), $MachinePrecision], N[(x$95$m * 1.0), $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 -3.2 \cdot 10^{+71}:\\
\;\;\;\;x\_m \cdot 1\\
\mathbf{elif}\;z \leq 4.4 \cdot 10^{+64}:\\
\;\;\;\;y \cdot \frac{x\_m}{t}\\
\mathbf{else}:\\
\;\;\;\;x\_m \cdot 1\\
\end{array}
\end{array}
if z < -3.20000000000000023e71 or 4.40000000000000004e64 < z Initial program 72.5%
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 rewrites71.9%
if -3.20000000000000023e71 < z < 4.40000000000000004e64Initial program 86.8%
Taylor expanded in z around 0
lower-/.f64N/A
lower-*.f6454.8
Applied rewrites54.8%
Applied rewrites62.3%
Final simplification65.9%
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 (* x_m 1.0)))
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 * (x_m * 1.0);
}
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 * (x_m * 1.0d0)
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 * (x_m * 1.0);
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) def code(x_s, x_m, y, z, t): return x_s * (x_m * 1.0)
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y, z, t) return Float64(x_s * Float64(x_m * 1.0)) 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 * (x_m * 1.0); 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[(x$95$m * 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
x\_s \cdot \left(x\_m \cdot 1\right)
\end{array}
Initial program 81.4%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6496.3
Applied rewrites96.3%
Taylor expanded in z around inf
Applied rewrites33.1%
Final simplification33.1%
(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 2024219
(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)))