
(FPCore (x y z t) :precision binary64 :pre TRUE (/ (* x 2.0) (- (* y z) (* t z))))
double code(double x, double y, double z, double t) {
return (x * 2.0) / ((y * z) - (t * z));
}
real(8) function code(x, y, z, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (x * 2.0d0) / ((y * z) - (t * z))
end function
public static double code(double x, double y, double z, double t) {
return (x * 2.0) / ((y * z) - (t * z));
}
def code(x, y, z, t): return (x * 2.0) / ((y * z) - (t * z))
function code(x, y, z, t) return Float64(Float64(x * 2.0) / Float64(Float64(y * z) - Float64(t * z))) end
function tmp = code(x, y, z, t) tmp = (x * 2.0) / ((y * z) - (t * z)); end
code[x_, y_, z_, t_] := N[(N[(x * 2.0), $MachinePrecision] / N[(N[(y * z), $MachinePrecision] - N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
f(x, y, z, t): x in [-inf, +inf], y in [-inf, +inf], z in [-inf, +inf], t in [-inf, +inf] code: THEORY BEGIN f(x, y, z, t: real): real = (x * (2)) / ((y * z) - (t * z)) END code
\frac{x \cdot 2}{y \cdot z - t \cdot z}
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 :pre TRUE (/ (* x 2.0) (- (* y z) (* t z))))
double code(double x, double y, double z, double t) {
return (x * 2.0) / ((y * z) - (t * z));
}
real(8) function code(x, y, z, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (x * 2.0d0) / ((y * z) - (t * z))
end function
public static double code(double x, double y, double z, double t) {
return (x * 2.0) / ((y * z) - (t * z));
}
def code(x, y, z, t): return (x * 2.0) / ((y * z) - (t * z))
function code(x, y, z, t) return Float64(Float64(x * 2.0) / Float64(Float64(y * z) - Float64(t * z))) end
function tmp = code(x, y, z, t) tmp = (x * 2.0) / ((y * z) - (t * z)); end
code[x_, y_, z_, t_] := N[(N[(x * 2.0), $MachinePrecision] / N[(N[(y * z), $MachinePrecision] - N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
f(x, y, z, t): x in [-inf, +inf], y in [-inf, +inf], z in [-inf, +inf], t in [-inf, +inf] code: THEORY BEGIN f(x, y, z, t: real): real = (x * (2)) / ((y * z) - (t * z)) END code
\frac{x \cdot 2}{y \cdot z - t \cdot z}
(FPCore (x y z t)
:precision binary64
:pre TRUE
(let* ((t_1 (+ (fabs x) (fabs x)))
(t_2 (/ t_1 (* (- y t) (fabs z))))
(t_3 (/ (* (fabs x) 2.0) (- (* y (fabs z)) (* t (fabs z)))))
(t_4 (/ (/ t_1 (fabs z)) (- y t))))
(*
(copysign 1.0 x)
(*
(copysign 1.0 z)
(if (<= t_3 -4e-269)
t_2
(if (<= t_3 0.0) t_4 (if (<= t_3 4e+293) t_2 t_4)))))))double code(double x, double y, double z, double t) {
double t_1 = fabs(x) + fabs(x);
double t_2 = t_1 / ((y - t) * fabs(z));
double t_3 = (fabs(x) * 2.0) / ((y * fabs(z)) - (t * fabs(z)));
double t_4 = (t_1 / fabs(z)) / (y - t);
double tmp;
if (t_3 <= -4e-269) {
tmp = t_2;
} else if (t_3 <= 0.0) {
tmp = t_4;
} else if (t_3 <= 4e+293) {
tmp = t_2;
} else {
tmp = t_4;
}
return copysign(1.0, x) * (copysign(1.0, z) * tmp);
}
public static double code(double x, double y, double z, double t) {
double t_1 = Math.abs(x) + Math.abs(x);
double t_2 = t_1 / ((y - t) * Math.abs(z));
double t_3 = (Math.abs(x) * 2.0) / ((y * Math.abs(z)) - (t * Math.abs(z)));
double t_4 = (t_1 / Math.abs(z)) / (y - t);
double tmp;
if (t_3 <= -4e-269) {
tmp = t_2;
} else if (t_3 <= 0.0) {
tmp = t_4;
} else if (t_3 <= 4e+293) {
tmp = t_2;
} else {
tmp = t_4;
}
return Math.copySign(1.0, x) * (Math.copySign(1.0, z) * tmp);
}
def code(x, y, z, t): t_1 = math.fabs(x) + math.fabs(x) t_2 = t_1 / ((y - t) * math.fabs(z)) t_3 = (math.fabs(x) * 2.0) / ((y * math.fabs(z)) - (t * math.fabs(z))) t_4 = (t_1 / math.fabs(z)) / (y - t) tmp = 0 if t_3 <= -4e-269: tmp = t_2 elif t_3 <= 0.0: tmp = t_4 elif t_3 <= 4e+293: tmp = t_2 else: tmp = t_4 return math.copysign(1.0, x) * (math.copysign(1.0, z) * tmp)
function code(x, y, z, t) t_1 = Float64(abs(x) + abs(x)) t_2 = Float64(t_1 / Float64(Float64(y - t) * abs(z))) t_3 = Float64(Float64(abs(x) * 2.0) / Float64(Float64(y * abs(z)) - Float64(t * abs(z)))) t_4 = Float64(Float64(t_1 / abs(z)) / Float64(y - t)) tmp = 0.0 if (t_3 <= -4e-269) tmp = t_2; elseif (t_3 <= 0.0) tmp = t_4; elseif (t_3 <= 4e+293) tmp = t_2; else tmp = t_4; end return Float64(copysign(1.0, x) * Float64(copysign(1.0, z) * tmp)) end
function tmp_2 = code(x, y, z, t) t_1 = abs(x) + abs(x); t_2 = t_1 / ((y - t) * abs(z)); t_3 = (abs(x) * 2.0) / ((y * abs(z)) - (t * abs(z))); t_4 = (t_1 / abs(z)) / (y - t); tmp = 0.0; if (t_3 <= -4e-269) tmp = t_2; elseif (t_3 <= 0.0) tmp = t_4; elseif (t_3 <= 4e+293) tmp = t_2; else tmp = t_4; end tmp_2 = (sign(x) * abs(1.0)) * ((sign(z) * abs(1.0)) * tmp); end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Abs[x], $MachinePrecision] + N[Abs[x], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 / N[(N[(y - t), $MachinePrecision] * N[Abs[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(N[Abs[x], $MachinePrecision] * 2.0), $MachinePrecision] / N[(N[(y * N[Abs[z], $MachinePrecision]), $MachinePrecision] - N[(t * N[Abs[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(N[(t$95$1 / N[Abs[z], $MachinePrecision]), $MachinePrecision] / N[(y - t), $MachinePrecision]), $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[t$95$3, -4e-269], t$95$2, If[LessEqual[t$95$3, 0.0], t$95$4, If[LessEqual[t$95$3, 4e+293], t$95$2, t$95$4]]]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
t_1 := \left|x\right| + \left|x\right|\\
t_2 := \frac{t\_1}{\left(y - t\right) \cdot \left|z\right|}\\
t_3 := \frac{\left|x\right| \cdot 2}{y \cdot \left|z\right| - t \cdot \left|z\right|}\\
t_4 := \frac{\frac{t\_1}{\left|z\right|}}{y - t}\\
\mathsf{copysign}\left(1, x\right) \cdot \left(\mathsf{copysign}\left(1, z\right) \cdot \begin{array}{l}
\mathbf{if}\;t\_3 \leq -4 \cdot 10^{-269}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_3 \leq 0:\\
\;\;\;\;t\_4\\
\mathbf{elif}\;t\_3 \leq 4 \cdot 10^{+293}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_4\\
\end{array}\right)
\end{array}
if (/.f64 (*.f64 x #s(literal 2 binary64)) (-.f64 (*.f64 y z) (*.f64 t z))) < -3.9999999999999998e-269 or -0.0 < (/.f64 (*.f64 x #s(literal 2 binary64)) (-.f64 (*.f64 y z) (*.f64 t z))) < 3.9999999999999997e293Initial program 89.9%
Applied rewrites92.0%
if -3.9999999999999998e-269 < (/.f64 (*.f64 x #s(literal 2 binary64)) (-.f64 (*.f64 y z) (*.f64 t z))) < -0.0 or 3.9999999999999997e293 < (/.f64 (*.f64 x #s(literal 2 binary64)) (-.f64 (*.f64 y z) (*.f64 t z))) Initial program 89.9%
Applied rewrites92.4%
(FPCore (x y z t)
:precision binary64
:pre TRUE
(let* ((t_1 (+ (fabs x) (fabs x)))
(t_2 (/ (* (fabs x) 2.0) (- (* y (fabs z)) (* t (fabs z))))))
(*
(copysign 1.0 x)
(*
(copysign 1.0 z)
(if (<= t_2 -4e-269)
(/ t_1 (* (- y t) (fabs z)))
(if (<= t_2 5e+82)
(/ (/ t_1 (fabs z)) (- y t))
(/ (/ t_1 (- y t)) (fabs z))))))))double code(double x, double y, double z, double t) {
double t_1 = fabs(x) + fabs(x);
double t_2 = (fabs(x) * 2.0) / ((y * fabs(z)) - (t * fabs(z)));
double tmp;
if (t_2 <= -4e-269) {
tmp = t_1 / ((y - t) * fabs(z));
} else if (t_2 <= 5e+82) {
tmp = (t_1 / fabs(z)) / (y - t);
} else {
tmp = (t_1 / (y - t)) / fabs(z);
}
return copysign(1.0, x) * (copysign(1.0, z) * tmp);
}
public static double code(double x, double y, double z, double t) {
double t_1 = Math.abs(x) + Math.abs(x);
double t_2 = (Math.abs(x) * 2.0) / ((y * Math.abs(z)) - (t * Math.abs(z)));
double tmp;
if (t_2 <= -4e-269) {
tmp = t_1 / ((y - t) * Math.abs(z));
} else if (t_2 <= 5e+82) {
tmp = (t_1 / Math.abs(z)) / (y - t);
} else {
tmp = (t_1 / (y - t)) / Math.abs(z);
}
return Math.copySign(1.0, x) * (Math.copySign(1.0, z) * tmp);
}
def code(x, y, z, t): t_1 = math.fabs(x) + math.fabs(x) t_2 = (math.fabs(x) * 2.0) / ((y * math.fabs(z)) - (t * math.fabs(z))) tmp = 0 if t_2 <= -4e-269: tmp = t_1 / ((y - t) * math.fabs(z)) elif t_2 <= 5e+82: tmp = (t_1 / math.fabs(z)) / (y - t) else: tmp = (t_1 / (y - t)) / math.fabs(z) return math.copysign(1.0, x) * (math.copysign(1.0, z) * tmp)
function code(x, y, z, t) t_1 = Float64(abs(x) + abs(x)) t_2 = Float64(Float64(abs(x) * 2.0) / Float64(Float64(y * abs(z)) - Float64(t * abs(z)))) tmp = 0.0 if (t_2 <= -4e-269) tmp = Float64(t_1 / Float64(Float64(y - t) * abs(z))); elseif (t_2 <= 5e+82) tmp = Float64(Float64(t_1 / abs(z)) / Float64(y - t)); else tmp = Float64(Float64(t_1 / Float64(y - t)) / abs(z)); end return Float64(copysign(1.0, x) * Float64(copysign(1.0, z) * tmp)) end
function tmp_2 = code(x, y, z, t) t_1 = abs(x) + abs(x); t_2 = (abs(x) * 2.0) / ((y * abs(z)) - (t * abs(z))); tmp = 0.0; if (t_2 <= -4e-269) tmp = t_1 / ((y - t) * abs(z)); elseif (t_2 <= 5e+82) tmp = (t_1 / abs(z)) / (y - t); else tmp = (t_1 / (y - t)) / abs(z); end tmp_2 = (sign(x) * abs(1.0)) * ((sign(z) * abs(1.0)) * tmp); end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Abs[x], $MachinePrecision] + N[Abs[x], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[Abs[x], $MachinePrecision] * 2.0), $MachinePrecision] / N[(N[(y * N[Abs[z], $MachinePrecision]), $MachinePrecision] - N[(t * N[Abs[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[t$95$2, -4e-269], N[(t$95$1 / N[(N[(y - t), $MachinePrecision] * N[Abs[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 5e+82], N[(N[(t$95$1 / N[Abs[z], $MachinePrecision]), $MachinePrecision] / N[(y - t), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$1 / N[(y - t), $MachinePrecision]), $MachinePrecision] / N[Abs[z], $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
t_1 := \left|x\right| + \left|x\right|\\
t_2 := \frac{\left|x\right| \cdot 2}{y \cdot \left|z\right| - t \cdot \left|z\right|}\\
\mathsf{copysign}\left(1, x\right) \cdot \left(\mathsf{copysign}\left(1, z\right) \cdot \begin{array}{l}
\mathbf{if}\;t\_2 \leq -4 \cdot 10^{-269}:\\
\;\;\;\;\frac{t\_1}{\left(y - t\right) \cdot \left|z\right|}\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+82}:\\
\;\;\;\;\frac{\frac{t\_1}{\left|z\right|}}{y - t}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{t\_1}{y - t}}{\left|z\right|}\\
\end{array}\right)
\end{array}
if (/.f64 (*.f64 x #s(literal 2 binary64)) (-.f64 (*.f64 y z) (*.f64 t z))) < -3.9999999999999998e-269Initial program 89.9%
Applied rewrites92.0%
if -3.9999999999999998e-269 < (/.f64 (*.f64 x #s(literal 2 binary64)) (-.f64 (*.f64 y z) (*.f64 t z))) < 5.0000000000000002e82Initial program 89.9%
Applied rewrites92.4%
if 5.0000000000000002e82 < (/.f64 (*.f64 x #s(literal 2 binary64)) (-.f64 (*.f64 y z) (*.f64 t z))) Initial program 89.9%
Applied rewrites91.8%
(FPCore (x y z t) :precision binary64 :pre TRUE (* x (/ -2.0 (* (- t y) z))))
double code(double x, double y, double z, double t) {
return x * (-2.0 / ((t - y) * z));
}
real(8) function code(x, y, z, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x * ((-2.0d0) / ((t - y) * z))
end function
public static double code(double x, double y, double z, double t) {
return x * (-2.0 / ((t - y) * z));
}
def code(x, y, z, t): return x * (-2.0 / ((t - y) * z))
function code(x, y, z, t) return Float64(x * Float64(-2.0 / Float64(Float64(t - y) * z))) end
function tmp = code(x, y, z, t) tmp = x * (-2.0 / ((t - y) * z)); end
code[x_, y_, z_, t_] := N[(x * N[(-2.0 / N[(N[(t - y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
f(x, y, z, t): x in [-inf, +inf], y in [-inf, +inf], z in [-inf, +inf], t in [-inf, +inf] code: THEORY BEGIN f(x, y, z, t: real): real = x * ((-2) / ((t - y) * z)) END code
x \cdot \frac{-2}{\left(t - y\right) \cdot z}
Initial program 89.9%
Applied rewrites91.7%
(FPCore (x y z t) :precision binary64 :pre TRUE (/ (+ x x) (* (- y t) z)))
double code(double x, double y, double z, double t) {
return (x + x) / ((y - t) * z);
}
real(8) function code(x, y, z, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (x + x) / ((y - t) * z)
end function
public static double code(double x, double y, double z, double t) {
return (x + x) / ((y - t) * z);
}
def code(x, y, z, t): return (x + x) / ((y - t) * z)
function code(x, y, z, t) return Float64(Float64(x + x) / Float64(Float64(y - t) * z)) end
function tmp = code(x, y, z, t) tmp = (x + x) / ((y - t) * z); end
code[x_, y_, z_, t_] := N[(N[(x + x), $MachinePrecision] / N[(N[(y - t), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]
f(x, y, z, t): x in [-inf, +inf], y in [-inf, +inf], z in [-inf, +inf], t in [-inf, +inf] code: THEORY BEGIN f(x, y, z, t: real): real = (x + x) / ((y - t) * z) END code
\frac{x + x}{\left(y - t\right) \cdot z}
Initial program 89.9%
Applied rewrites92.0%
(FPCore (x y z t)
:precision binary64
:pre TRUE
(if (<= y -8.287230547520723e-60)
(* (/ 2.0 z) (/ x y))
(if (<= y 1.0987282508224486e+71)
(* -2.0 (/ (/ x t) z))
(/ (/ (+ x x) z) y))))double code(double x, double y, double z, double t) {
double tmp;
if (y <= -8.287230547520723e-60) {
tmp = (2.0 / z) * (x / y);
} else if (y <= 1.0987282508224486e+71) {
tmp = -2.0 * ((x / t) / z);
} else {
tmp = ((x + x) / z) / y;
}
return tmp;
}
real(8) function code(x, y, z, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= (-8.287230547520723d-60)) then
tmp = (2.0d0 / z) * (x / y)
else if (y <= 1.0987282508224486d+71) then
tmp = (-2.0d0) * ((x / t) / z)
else
tmp = ((x + x) / z) / y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -8.287230547520723e-60) {
tmp = (2.0 / z) * (x / y);
} else if (y <= 1.0987282508224486e+71) {
tmp = -2.0 * ((x / t) / z);
} else {
tmp = ((x + x) / z) / y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -8.287230547520723e-60: tmp = (2.0 / z) * (x / y) elif y <= 1.0987282508224486e+71: tmp = -2.0 * ((x / t) / z) else: tmp = ((x + x) / z) / y return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -8.287230547520723e-60) tmp = Float64(Float64(2.0 / z) * Float64(x / y)); elseif (y <= 1.0987282508224486e+71) tmp = Float64(-2.0 * Float64(Float64(x / t) / z)); else tmp = Float64(Float64(Float64(x + x) / z) / y); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -8.287230547520723e-60) tmp = (2.0 / z) * (x / y); elseif (y <= 1.0987282508224486e+71) tmp = -2.0 * ((x / t) / z); else tmp = ((x + x) / z) / y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -8.287230547520723e-60], N[(N[(2.0 / z), $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.0987282508224486e+71], N[(-2.0 * N[(N[(x / t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x + x), $MachinePrecision] / z), $MachinePrecision] / y), $MachinePrecision]]]
f(x, y, z, t): x in [-inf, +inf], y in [-inf, +inf], z in [-inf, +inf], t in [-inf, +inf] code: THEORY BEGIN f(x, y, z, t: real): real = LET tmp_1 = IF (y <= (109872825082244857240073441999150846797813910160089051785476223503695872)) THEN ((-2) * ((x / t) / z)) ELSE (((x + x) / z) / y) ENDIF IN LET tmp = IF (y <= (-8287230547520722800539378603997809920699682965694844179819029341478256449086590626160412372225455986379631887716885444568010318594655008650643349750637700612543312672642059624195098876953125e-249)) THEN (((2) / z) * (x / y)) ELSE tmp_1 ENDIF IN tmp END code
\begin{array}{l}
\mathbf{if}\;y \leq -8.287230547520723 \cdot 10^{-60}:\\
\;\;\;\;\frac{2}{z} \cdot \frac{x}{y}\\
\mathbf{elif}\;y \leq 1.0987282508224486 \cdot 10^{+71}:\\
\;\;\;\;-2 \cdot \frac{\frac{x}{t}}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x + x}{z}}{y}\\
\end{array}
if y < -8.2872305475207228e-60Initial program 89.9%
Taylor expanded in y around inf
Applied rewrites53.5%
Applied rewrites53.4%
if -8.2872305475207228e-60 < y < 1.0987282508224486e71Initial program 89.9%
Taylor expanded in y around 0
Applied rewrites53.6%
Applied rewrites53.3%
if 1.0987282508224486e71 < y Initial program 89.9%
Taylor expanded in y around inf
Applied rewrites53.5%
Applied rewrites55.6%
(FPCore (x y z t)
:precision binary64
:pre TRUE
(if (<= y -8.287230547520723e-60)
(/ (+ x x) (* z y))
(if (<= y 1.0987282508224486e+71)
(* -2.0 (/ (/ x t) z))
(/ (/ (+ x x) z) y))))double code(double x, double y, double z, double t) {
double tmp;
if (y <= -8.287230547520723e-60) {
tmp = (x + x) / (z * y);
} else if (y <= 1.0987282508224486e+71) {
tmp = -2.0 * ((x / t) / z);
} else {
tmp = ((x + x) / z) / y;
}
return tmp;
}
real(8) function code(x, y, z, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= (-8.287230547520723d-60)) then
tmp = (x + x) / (z * y)
else if (y <= 1.0987282508224486d+71) then
tmp = (-2.0d0) * ((x / t) / z)
else
tmp = ((x + x) / z) / y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -8.287230547520723e-60) {
tmp = (x + x) / (z * y);
} else if (y <= 1.0987282508224486e+71) {
tmp = -2.0 * ((x / t) / z);
} else {
tmp = ((x + x) / z) / y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -8.287230547520723e-60: tmp = (x + x) / (z * y) elif y <= 1.0987282508224486e+71: tmp = -2.0 * ((x / t) / z) else: tmp = ((x + x) / z) / y return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -8.287230547520723e-60) tmp = Float64(Float64(x + x) / Float64(z * y)); elseif (y <= 1.0987282508224486e+71) tmp = Float64(-2.0 * Float64(Float64(x / t) / z)); else tmp = Float64(Float64(Float64(x + x) / z) / y); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -8.287230547520723e-60) tmp = (x + x) / (z * y); elseif (y <= 1.0987282508224486e+71) tmp = -2.0 * ((x / t) / z); else tmp = ((x + x) / z) / y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -8.287230547520723e-60], N[(N[(x + x), $MachinePrecision] / N[(z * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.0987282508224486e+71], N[(-2.0 * N[(N[(x / t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x + x), $MachinePrecision] / z), $MachinePrecision] / y), $MachinePrecision]]]
f(x, y, z, t): x in [-inf, +inf], y in [-inf, +inf], z in [-inf, +inf], t in [-inf, +inf] code: THEORY BEGIN f(x, y, z, t: real): real = LET tmp_1 = IF (y <= (109872825082244857240073441999150846797813910160089051785476223503695872)) THEN ((-2) * ((x / t) / z)) ELSE (((x + x) / z) / y) ENDIF IN LET tmp = IF (y <= (-8287230547520722800539378603997809920699682965694844179819029341478256449086590626160412372225455986379631887716885444568010318594655008650643349750637700612543312672642059624195098876953125e-249)) THEN ((x + x) / (z * y)) ELSE tmp_1 ENDIF IN tmp END code
\begin{array}{l}
\mathbf{if}\;y \leq -8.287230547520723 \cdot 10^{-60}:\\
\;\;\;\;\frac{x + x}{z \cdot y}\\
\mathbf{elif}\;y \leq 1.0987282508224486 \cdot 10^{+71}:\\
\;\;\;\;-2 \cdot \frac{\frac{x}{t}}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x + x}{z}}{y}\\
\end{array}
if y < -8.2872305475207228e-60Initial program 89.9%
Taylor expanded in y around inf
Applied rewrites53.5%
Applied rewrites53.5%
if -8.2872305475207228e-60 < y < 1.0987282508224486e71Initial program 89.9%
Taylor expanded in y around 0
Applied rewrites53.6%
Applied rewrites53.3%
if 1.0987282508224486e71 < y Initial program 89.9%
Taylor expanded in y around inf
Applied rewrites53.5%
Applied rewrites55.6%
(FPCore (x y z t)
:precision binary64
:pre TRUE
(if (<= y -8.287230547520723e-60)
(/ (+ x x) (* z y))
(if (<= y 1.0987282508224486e+71)
(* -2.0 (/ x (* t z)))
(/ (/ (+ x x) z) y))))double code(double x, double y, double z, double t) {
double tmp;
if (y <= -8.287230547520723e-60) {
tmp = (x + x) / (z * y);
} else if (y <= 1.0987282508224486e+71) {
tmp = -2.0 * (x / (t * z));
} else {
tmp = ((x + x) / z) / y;
}
return tmp;
}
real(8) function code(x, y, z, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= (-8.287230547520723d-60)) then
tmp = (x + x) / (z * y)
else if (y <= 1.0987282508224486d+71) then
tmp = (-2.0d0) * (x / (t * z))
else
tmp = ((x + x) / z) / y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -8.287230547520723e-60) {
tmp = (x + x) / (z * y);
} else if (y <= 1.0987282508224486e+71) {
tmp = -2.0 * (x / (t * z));
} else {
tmp = ((x + x) / z) / y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -8.287230547520723e-60: tmp = (x + x) / (z * y) elif y <= 1.0987282508224486e+71: tmp = -2.0 * (x / (t * z)) else: tmp = ((x + x) / z) / y return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -8.287230547520723e-60) tmp = Float64(Float64(x + x) / Float64(z * y)); elseif (y <= 1.0987282508224486e+71) tmp = Float64(-2.0 * Float64(x / Float64(t * z))); else tmp = Float64(Float64(Float64(x + x) / z) / y); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -8.287230547520723e-60) tmp = (x + x) / (z * y); elseif (y <= 1.0987282508224486e+71) tmp = -2.0 * (x / (t * z)); else tmp = ((x + x) / z) / y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -8.287230547520723e-60], N[(N[(x + x), $MachinePrecision] / N[(z * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.0987282508224486e+71], N[(-2.0 * N[(x / N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x + x), $MachinePrecision] / z), $MachinePrecision] / y), $MachinePrecision]]]
f(x, y, z, t): x in [-inf, +inf], y in [-inf, +inf], z in [-inf, +inf], t in [-inf, +inf] code: THEORY BEGIN f(x, y, z, t: real): real = LET tmp_1 = IF (y <= (109872825082244857240073441999150846797813910160089051785476223503695872)) THEN ((-2) * (x / (t * z))) ELSE (((x + x) / z) / y) ENDIF IN LET tmp = IF (y <= (-8287230547520722800539378603997809920699682965694844179819029341478256449086590626160412372225455986379631887716885444568010318594655008650643349750637700612543312672642059624195098876953125e-249)) THEN ((x + x) / (z * y)) ELSE tmp_1 ENDIF IN tmp END code
\begin{array}{l}
\mathbf{if}\;y \leq -8.287230547520723 \cdot 10^{-60}:\\
\;\;\;\;\frac{x + x}{z \cdot y}\\
\mathbf{elif}\;y \leq 1.0987282508224486 \cdot 10^{+71}:\\
\;\;\;\;-2 \cdot \frac{x}{t \cdot z}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x + x}{z}}{y}\\
\end{array}
if y < -8.2872305475207228e-60Initial program 89.9%
Taylor expanded in y around inf
Applied rewrites53.5%
Applied rewrites53.5%
if -8.2872305475207228e-60 < y < 1.0987282508224486e71Initial program 89.9%
Taylor expanded in y around 0
Applied rewrites53.6%
if 1.0987282508224486e71 < y Initial program 89.9%
Taylor expanded in y around inf
Applied rewrites53.5%
Applied rewrites55.6%
(FPCore (x y z t)
:precision binary64
:pre TRUE
(let* ((t_1 (/ (+ x x) (* z y))))
(if (<= y -8.287230547520723e-60)
t_1
(if (<= y 1.0987282508224486e+71) (* -2.0 (/ x (* t z))) t_1))))double code(double x, double y, double z, double t) {
double t_1 = (x + x) / (z * y);
double tmp;
if (y <= -8.287230547520723e-60) {
tmp = t_1;
} else if (y <= 1.0987282508224486e+71) {
tmp = -2.0 * (x / (t * z));
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
use fmin_fmax_functions
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) / (z * y)
if (y <= (-8.287230547520723d-60)) then
tmp = t_1
else if (y <= 1.0987282508224486d+71) then
tmp = (-2.0d0) * (x / (t * z))
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) / (z * y);
double tmp;
if (y <= -8.287230547520723e-60) {
tmp = t_1;
} else if (y <= 1.0987282508224486e+71) {
tmp = -2.0 * (x / (t * z));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x + x) / (z * y) tmp = 0 if y <= -8.287230547520723e-60: tmp = t_1 elif y <= 1.0987282508224486e+71: tmp = -2.0 * (x / (t * z)) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x + x) / Float64(z * y)) tmp = 0.0 if (y <= -8.287230547520723e-60) tmp = t_1; elseif (y <= 1.0987282508224486e+71) tmp = Float64(-2.0 * Float64(x / Float64(t * z))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x + x) / (z * y); tmp = 0.0; if (y <= -8.287230547520723e-60) tmp = t_1; elseif (y <= 1.0987282508224486e+71) tmp = -2.0 * (x / (t * z)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x + x), $MachinePrecision] / N[(z * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -8.287230547520723e-60], t$95$1, If[LessEqual[y, 1.0987282508224486e+71], N[(-2.0 * N[(x / N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
f(x, y, z, t): x in [-inf, +inf], y in [-inf, +inf], z in [-inf, +inf], t in [-inf, +inf] code: THEORY BEGIN f(x, y, z, t: real): real = LET t_1 = ((x + x) / (z * y)) IN LET tmp_1 = IF (y <= (109872825082244857240073441999150846797813910160089051785476223503695872)) THEN ((-2) * (x / (t * z))) ELSE t_1 ENDIF IN LET tmp = IF (y <= (-8287230547520722800539378603997809920699682965694844179819029341478256449086590626160412372225455986379631887716885444568010318594655008650643349750637700612543312672642059624195098876953125e-249)) THEN t_1 ELSE tmp_1 ENDIF IN tmp END code
\begin{array}{l}
t_1 := \frac{x + x}{z \cdot y}\\
\mathbf{if}\;y \leq -8.287230547520723 \cdot 10^{-60}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 1.0987282508224486 \cdot 10^{+71}:\\
\;\;\;\;-2 \cdot \frac{x}{t \cdot z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if y < -8.2872305475207228e-60 or 1.0987282508224486e71 < y Initial program 89.9%
Taylor expanded in y around inf
Applied rewrites53.5%
Applied rewrites53.5%
if -8.2872305475207228e-60 < y < 1.0987282508224486e71Initial program 89.9%
Taylor expanded in y around 0
Applied rewrites53.6%
(FPCore (x y z t)
:precision binary64
:pre TRUE
(let* ((t_1 (/ (+ (fabs x) (fabs x)) (* z y)))
(t_2 (/ (* (fabs x) 2.0) (- (* y z) (* t z)))))
(*
(copysign 1.0 x)
(if (<= t_2 -5e-281)
t_1
(if (<= t_2 0.0) (/ (+ 0.0 0.0) (* z y)) t_1)))))double code(double x, double y, double z, double t) {
double t_1 = (fabs(x) + fabs(x)) / (z * y);
double t_2 = (fabs(x) * 2.0) / ((y * z) - (t * z));
double tmp;
if (t_2 <= -5e-281) {
tmp = t_1;
} else if (t_2 <= 0.0) {
tmp = (0.0 + 0.0) / (z * y);
} else {
tmp = t_1;
}
return copysign(1.0, x) * tmp;
}
public static double code(double x, double y, double z, double t) {
double t_1 = (Math.abs(x) + Math.abs(x)) / (z * y);
double t_2 = (Math.abs(x) * 2.0) / ((y * z) - (t * z));
double tmp;
if (t_2 <= -5e-281) {
tmp = t_1;
} else if (t_2 <= 0.0) {
tmp = (0.0 + 0.0) / (z * y);
} else {
tmp = t_1;
}
return Math.copySign(1.0, x) * tmp;
}
def code(x, y, z, t): t_1 = (math.fabs(x) + math.fabs(x)) / (z * y) t_2 = (math.fabs(x) * 2.0) / ((y * z) - (t * z)) tmp = 0 if t_2 <= -5e-281: tmp = t_1 elif t_2 <= 0.0: tmp = (0.0 + 0.0) / (z * y) else: tmp = t_1 return math.copysign(1.0, x) * tmp
function code(x, y, z, t) t_1 = Float64(Float64(abs(x) + abs(x)) / Float64(z * y)) t_2 = Float64(Float64(abs(x) * 2.0) / Float64(Float64(y * z) - Float64(t * z))) tmp = 0.0 if (t_2 <= -5e-281) tmp = t_1; elseif (t_2 <= 0.0) tmp = Float64(Float64(0.0 + 0.0) / Float64(z * y)); else tmp = t_1; end return Float64(copysign(1.0, x) * tmp) end
function tmp_2 = code(x, y, z, t) t_1 = (abs(x) + abs(x)) / (z * y); t_2 = (abs(x) * 2.0) / ((y * z) - (t * z)); tmp = 0.0; if (t_2 <= -5e-281) tmp = t_1; elseif (t_2 <= 0.0) tmp = (0.0 + 0.0) / (z * y); else tmp = t_1; end tmp_2 = (sign(x) * abs(1.0)) * tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(N[Abs[x], $MachinePrecision] + N[Abs[x], $MachinePrecision]), $MachinePrecision] / N[(z * y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[Abs[x], $MachinePrecision] * 2.0), $MachinePrecision] / N[(N[(y * z), $MachinePrecision] - N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[t$95$2, -5e-281], t$95$1, If[LessEqual[t$95$2, 0.0], N[(N[(0.0 + 0.0), $MachinePrecision] / N[(z * y), $MachinePrecision]), $MachinePrecision], t$95$1]]), $MachinePrecision]]]
\begin{array}{l}
t_1 := \frac{\left|x\right| + \left|x\right|}{z \cdot y}\\
t_2 := \frac{\left|x\right| \cdot 2}{y \cdot z - t \cdot z}\\
\mathsf{copysign}\left(1, x\right) \cdot \begin{array}{l}
\mathbf{if}\;t\_2 \leq -5 \cdot 10^{-281}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 0:\\
\;\;\;\;\frac{0 + 0}{z \cdot y}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (/.f64 (*.f64 x #s(literal 2 binary64)) (-.f64 (*.f64 y z) (*.f64 t z))) < -4.9999999999999998e-281 or -0.0 < (/.f64 (*.f64 x #s(literal 2 binary64)) (-.f64 (*.f64 y z) (*.f64 t z))) Initial program 89.9%
Taylor expanded in y around inf
Applied rewrites53.5%
Applied rewrites53.5%
if -4.9999999999999998e-281 < (/.f64 (*.f64 x #s(literal 2 binary64)) (-.f64 (*.f64 y z) (*.f64 t z))) < -0.0Initial program 89.9%
Taylor expanded in y around inf
Applied rewrites53.5%
Applied rewrites53.5%
Taylor expanded in undef-var around zero
Applied rewrites27.7%
(FPCore (x y z t) :precision binary64 :pre TRUE (/ (+ x x) (* z y)))
double code(double x, double y, double z, double t) {
return (x + x) / (z * y);
}
real(8) function code(x, y, z, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (x + x) / (z * y)
end function
public static double code(double x, double y, double z, double t) {
return (x + x) / (z * y);
}
def code(x, y, z, t): return (x + x) / (z * y)
function code(x, y, z, t) return Float64(Float64(x + x) / Float64(z * y)) end
function tmp = code(x, y, z, t) tmp = (x + x) / (z * y); end
code[x_, y_, z_, t_] := N[(N[(x + x), $MachinePrecision] / N[(z * y), $MachinePrecision]), $MachinePrecision]
f(x, y, z, t): x in [-inf, +inf], y in [-inf, +inf], z in [-inf, +inf], t in [-inf, +inf] code: THEORY BEGIN f(x, y, z, t: real): real = (x + x) / (z * y) END code
\frac{x + x}{z \cdot y}
Initial program 89.9%
Taylor expanded in y around inf
Applied rewrites53.5%
Applied rewrites53.5%
herbie shell --seed 2026092
(FPCore (x y z t)
:name "Linear.Projection:infinitePerspective from linear-1.19.1.3, A"
:precision binary64
(/ (* x 2.0) (- (* y z) (* t z))))