
(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 8 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 1000000000000.0)
(/ (* x_m (- y z)) (- 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 <= 1000000000000.0) {
tmp = (x_m * (y - z)) / (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 <= 1000000000000.0d0) then
tmp = (x_m * (y - z)) / (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 <= 1000000000000.0) {
tmp = (x_m * (y - z)) / (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 <= 1000000000000.0: tmp = (x_m * (y - z)) / (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 (x_m <= 1000000000000.0) tmp = Float64(Float64(x_m * Float64(y - z)) / Float64(t - z)); 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 <= 1000000000000.0) tmp = (x_m * (y - z)) / (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[x$95$m, 1000000000000.0], N[(N[(x$95$m * N[(y - z), $MachinePrecision]), $MachinePrecision] / N[(t - z), $MachinePrecision]), $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 1000000000000:\\
\;\;\;\;\frac{x\_m \cdot \left(y - z\right)}{t - z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x\_m}{t - z} \cdot \left(y - z\right)\\
\end{array}
\end{array}
if x < 1e12Initial program 92.4%
if 1e12 < x Initial program 63.2%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6498.3
Applied rewrites98.3%
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 (- t z)) (- y z))) (t_2 (/ (* x_m (- y z)) (- t z))))
(*
x_s
(if (<= t_2 -5e-99)
t_1
(if (<= t_2 -1e-295)
(/ (* (- y z) x_m) t)
(if (<= t_2 3.1e-148) (* (/ z (- t z)) (- x_m)) 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 / (t - z)) * (y - z);
double t_2 = (x_m * (y - z)) / (t - z);
double tmp;
if (t_2 <= -5e-99) {
tmp = t_1;
} else if (t_2 <= -1e-295) {
tmp = ((y - z) * x_m) / t;
} else if (t_2 <= 3.1e-148) {
tmp = (z / (t - z)) * -x_m;
} 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) :: t_2
real(8) :: tmp
t_1 = (x_m / (t - z)) * (y - z)
t_2 = (x_m * (y - z)) / (t - z)
if (t_2 <= (-5d-99)) then
tmp = t_1
else if (t_2 <= (-1d-295)) then
tmp = ((y - z) * x_m) / t
else if (t_2 <= 3.1d-148) then
tmp = (z / (t - z)) * -x_m
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 / (t - z)) * (y - z);
double t_2 = (x_m * (y - z)) / (t - z);
double tmp;
if (t_2 <= -5e-99) {
tmp = t_1;
} else if (t_2 <= -1e-295) {
tmp = ((y - z) * x_m) / t;
} else if (t_2 <= 3.1e-148) {
tmp = (z / (t - z)) * -x_m;
} 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 / (t - z)) * (y - z) t_2 = (x_m * (y - z)) / (t - z) tmp = 0 if t_2 <= -5e-99: tmp = t_1 elif t_2 <= -1e-295: tmp = ((y - z) * x_m) / t elif t_2 <= 3.1e-148: tmp = (z / (t - z)) * -x_m 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(x_m / Float64(t - z)) * Float64(y - z)) t_2 = Float64(Float64(x_m * Float64(y - z)) / Float64(t - z)) tmp = 0.0 if (t_2 <= -5e-99) tmp = t_1; elseif (t_2 <= -1e-295) tmp = Float64(Float64(Float64(y - z) * x_m) / t); elseif (t_2 <= 3.1e-148) tmp = Float64(Float64(z / Float64(t - z)) * Float64(-x_m)); 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 / (t - z)) * (y - z); t_2 = (x_m * (y - z)) / (t - z); tmp = 0.0; if (t_2 <= -5e-99) tmp = t_1; elseif (t_2 <= -1e-295) tmp = ((y - z) * x_m) / t; elseif (t_2 <= 3.1e-148) tmp = (z / (t - z)) * -x_m; 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[(x$95$m / N[(t - z), $MachinePrecision]), $MachinePrecision] * N[(y - z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x$95$m * N[(y - z), $MachinePrecision]), $MachinePrecision] / N[(t - z), $MachinePrecision]), $MachinePrecision]}, N[(x$95$s * If[LessEqual[t$95$2, -5e-99], t$95$1, If[LessEqual[t$95$2, -1e-295], N[(N[(N[(y - z), $MachinePrecision] * x$95$m), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[t$95$2, 3.1e-148], N[(N[(z / N[(t - z), $MachinePrecision]), $MachinePrecision] * (-x$95$m)), $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{x\_m}{t - z} \cdot \left(y - z\right)\\
t_2 := \frac{x\_m \cdot \left(y - z\right)}{t - z}\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_2 \leq -5 \cdot 10^{-99}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq -1 \cdot 10^{-295}:\\
\;\;\;\;\frac{\left(y - z\right) \cdot x\_m}{t}\\
\mathbf{elif}\;t\_2 \leq 3.1 \cdot 10^{-148}:\\
\;\;\;\;\frac{z}{t - z} \cdot \left(-x\_m\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
\end{array}
if (/.f64 (*.f64 x (-.f64 y z)) (-.f64 t z)) < -4.99999999999999969e-99 or 3.1000000000000001e-148 < (/.f64 (*.f64 x (-.f64 y z)) (-.f64 t z)) Initial program 78.5%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6495.7
Applied rewrites95.7%
if -4.99999999999999969e-99 < (/.f64 (*.f64 x (-.f64 y z)) (-.f64 t z)) < -1.00000000000000006e-295Initial program 99.7%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6453.8
Applied rewrites53.8%
Taylor expanded in t around inf
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f6452.9
Applied rewrites52.9%
if -1.00000000000000006e-295 < (/.f64 (*.f64 x (-.f64 y z)) (-.f64 t z)) < 3.1000000000000001e-148Initial program 94.8%
Taylor expanded in y around 0
mul-1-negN/A
associate-/l*N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
mul-1-negN/A
lower-neg.f6478.7
Applied rewrites78.7%
Final simplification85.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 (or (<= t -1.55e+30) (not (<= t 9.5e+31)))
(* (/ (- y z) t) x_m)
(* (/ (- z y) z) 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 ((t <= -1.55e+30) || !(t <= 9.5e+31)) {
tmp = ((y - z) / t) * x_m;
} else {
tmp = ((z - y) / z) * 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 ((t <= (-1.55d+30)) .or. (.not. (t <= 9.5d+31))) then
tmp = ((y - z) / t) * x_m
else
tmp = ((z - y) / z) * 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 ((t <= -1.55e+30) || !(t <= 9.5e+31)) {
tmp = ((y - z) / t) * x_m;
} else {
tmp = ((z - y) / z) * 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 (t <= -1.55e+30) or not (t <= 9.5e+31): tmp = ((y - z) / t) * x_m else: tmp = ((z - y) / z) * 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 ((t <= -1.55e+30) || !(t <= 9.5e+31)) tmp = Float64(Float64(Float64(y - z) / t) * x_m); else tmp = Float64(Float64(Float64(z - y) / z) * 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 ((t <= -1.55e+30) || ~((t <= 9.5e+31))) tmp = ((y - z) / t) * x_m; else tmp = ((z - y) / z) * 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[Or[LessEqual[t, -1.55e+30], N[Not[LessEqual[t, 9.5e+31]], $MachinePrecision]], N[(N[(N[(y - z), $MachinePrecision] / t), $MachinePrecision] * x$95$m), $MachinePrecision], N[(N[(N[(z - y), $MachinePrecision] / z), $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}\;t \leq -1.55 \cdot 10^{+30} \lor \neg \left(t \leq 9.5 \cdot 10^{+31}\right):\\
\;\;\;\;\frac{y - z}{t} \cdot x\_m\\
\mathbf{else}:\\
\;\;\;\;\frac{z - y}{z} \cdot x\_m\\
\end{array}
\end{array}
if t < -1.5499999999999999e30 or 9.5000000000000008e31 < t Initial program 85.1%
Taylor expanded in t around inf
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6484.7
Applied rewrites84.7%
if -1.5499999999999999e30 < t < 9.5000000000000008e31Initial program 85.1%
Taylor expanded in t around 0
mul-1-negN/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
distribute-neg-fracN/A
lower-/.f64N/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
distribute-neg-inN/A
mul-1-negN/A
remove-double-negN/A
mul-1-negN/A
metadata-evalN/A
fp-cancel-sub-sign-invN/A
*-lft-identityN/A
lower--.f6480.5
Applied rewrites80.5%
Final simplification82.3%
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 (or (<= t -1.55e+30) (not (<= t 8.5e+31)))
(* (/ (- y z) t) x_m)
(- x_m (/ (* y x_m) 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 ((t <= -1.55e+30) || !(t <= 8.5e+31)) {
tmp = ((y - z) / t) * x_m;
} else {
tmp = x_m - ((y * x_m) / 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 ((t <= (-1.55d+30)) .or. (.not. (t <= 8.5d+31))) then
tmp = ((y - z) / t) * x_m
else
tmp = x_m - ((y * x_m) / 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 ((t <= -1.55e+30) || !(t <= 8.5e+31)) {
tmp = ((y - z) / t) * x_m;
} else {
tmp = x_m - ((y * x_m) / 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 (t <= -1.55e+30) or not (t <= 8.5e+31): tmp = ((y - z) / t) * x_m else: tmp = x_m - ((y * x_m) / 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 ((t <= -1.55e+30) || !(t <= 8.5e+31)) tmp = Float64(Float64(Float64(y - z) / t) * x_m); else tmp = Float64(x_m - Float64(Float64(y * x_m) / 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 ((t <= -1.55e+30) || ~((t <= 8.5e+31))) tmp = ((y - z) / t) * x_m; else tmp = x_m - ((y * x_m) / 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[Or[LessEqual[t, -1.55e+30], N[Not[LessEqual[t, 8.5e+31]], $MachinePrecision]], N[(N[(N[(y - z), $MachinePrecision] / t), $MachinePrecision] * x$95$m), $MachinePrecision], N[(x$95$m - N[(N[(y * x$95$m), $MachinePrecision] / 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}\;t \leq -1.55 \cdot 10^{+30} \lor \neg \left(t \leq 8.5 \cdot 10^{+31}\right):\\
\;\;\;\;\frac{y - z}{t} \cdot x\_m\\
\mathbf{else}:\\
\;\;\;\;x\_m - \frac{y \cdot x\_m}{z}\\
\end{array}
\end{array}
if t < -1.5499999999999999e30 or 8.49999999999999947e31 < t Initial program 85.1%
Taylor expanded in t around inf
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6484.7
Applied rewrites84.7%
if -1.5499999999999999e30 < t < 8.49999999999999947e31Initial program 85.1%
Taylor expanded in t around 0
mul-1-negN/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
distribute-neg-fracN/A
lower-/.f64N/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
distribute-neg-inN/A
mul-1-negN/A
remove-double-negN/A
mul-1-negN/A
metadata-evalN/A
fp-cancel-sub-sign-invN/A
*-lft-identityN/A
lower--.f6480.5
Applied rewrites80.5%
Taylor expanded in y around 0
Applied rewrites77.9%
Final simplification80.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 (or (<= t -1.55e+30) (not (<= t 1e+33)))
(/ (* (- y z) x_m) t)
(- x_m (/ (* y x_m) 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 ((t <= -1.55e+30) || !(t <= 1e+33)) {
tmp = ((y - z) * x_m) / t;
} else {
tmp = x_m - ((y * x_m) / 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 ((t <= (-1.55d+30)) .or. (.not. (t <= 1d+33))) then
tmp = ((y - z) * x_m) / t
else
tmp = x_m - ((y * x_m) / 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 ((t <= -1.55e+30) || !(t <= 1e+33)) {
tmp = ((y - z) * x_m) / t;
} else {
tmp = x_m - ((y * x_m) / 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 (t <= -1.55e+30) or not (t <= 1e+33): tmp = ((y - z) * x_m) / t else: tmp = x_m - ((y * x_m) / 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 ((t <= -1.55e+30) || !(t <= 1e+33)) tmp = Float64(Float64(Float64(y - z) * x_m) / t); else tmp = Float64(x_m - Float64(Float64(y * x_m) / 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 ((t <= -1.55e+30) || ~((t <= 1e+33))) tmp = ((y - z) * x_m) / t; else tmp = x_m - ((y * x_m) / 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[Or[LessEqual[t, -1.55e+30], N[Not[LessEqual[t, 1e+33]], $MachinePrecision]], N[(N[(N[(y - z), $MachinePrecision] * x$95$m), $MachinePrecision] / t), $MachinePrecision], N[(x$95$m - N[(N[(y * x$95$m), $MachinePrecision] / 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}\;t \leq -1.55 \cdot 10^{+30} \lor \neg \left(t \leq 10^{+33}\right):\\
\;\;\;\;\frac{\left(y - z\right) \cdot x\_m}{t}\\
\mathbf{else}:\\
\;\;\;\;x\_m - \frac{y \cdot x\_m}{z}\\
\end{array}
\end{array}
if t < -1.5499999999999999e30 or 9.9999999999999995e32 < t Initial program 85.1%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6480.6
Applied rewrites80.6%
Taylor expanded in t around inf
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f6476.2
Applied rewrites76.2%
if -1.5499999999999999e30 < t < 9.9999999999999995e32Initial program 85.1%
Taylor expanded in t around 0
mul-1-negN/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
distribute-neg-fracN/A
lower-/.f64N/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
distribute-neg-inN/A
mul-1-negN/A
remove-double-negN/A
mul-1-negN/A
metadata-evalN/A
fp-cancel-sub-sign-invN/A
*-lft-identityN/A
lower--.f6480.5
Applied rewrites80.5%
Taylor expanded in y around 0
Applied rewrites77.9%
Final simplification77.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 (or (<= z -2.3e+71) (not (<= z 8.5e+131)))
(* 1.0 x_m)
(/ (* (- y z) x_m) 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 <= -2.3e+71) || !(z <= 8.5e+131)) {
tmp = 1.0 * x_m;
} else {
tmp = ((y - z) * x_m) / t;
}
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 <= (-2.3d+71)) .or. (.not. (z <= 8.5d+131))) then
tmp = 1.0d0 * x_m
else
tmp = ((y - z) * x_m) / t
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 <= -2.3e+71) || !(z <= 8.5e+131)) {
tmp = 1.0 * x_m;
} else {
tmp = ((y - z) * x_m) / t;
}
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 <= -2.3e+71) or not (z <= 8.5e+131): tmp = 1.0 * x_m else: tmp = ((y - z) * x_m) / 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 <= -2.3e+71) || !(z <= 8.5e+131)) tmp = Float64(1.0 * x_m); else tmp = Float64(Float64(Float64(y - z) * x_m) / t); 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 <= -2.3e+71) || ~((z <= 8.5e+131))) tmp = 1.0 * x_m; else tmp = ((y - z) * x_m) / t; 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[Or[LessEqual[z, -2.3e+71], N[Not[LessEqual[z, 8.5e+131]], $MachinePrecision]], N[(1.0 * x$95$m), $MachinePrecision], N[(N[(N[(y - z), $MachinePrecision] * x$95$m), $MachinePrecision] / t), $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 -2.3 \cdot 10^{+71} \lor \neg \left(z \leq 8.5 \cdot 10^{+131}\right):\\
\;\;\;\;1 \cdot x\_m\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(y - z\right) \cdot x\_m}{t}\\
\end{array}
\end{array}
if z < -2.3000000000000002e71 or 8.50000000000000063e131 < z Initial program 69.2%
Taylor expanded in t around 0
mul-1-negN/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
distribute-neg-fracN/A
lower-/.f64N/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
distribute-neg-inN/A
mul-1-negN/A
remove-double-negN/A
mul-1-negN/A
metadata-evalN/A
fp-cancel-sub-sign-invN/A
*-lft-identityN/A
lower--.f6482.4
Applied rewrites82.4%
Taylor expanded in y around 0
Applied rewrites69.6%
if -2.3000000000000002e71 < z < 8.50000000000000063e131Initial program 93.2%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6491.3
Applied rewrites91.3%
Taylor expanded in t around inf
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f6465.6
Applied rewrites65.6%
Final simplification66.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 (or (<= z -1.55e+54) (not (<= z 9.5e-8))) (* 1.0 x_m) (* x_m (/ y 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 <= -1.55e+54) || !(z <= 9.5e-8)) {
tmp = 1.0 * x_m;
} else {
tmp = x_m * (y / t);
}
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 <= (-1.55d+54)) .or. (.not. (z <= 9.5d-8))) then
tmp = 1.0d0 * x_m
else
tmp = x_m * (y / t)
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 <= -1.55e+54) || !(z <= 9.5e-8)) {
tmp = 1.0 * x_m;
} else {
tmp = x_m * (y / t);
}
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 <= -1.55e+54) or not (z <= 9.5e-8): tmp = 1.0 * x_m else: tmp = x_m * (y / 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 <= -1.55e+54) || !(z <= 9.5e-8)) tmp = Float64(1.0 * x_m); else tmp = Float64(x_m * Float64(y / t)); 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 <= -1.55e+54) || ~((z <= 9.5e-8))) tmp = 1.0 * x_m; else tmp = x_m * (y / t); 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[Or[LessEqual[z, -1.55e+54], N[Not[LessEqual[z, 9.5e-8]], $MachinePrecision]], N[(1.0 * x$95$m), $MachinePrecision], N[(x$95$m * N[(y / t), $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 -1.55 \cdot 10^{+54} \lor \neg \left(z \leq 9.5 \cdot 10^{-8}\right):\\
\;\;\;\;1 \cdot x\_m\\
\mathbf{else}:\\
\;\;\;\;x\_m \cdot \frac{y}{t}\\
\end{array}
\end{array}
if z < -1.55e54 or 9.50000000000000036e-8 < z Initial program 76.5%
Taylor expanded in t around 0
mul-1-negN/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
distribute-neg-fracN/A
lower-/.f64N/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
distribute-neg-inN/A
mul-1-negN/A
remove-double-negN/A
mul-1-negN/A
metadata-evalN/A
fp-cancel-sub-sign-invN/A
*-lft-identityN/A
lower--.f6476.7
Applied rewrites76.7%
Taylor expanded in y around 0
Applied rewrites59.3%
if -1.55e54 < z < 9.50000000000000036e-8Initial program 92.4%
Taylor expanded in z around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f6464.7
Applied rewrites64.7%
Applied rewrites67.3%
Final simplification63.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 (* 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.1%
Taylor expanded in t around 0
mul-1-negN/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
distribute-neg-fracN/A
lower-/.f64N/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
distribute-neg-inN/A
mul-1-negN/A
remove-double-negN/A
mul-1-negN/A
metadata-evalN/A
fp-cancel-sub-sign-invN/A
*-lft-identityN/A
lower--.f6452.2
Applied rewrites52.2%
Taylor expanded in y around 0
Applied rewrites33.0%
Final simplification33.0%
(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 2024342
(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)))