
(FPCore (x y z t a) :precision binary64 (/ (* (* x y) z) (sqrt (- (* z z) (* t a)))))
double code(double x, double y, double z, double t, double a) {
return ((x * y) * z) / sqrt(((z * z) - (t * a)));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
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), intent (in) :: a
code = ((x * y) * z) / sqrt(((z * z) - (t * a)))
end function
public static double code(double x, double y, double z, double t, double a) {
return ((x * y) * z) / Math.sqrt(((z * z) - (t * a)));
}
def code(x, y, z, t, a): return ((x * y) * z) / math.sqrt(((z * z) - (t * a)))
function code(x, y, z, t, a) return Float64(Float64(Float64(x * y) * z) / sqrt(Float64(Float64(z * z) - Float64(t * a)))) end
function tmp = code(x, y, z, t, a) tmp = ((x * y) * z) / sqrt(((z * z) - (t * a))); end
code[x_, y_, z_, t_, a_] := N[(N[(N[(x * y), $MachinePrecision] * z), $MachinePrecision] / N[Sqrt[N[(N[(z * z), $MachinePrecision] - N[(t * a), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\frac{\left(x \cdot y\right) \cdot z}{\sqrt{z \cdot z - t \cdot a}}
Herbie found 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (/ (* (* x y) z) (sqrt (- (* z z) (* t a)))))
double code(double x, double y, double z, double t, double a) {
return ((x * y) * z) / sqrt(((z * z) - (t * a)));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
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), intent (in) :: a
code = ((x * y) * z) / sqrt(((z * z) - (t * a)))
end function
public static double code(double x, double y, double z, double t, double a) {
return ((x * y) * z) / Math.sqrt(((z * z) - (t * a)));
}
def code(x, y, z, t, a): return ((x * y) * z) / math.sqrt(((z * z) - (t * a)))
function code(x, y, z, t, a) return Float64(Float64(Float64(x * y) * z) / sqrt(Float64(Float64(z * z) - Float64(t * a)))) end
function tmp = code(x, y, z, t, a) tmp = ((x * y) * z) / sqrt(((z * z) - (t * a))); end
code[x_, y_, z_, t_, a_] := N[(N[(N[(x * y), $MachinePrecision] * z), $MachinePrecision] / N[Sqrt[N[(N[(z * z), $MachinePrecision] - N[(t * a), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\frac{\left(x \cdot y\right) \cdot z}{\sqrt{z \cdot z - t \cdot a}}
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fmax (fabs x) (fabs y))) (t_2 (fmin (fabs x) (fabs y))))
(*
(copysign 1.0 x)
(*
(copysign 1.0 y)
(*
(copysign 1.0 z)
(if (<= (fabs z) 3e-217)
(*
(/ (* t_1 t_2) (* (sqrt (- (fmin t a))) (sqrt (fmax t a))))
(fabs z))
(if (<= (fabs z) 3.35e+125)
(*
(*
(/
(fabs z)
(sqrt
(- (* (fabs z) (fabs z)) (* (fmax t a) (fmin t a)))))
t_1)
t_2)
(* (* 1.0 t_1) t_2))))))))double code(double x, double y, double z, double t, double a) {
double t_1 = fmax(fabs(x), fabs(y));
double t_2 = fmin(fabs(x), fabs(y));
double tmp;
if (fabs(z) <= 3e-217) {
tmp = ((t_1 * t_2) / (sqrt(-fmin(t, a)) * sqrt(fmax(t, a)))) * fabs(z);
} else if (fabs(z) <= 3.35e+125) {
tmp = ((fabs(z) / sqrt(((fabs(z) * fabs(z)) - (fmax(t, a) * fmin(t, a))))) * t_1) * t_2;
} else {
tmp = (1.0 * t_1) * t_2;
}
return copysign(1.0, x) * (copysign(1.0, y) * (copysign(1.0, z) * tmp));
}
public static double code(double x, double y, double z, double t, double a) {
double t_1 = fmax(Math.abs(x), Math.abs(y));
double t_2 = fmin(Math.abs(x), Math.abs(y));
double tmp;
if (Math.abs(z) <= 3e-217) {
tmp = ((t_1 * t_2) / (Math.sqrt(-fmin(t, a)) * Math.sqrt(fmax(t, a)))) * Math.abs(z);
} else if (Math.abs(z) <= 3.35e+125) {
tmp = ((Math.abs(z) / Math.sqrt(((Math.abs(z) * Math.abs(z)) - (fmax(t, a) * fmin(t, a))))) * t_1) * t_2;
} else {
tmp = (1.0 * t_1) * t_2;
}
return Math.copySign(1.0, x) * (Math.copySign(1.0, y) * (Math.copySign(1.0, z) * tmp));
}
def code(x, y, z, t, a): t_1 = fmax(math.fabs(x), math.fabs(y)) t_2 = fmin(math.fabs(x), math.fabs(y)) tmp = 0 if math.fabs(z) <= 3e-217: tmp = ((t_1 * t_2) / (math.sqrt(-fmin(t, a)) * math.sqrt(fmax(t, a)))) * math.fabs(z) elif math.fabs(z) <= 3.35e+125: tmp = ((math.fabs(z) / math.sqrt(((math.fabs(z) * math.fabs(z)) - (fmax(t, a) * fmin(t, a))))) * t_1) * t_2 else: tmp = (1.0 * t_1) * t_2 return math.copysign(1.0, x) * (math.copysign(1.0, y) * (math.copysign(1.0, z) * tmp))
function code(x, y, z, t, a) t_1 = fmax(abs(x), abs(y)) t_2 = fmin(abs(x), abs(y)) tmp = 0.0 if (abs(z) <= 3e-217) tmp = Float64(Float64(Float64(t_1 * t_2) / Float64(sqrt(Float64(-fmin(t, a))) * sqrt(fmax(t, a)))) * abs(z)); elseif (abs(z) <= 3.35e+125) tmp = Float64(Float64(Float64(abs(z) / sqrt(Float64(Float64(abs(z) * abs(z)) - Float64(fmax(t, a) * fmin(t, a))))) * t_1) * t_2); else tmp = Float64(Float64(1.0 * t_1) * t_2); end return Float64(copysign(1.0, x) * Float64(copysign(1.0, y) * Float64(copysign(1.0, z) * tmp))) end
function tmp_2 = code(x, y, z, t, a) t_1 = max(abs(x), abs(y)); t_2 = min(abs(x), abs(y)); tmp = 0.0; if (abs(z) <= 3e-217) tmp = ((t_1 * t_2) / (sqrt(-min(t, a)) * sqrt(max(t, a)))) * abs(z); elseif (abs(z) <= 3.35e+125) tmp = ((abs(z) / sqrt(((abs(z) * abs(z)) - (max(t, a) * min(t, a))))) * t_1) * t_2; else tmp = (1.0 * t_1) * t_2; end tmp_2 = (sign(x) * abs(1.0)) * ((sign(y) * abs(1.0)) * ((sign(z) * abs(1.0)) * tmp)); end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[Max[N[Abs[x], $MachinePrecision], N[Abs[y], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Min[N[Abs[x], $MachinePrecision], N[Abs[y], $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[y]}, 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[N[Abs[z], $MachinePrecision], 3e-217], N[(N[(N[(t$95$1 * t$95$2), $MachinePrecision] / N[(N[Sqrt[(-N[Min[t, a], $MachinePrecision])], $MachinePrecision] * N[Sqrt[N[Max[t, a], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Abs[z], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Abs[z], $MachinePrecision], 3.35e+125], N[(N[(N[(N[Abs[z], $MachinePrecision] / N[Sqrt[N[(N[(N[Abs[z], $MachinePrecision] * N[Abs[z], $MachinePrecision]), $MachinePrecision] - N[(N[Max[t, a], $MachinePrecision] * N[Min[t, a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision] * t$95$2), $MachinePrecision], N[(N[(1.0 * t$95$1), $MachinePrecision] * t$95$2), $MachinePrecision]]]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
t_1 := \mathsf{max}\left(\left|x\right|, \left|y\right|\right)\\
t_2 := \mathsf{min}\left(\left|x\right|, \left|y\right|\right)\\
\mathsf{copysign}\left(1, x\right) \cdot \left(\mathsf{copysign}\left(1, y\right) \cdot \left(\mathsf{copysign}\left(1, z\right) \cdot \begin{array}{l}
\mathbf{if}\;\left|z\right| \leq 3 \cdot 10^{-217}:\\
\;\;\;\;\frac{t\_1 \cdot t\_2}{\sqrt{-\mathsf{min}\left(t, a\right)} \cdot \sqrt{\mathsf{max}\left(t, a\right)}} \cdot \left|z\right|\\
\mathbf{elif}\;\left|z\right| \leq 3.35 \cdot 10^{+125}:\\
\;\;\;\;\left(\frac{\left|z\right|}{\sqrt{\left|z\right| \cdot \left|z\right| - \mathsf{max}\left(t, a\right) \cdot \mathsf{min}\left(t, a\right)}} \cdot t\_1\right) \cdot t\_2\\
\mathbf{else}:\\
\;\;\;\;\left(1 \cdot t\_1\right) \cdot t\_2\\
\end{array}\right)\right)
\end{array}
if z < 3e-217Initial program 60.7%
lift-/.f64N/A
lift-*.f64N/A
associate-*l/N/A
mult-flip-revN/A
lower-*.f64N/A
mult-flip-revN/A
lower-/.f6461.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6461.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6461.4%
Applied rewrites61.4%
Taylor expanded in z around 0
lower-sqrt.f64N/A
lower-neg.f64N/A
lower-*.f6433.3%
Applied rewrites33.3%
lift-sqrt.f64N/A
lift-neg.f64N/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-neg-outN/A
sqrt-prodN/A
lower-unsound-*.f64N/A
lower-unsound-sqrt.f64N/A
lower-neg.f64N/A
lower-unsound-sqrt.f6418.8%
Applied rewrites18.8%
if 3e-217 < z < 3.3500000000000002e125Initial program 60.7%
Applied rewrites63.8%
if 3.3500000000000002e125 < z Initial program 60.7%
Applied rewrites63.8%
Taylor expanded in z around inf
Applied rewrites42.7%
(FPCore (x y z t a)
:precision binary64
(*
(copysign 1.0 z)
(if (<= (fabs z) 3.5e-216)
(*
(/ (* y x) (* (sqrt (- (fmin t a))) (sqrt (fmax t a))))
(fabs z))
(if (<= (fabs z) 5.8e+89)
(*
(*
(/
x
(sqrt (- (* (fabs z) (fabs z)) (* (fmin t a) (fmax t a)))))
y)
(fabs z))
(* (* 1.0 y) x)))))double code(double x, double y, double z, double t, double a) {
double tmp;
if (fabs(z) <= 3.5e-216) {
tmp = ((y * x) / (sqrt(-fmin(t, a)) * sqrt(fmax(t, a)))) * fabs(z);
} else if (fabs(z) <= 5.8e+89) {
tmp = ((x / sqrt(((fabs(z) * fabs(z)) - (fmin(t, a) * fmax(t, a))))) * y) * fabs(z);
} else {
tmp = (1.0 * y) * x;
}
return copysign(1.0, z) * tmp;
}
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (Math.abs(z) <= 3.5e-216) {
tmp = ((y * x) / (Math.sqrt(-fmin(t, a)) * Math.sqrt(fmax(t, a)))) * Math.abs(z);
} else if (Math.abs(z) <= 5.8e+89) {
tmp = ((x / Math.sqrt(((Math.abs(z) * Math.abs(z)) - (fmin(t, a) * fmax(t, a))))) * y) * Math.abs(z);
} else {
tmp = (1.0 * y) * x;
}
return Math.copySign(1.0, z) * tmp;
}
def code(x, y, z, t, a): tmp = 0 if math.fabs(z) <= 3.5e-216: tmp = ((y * x) / (math.sqrt(-fmin(t, a)) * math.sqrt(fmax(t, a)))) * math.fabs(z) elif math.fabs(z) <= 5.8e+89: tmp = ((x / math.sqrt(((math.fabs(z) * math.fabs(z)) - (fmin(t, a) * fmax(t, a))))) * y) * math.fabs(z) else: tmp = (1.0 * y) * x return math.copysign(1.0, z) * tmp
function code(x, y, z, t, a) tmp = 0.0 if (abs(z) <= 3.5e-216) tmp = Float64(Float64(Float64(y * x) / Float64(sqrt(Float64(-fmin(t, a))) * sqrt(fmax(t, a)))) * abs(z)); elseif (abs(z) <= 5.8e+89) tmp = Float64(Float64(Float64(x / sqrt(Float64(Float64(abs(z) * abs(z)) - Float64(fmin(t, a) * fmax(t, a))))) * y) * abs(z)); else tmp = Float64(Float64(1.0 * y) * x); end return Float64(copysign(1.0, z) * tmp) end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (abs(z) <= 3.5e-216) tmp = ((y * x) / (sqrt(-min(t, a)) * sqrt(max(t, a)))) * abs(z); elseif (abs(z) <= 5.8e+89) tmp = ((x / sqrt(((abs(z) * abs(z)) - (min(t, a) * max(t, a))))) * y) * abs(z); else tmp = (1.0 * y) * x; end tmp_2 = (sign(z) * abs(1.0)) * tmp; end
code[x_, y_, z_, t_, a_] := N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[Abs[z], $MachinePrecision], 3.5e-216], N[(N[(N[(y * x), $MachinePrecision] / N[(N[Sqrt[(-N[Min[t, a], $MachinePrecision])], $MachinePrecision] * N[Sqrt[N[Max[t, a], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Abs[z], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Abs[z], $MachinePrecision], 5.8e+89], N[(N[(N[(x / N[Sqrt[N[(N[(N[Abs[z], $MachinePrecision] * N[Abs[z], $MachinePrecision]), $MachinePrecision] - N[(N[Min[t, a], $MachinePrecision] * N[Max[t, a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision] * N[Abs[z], $MachinePrecision]), $MachinePrecision], N[(N[(1.0 * y), $MachinePrecision] * x), $MachinePrecision]]]), $MachinePrecision]
\mathsf{copysign}\left(1, z\right) \cdot \begin{array}{l}
\mathbf{if}\;\left|z\right| \leq 3.5 \cdot 10^{-216}:\\
\;\;\;\;\frac{y \cdot x}{\sqrt{-\mathsf{min}\left(t, a\right)} \cdot \sqrt{\mathsf{max}\left(t, a\right)}} \cdot \left|z\right|\\
\mathbf{elif}\;\left|z\right| \leq 5.8 \cdot 10^{+89}:\\
\;\;\;\;\left(\frac{x}{\sqrt{\left|z\right| \cdot \left|z\right| - \mathsf{min}\left(t, a\right) \cdot \mathsf{max}\left(t, a\right)}} \cdot y\right) \cdot \left|z\right|\\
\mathbf{else}:\\
\;\;\;\;\left(1 \cdot y\right) \cdot x\\
\end{array}
if z < 3.4999999999999998e-216Initial program 60.7%
lift-/.f64N/A
lift-*.f64N/A
associate-*l/N/A
mult-flip-revN/A
lower-*.f64N/A
mult-flip-revN/A
lower-/.f6461.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6461.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6461.4%
Applied rewrites61.4%
Taylor expanded in z around 0
lower-sqrt.f64N/A
lower-neg.f64N/A
lower-*.f6433.3%
Applied rewrites33.3%
lift-sqrt.f64N/A
lift-neg.f64N/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-neg-outN/A
sqrt-prodN/A
lower-unsound-*.f64N/A
lower-unsound-sqrt.f64N/A
lower-neg.f64N/A
lower-unsound-sqrt.f6418.8%
Applied rewrites18.8%
if 3.4999999999999998e-216 < z < 5.8000000000000005e89Initial program 60.7%
lift-/.f64N/A
lift-*.f64N/A
associate-*l/N/A
mult-flip-revN/A
lower-*.f64N/A
mult-flip-revN/A
lower-/.f6461.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6461.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6461.4%
Applied rewrites61.4%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6459.8%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6459.8%
Applied rewrites59.8%
if 5.8000000000000005e89 < z Initial program 60.7%
Applied rewrites63.8%
Taylor expanded in z around inf
Applied rewrites42.7%
(FPCore (x y z t a)
:precision binary64
(*
(copysign 1.0 z)
(if (<= (* (fmin t a) (fmax t a)) -2e-120)
(*
(/ (* y x) (* (sqrt (- (fmin t a))) (sqrt (fmax t a))))
(fabs z))
(* (* 1.0 y) x))))double code(double x, double y, double z, double t, double a) {
double tmp;
if ((fmin(t, a) * fmax(t, a)) <= -2e-120) {
tmp = ((y * x) / (sqrt(-fmin(t, a)) * sqrt(fmax(t, a)))) * fabs(z);
} else {
tmp = (1.0 * y) * x;
}
return copysign(1.0, z) * tmp;
}
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((fmin(t, a) * fmax(t, a)) <= -2e-120) {
tmp = ((y * x) / (Math.sqrt(-fmin(t, a)) * Math.sqrt(fmax(t, a)))) * Math.abs(z);
} else {
tmp = (1.0 * y) * x;
}
return Math.copySign(1.0, z) * tmp;
}
def code(x, y, z, t, a): tmp = 0 if (fmin(t, a) * fmax(t, a)) <= -2e-120: tmp = ((y * x) / (math.sqrt(-fmin(t, a)) * math.sqrt(fmax(t, a)))) * math.fabs(z) else: tmp = (1.0 * y) * x return math.copysign(1.0, z) * tmp
function code(x, y, z, t, a) tmp = 0.0 if (Float64(fmin(t, a) * fmax(t, a)) <= -2e-120) tmp = Float64(Float64(Float64(y * x) / Float64(sqrt(Float64(-fmin(t, a))) * sqrt(fmax(t, a)))) * abs(z)); else tmp = Float64(Float64(1.0 * y) * x); end return Float64(copysign(1.0, z) * tmp) end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((min(t, a) * max(t, a)) <= -2e-120) tmp = ((y * x) / (sqrt(-min(t, a)) * sqrt(max(t, a)))) * abs(z); else tmp = (1.0 * y) * x; end tmp_2 = (sign(z) * abs(1.0)) * tmp; end
code[x_, y_, z_, t_, a_] := N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[(N[Min[t, a], $MachinePrecision] * N[Max[t, a], $MachinePrecision]), $MachinePrecision], -2e-120], N[(N[(N[(y * x), $MachinePrecision] / N[(N[Sqrt[(-N[Min[t, a], $MachinePrecision])], $MachinePrecision] * N[Sqrt[N[Max[t, a], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Abs[z], $MachinePrecision]), $MachinePrecision], N[(N[(1.0 * y), $MachinePrecision] * x), $MachinePrecision]]), $MachinePrecision]
\mathsf{copysign}\left(1, z\right) \cdot \begin{array}{l}
\mathbf{if}\;\mathsf{min}\left(t, a\right) \cdot \mathsf{max}\left(t, a\right) \leq -2 \cdot 10^{-120}:\\
\;\;\;\;\frac{y \cdot x}{\sqrt{-\mathsf{min}\left(t, a\right)} \cdot \sqrt{\mathsf{max}\left(t, a\right)}} \cdot \left|z\right|\\
\mathbf{else}:\\
\;\;\;\;\left(1 \cdot y\right) \cdot x\\
\end{array}
if (*.f64 t a) < -2e-120Initial program 60.7%
lift-/.f64N/A
lift-*.f64N/A
associate-*l/N/A
mult-flip-revN/A
lower-*.f64N/A
mult-flip-revN/A
lower-/.f6461.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6461.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6461.4%
Applied rewrites61.4%
Taylor expanded in z around 0
lower-sqrt.f64N/A
lower-neg.f64N/A
lower-*.f6433.3%
Applied rewrites33.3%
lift-sqrt.f64N/A
lift-neg.f64N/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-neg-outN/A
sqrt-prodN/A
lower-unsound-*.f64N/A
lower-unsound-sqrt.f64N/A
lower-neg.f64N/A
lower-unsound-sqrt.f6418.8%
Applied rewrites18.8%
if -2e-120 < (*.f64 t a) Initial program 60.7%
Applied rewrites63.8%
Taylor expanded in z around inf
Applied rewrites42.7%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fmax (fabs x) (fabs y))) (t_2 (fmin (fabs x) (fabs y))))
(*
(copysign 1.0 x)
(*
(copysign 1.0 y)
(*
(copysign 1.0 z)
(if (<= (* t a) -2e-120)
(* (* (/ (fabs z) (sqrt (- (* a t)))) t_1) t_2)
(* (* 1.0 t_1) t_2)))))))double code(double x, double y, double z, double t, double a) {
double t_1 = fmax(fabs(x), fabs(y));
double t_2 = fmin(fabs(x), fabs(y));
double tmp;
if ((t * a) <= -2e-120) {
tmp = ((fabs(z) / sqrt(-(a * t))) * t_1) * t_2;
} else {
tmp = (1.0 * t_1) * t_2;
}
return copysign(1.0, x) * (copysign(1.0, y) * (copysign(1.0, z) * tmp));
}
public static double code(double x, double y, double z, double t, double a) {
double t_1 = fmax(Math.abs(x), Math.abs(y));
double t_2 = fmin(Math.abs(x), Math.abs(y));
double tmp;
if ((t * a) <= -2e-120) {
tmp = ((Math.abs(z) / Math.sqrt(-(a * t))) * t_1) * t_2;
} else {
tmp = (1.0 * t_1) * t_2;
}
return Math.copySign(1.0, x) * (Math.copySign(1.0, y) * (Math.copySign(1.0, z) * tmp));
}
def code(x, y, z, t, a): t_1 = fmax(math.fabs(x), math.fabs(y)) t_2 = fmin(math.fabs(x), math.fabs(y)) tmp = 0 if (t * a) <= -2e-120: tmp = ((math.fabs(z) / math.sqrt(-(a * t))) * t_1) * t_2 else: tmp = (1.0 * t_1) * t_2 return math.copysign(1.0, x) * (math.copysign(1.0, y) * (math.copysign(1.0, z) * tmp))
function code(x, y, z, t, a) t_1 = fmax(abs(x), abs(y)) t_2 = fmin(abs(x), abs(y)) tmp = 0.0 if (Float64(t * a) <= -2e-120) tmp = Float64(Float64(Float64(abs(z) / sqrt(Float64(-Float64(a * t)))) * t_1) * t_2); else tmp = Float64(Float64(1.0 * t_1) * t_2); end return Float64(copysign(1.0, x) * Float64(copysign(1.0, y) * Float64(copysign(1.0, z) * tmp))) end
function tmp_2 = code(x, y, z, t, a) t_1 = max(abs(x), abs(y)); t_2 = min(abs(x), abs(y)); tmp = 0.0; if ((t * a) <= -2e-120) tmp = ((abs(z) / sqrt(-(a * t))) * t_1) * t_2; else tmp = (1.0 * t_1) * t_2; end tmp_2 = (sign(x) * abs(1.0)) * ((sign(y) * abs(1.0)) * ((sign(z) * abs(1.0)) * tmp)); end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[Max[N[Abs[x], $MachinePrecision], N[Abs[y], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Min[N[Abs[x], $MachinePrecision], N[Abs[y], $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[y]}, 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[N[(t * a), $MachinePrecision], -2e-120], N[(N[(N[(N[Abs[z], $MachinePrecision] / N[Sqrt[(-N[(a * t), $MachinePrecision])], $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision] * t$95$2), $MachinePrecision], N[(N[(1.0 * t$95$1), $MachinePrecision] * t$95$2), $MachinePrecision]]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
t_1 := \mathsf{max}\left(\left|x\right|, \left|y\right|\right)\\
t_2 := \mathsf{min}\left(\left|x\right|, \left|y\right|\right)\\
\mathsf{copysign}\left(1, x\right) \cdot \left(\mathsf{copysign}\left(1, y\right) \cdot \left(\mathsf{copysign}\left(1, z\right) \cdot \begin{array}{l}
\mathbf{if}\;t \cdot a \leq -2 \cdot 10^{-120}:\\
\;\;\;\;\left(\frac{\left|z\right|}{\sqrt{-a \cdot t}} \cdot t\_1\right) \cdot t\_2\\
\mathbf{else}:\\
\;\;\;\;\left(1 \cdot t\_1\right) \cdot t\_2\\
\end{array}\right)\right)
\end{array}
if (*.f64 t a) < -2e-120Initial program 60.7%
Applied rewrites63.8%
Taylor expanded in z around 0
lower-sqrt.f64N/A
lower-neg.f64N/A
lower-*.f6431.6%
Applied rewrites31.6%
if -2e-120 < (*.f64 t a) Initial program 60.7%
Applied rewrites63.8%
Taylor expanded in z around inf
Applied rewrites42.7%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fmax (fabs x) (fabs y))) (t_2 (fmin (fabs x) (fabs y))))
(*
(copysign 1.0 x)
(*
(copysign 1.0 y)
(*
(copysign 1.0 z)
(if (<= (* t a) -2e-120)
(* (/ (* t_1 (fabs z)) (sqrt (- (* a t)))) t_2)
(* (* 1.0 t_1) t_2)))))))double code(double x, double y, double z, double t, double a) {
double t_1 = fmax(fabs(x), fabs(y));
double t_2 = fmin(fabs(x), fabs(y));
double tmp;
if ((t * a) <= -2e-120) {
tmp = ((t_1 * fabs(z)) / sqrt(-(a * t))) * t_2;
} else {
tmp = (1.0 * t_1) * t_2;
}
return copysign(1.0, x) * (copysign(1.0, y) * (copysign(1.0, z) * tmp));
}
public static double code(double x, double y, double z, double t, double a) {
double t_1 = fmax(Math.abs(x), Math.abs(y));
double t_2 = fmin(Math.abs(x), Math.abs(y));
double tmp;
if ((t * a) <= -2e-120) {
tmp = ((t_1 * Math.abs(z)) / Math.sqrt(-(a * t))) * t_2;
} else {
tmp = (1.0 * t_1) * t_2;
}
return Math.copySign(1.0, x) * (Math.copySign(1.0, y) * (Math.copySign(1.0, z) * tmp));
}
def code(x, y, z, t, a): t_1 = fmax(math.fabs(x), math.fabs(y)) t_2 = fmin(math.fabs(x), math.fabs(y)) tmp = 0 if (t * a) <= -2e-120: tmp = ((t_1 * math.fabs(z)) / math.sqrt(-(a * t))) * t_2 else: tmp = (1.0 * t_1) * t_2 return math.copysign(1.0, x) * (math.copysign(1.0, y) * (math.copysign(1.0, z) * tmp))
function code(x, y, z, t, a) t_1 = fmax(abs(x), abs(y)) t_2 = fmin(abs(x), abs(y)) tmp = 0.0 if (Float64(t * a) <= -2e-120) tmp = Float64(Float64(Float64(t_1 * abs(z)) / sqrt(Float64(-Float64(a * t)))) * t_2); else tmp = Float64(Float64(1.0 * t_1) * t_2); end return Float64(copysign(1.0, x) * Float64(copysign(1.0, y) * Float64(copysign(1.0, z) * tmp))) end
function tmp_2 = code(x, y, z, t, a) t_1 = max(abs(x), abs(y)); t_2 = min(abs(x), abs(y)); tmp = 0.0; if ((t * a) <= -2e-120) tmp = ((t_1 * abs(z)) / sqrt(-(a * t))) * t_2; else tmp = (1.0 * t_1) * t_2; end tmp_2 = (sign(x) * abs(1.0)) * ((sign(y) * abs(1.0)) * ((sign(z) * abs(1.0)) * tmp)); end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[Max[N[Abs[x], $MachinePrecision], N[Abs[y], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Min[N[Abs[x], $MachinePrecision], N[Abs[y], $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[y]}, 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[N[(t * a), $MachinePrecision], -2e-120], N[(N[(N[(t$95$1 * N[Abs[z], $MachinePrecision]), $MachinePrecision] / N[Sqrt[(-N[(a * t), $MachinePrecision])], $MachinePrecision]), $MachinePrecision] * t$95$2), $MachinePrecision], N[(N[(1.0 * t$95$1), $MachinePrecision] * t$95$2), $MachinePrecision]]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
t_1 := \mathsf{max}\left(\left|x\right|, \left|y\right|\right)\\
t_2 := \mathsf{min}\left(\left|x\right|, \left|y\right|\right)\\
\mathsf{copysign}\left(1, x\right) \cdot \left(\mathsf{copysign}\left(1, y\right) \cdot \left(\mathsf{copysign}\left(1, z\right) \cdot \begin{array}{l}
\mathbf{if}\;t \cdot a \leq -2 \cdot 10^{-120}:\\
\;\;\;\;\frac{t\_1 \cdot \left|z\right|}{\sqrt{-a \cdot t}} \cdot t\_2\\
\mathbf{else}:\\
\;\;\;\;\left(1 \cdot t\_1\right) \cdot t\_2\\
\end{array}\right)\right)
\end{array}
if (*.f64 t a) < -2e-120Initial program 60.7%
Applied rewrites63.8%
Taylor expanded in z around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-neg.f64N/A
lower-*.f6431.6%
Applied rewrites31.6%
if -2e-120 < (*.f64 t a) Initial program 60.7%
Applied rewrites63.8%
Taylor expanded in z around inf
Applied rewrites42.7%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fmin x (fabs y))) (t_2 (fmax x (fabs y))))
(*
(copysign 1.0 y)
(*
(copysign 1.0 z)
(if (<= (* t a) -2e-120)
(/ (* t_1 (* t_2 (fabs z))) (sqrt (- (* a t))))
(* (* 1.0 t_2) t_1))))))double code(double x, double y, double z, double t, double a) {
double t_1 = fmin(x, fabs(y));
double t_2 = fmax(x, fabs(y));
double tmp;
if ((t * a) <= -2e-120) {
tmp = (t_1 * (t_2 * fabs(z))) / sqrt(-(a * t));
} else {
tmp = (1.0 * t_2) * t_1;
}
return copysign(1.0, y) * (copysign(1.0, z) * tmp);
}
public static double code(double x, double y, double z, double t, double a) {
double t_1 = fmin(x, Math.abs(y));
double t_2 = fmax(x, Math.abs(y));
double tmp;
if ((t * a) <= -2e-120) {
tmp = (t_1 * (t_2 * Math.abs(z))) / Math.sqrt(-(a * t));
} else {
tmp = (1.0 * t_2) * t_1;
}
return Math.copySign(1.0, y) * (Math.copySign(1.0, z) * tmp);
}
def code(x, y, z, t, a): t_1 = fmin(x, math.fabs(y)) t_2 = fmax(x, math.fabs(y)) tmp = 0 if (t * a) <= -2e-120: tmp = (t_1 * (t_2 * math.fabs(z))) / math.sqrt(-(a * t)) else: tmp = (1.0 * t_2) * t_1 return math.copysign(1.0, y) * (math.copysign(1.0, z) * tmp)
function code(x, y, z, t, a) t_1 = fmin(x, abs(y)) t_2 = fmax(x, abs(y)) tmp = 0.0 if (Float64(t * a) <= -2e-120) tmp = Float64(Float64(t_1 * Float64(t_2 * abs(z))) / sqrt(Float64(-Float64(a * t)))); else tmp = Float64(Float64(1.0 * t_2) * t_1); end return Float64(copysign(1.0, y) * Float64(copysign(1.0, z) * tmp)) end
function tmp_2 = code(x, y, z, t, a) t_1 = min(x, abs(y)); t_2 = max(x, abs(y)); tmp = 0.0; if ((t * a) <= -2e-120) tmp = (t_1 * (t_2 * abs(z))) / sqrt(-(a * t)); else tmp = (1.0 * t_2) * t_1; end tmp_2 = (sign(y) * abs(1.0)) * ((sign(z) * abs(1.0)) * tmp); end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[Min[x, N[Abs[y], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Max[x, N[Abs[y], $MachinePrecision]], $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, 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[N[(t * a), $MachinePrecision], -2e-120], N[(N[(t$95$1 * N[(t$95$2 * N[Abs[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[(-N[(a * t), $MachinePrecision])], $MachinePrecision]), $MachinePrecision], N[(N[(1.0 * t$95$2), $MachinePrecision] * t$95$1), $MachinePrecision]]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
t_1 := \mathsf{min}\left(x, \left|y\right|\right)\\
t_2 := \mathsf{max}\left(x, \left|y\right|\right)\\
\mathsf{copysign}\left(1, y\right) \cdot \left(\mathsf{copysign}\left(1, z\right) \cdot \begin{array}{l}
\mathbf{if}\;t \cdot a \leq -2 \cdot 10^{-120}:\\
\;\;\;\;\frac{t\_1 \cdot \left(t\_2 \cdot \left|z\right|\right)}{\sqrt{-a \cdot t}}\\
\mathbf{else}:\\
\;\;\;\;\left(1 \cdot t\_2\right) \cdot t\_1\\
\end{array}\right)
\end{array}
if (*.f64 t a) < -2e-120Initial program 60.7%
Taylor expanded in z around 0
lower-/.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-neg.f64N/A
lower-*.f6431.6%
Applied rewrites31.6%
if -2e-120 < (*.f64 t a) Initial program 60.7%
Applied rewrites63.8%
Taylor expanded in z around inf
Applied rewrites42.7%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fmin (fabs x) (fabs y))) (t_2 (fmax (fabs x) (fabs y))))
(*
(copysign 1.0 x)
(*
(copysign 1.0 y)
(*
(copysign 1.0 z)
(if (<= (fabs z) 1.55e-220)
(* (/ (* (fabs z) t_1) (- (fabs z))) t_2)
(* (* 1.0 t_2) t_1)))))))double code(double x, double y, double z, double t, double a) {
double t_1 = fmin(fabs(x), fabs(y));
double t_2 = fmax(fabs(x), fabs(y));
double tmp;
if (fabs(z) <= 1.55e-220) {
tmp = ((fabs(z) * t_1) / -fabs(z)) * t_2;
} else {
tmp = (1.0 * t_2) * t_1;
}
return copysign(1.0, x) * (copysign(1.0, y) * (copysign(1.0, z) * tmp));
}
public static double code(double x, double y, double z, double t, double a) {
double t_1 = fmin(Math.abs(x), Math.abs(y));
double t_2 = fmax(Math.abs(x), Math.abs(y));
double tmp;
if (Math.abs(z) <= 1.55e-220) {
tmp = ((Math.abs(z) * t_1) / -Math.abs(z)) * t_2;
} else {
tmp = (1.0 * t_2) * t_1;
}
return Math.copySign(1.0, x) * (Math.copySign(1.0, y) * (Math.copySign(1.0, z) * tmp));
}
def code(x, y, z, t, a): t_1 = fmin(math.fabs(x), math.fabs(y)) t_2 = fmax(math.fabs(x), math.fabs(y)) tmp = 0 if math.fabs(z) <= 1.55e-220: tmp = ((math.fabs(z) * t_1) / -math.fabs(z)) * t_2 else: tmp = (1.0 * t_2) * t_1 return math.copysign(1.0, x) * (math.copysign(1.0, y) * (math.copysign(1.0, z) * tmp))
function code(x, y, z, t, a) t_1 = fmin(abs(x), abs(y)) t_2 = fmax(abs(x), abs(y)) tmp = 0.0 if (abs(z) <= 1.55e-220) tmp = Float64(Float64(Float64(abs(z) * t_1) / Float64(-abs(z))) * t_2); else tmp = Float64(Float64(1.0 * t_2) * t_1); end return Float64(copysign(1.0, x) * Float64(copysign(1.0, y) * Float64(copysign(1.0, z) * tmp))) end
function tmp_2 = code(x, y, z, t, a) t_1 = min(abs(x), abs(y)); t_2 = max(abs(x), abs(y)); tmp = 0.0; if (abs(z) <= 1.55e-220) tmp = ((abs(z) * t_1) / -abs(z)) * t_2; else tmp = (1.0 * t_2) * t_1; end tmp_2 = (sign(x) * abs(1.0)) * ((sign(y) * abs(1.0)) * ((sign(z) * abs(1.0)) * tmp)); end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[Min[N[Abs[x], $MachinePrecision], N[Abs[y], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Max[N[Abs[x], $MachinePrecision], N[Abs[y], $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[y]}, 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[N[Abs[z], $MachinePrecision], 1.55e-220], N[(N[(N[(N[Abs[z], $MachinePrecision] * t$95$1), $MachinePrecision] / (-N[Abs[z], $MachinePrecision])), $MachinePrecision] * t$95$2), $MachinePrecision], N[(N[(1.0 * t$95$2), $MachinePrecision] * t$95$1), $MachinePrecision]]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
t_1 := \mathsf{min}\left(\left|x\right|, \left|y\right|\right)\\
t_2 := \mathsf{max}\left(\left|x\right|, \left|y\right|\right)\\
\mathsf{copysign}\left(1, x\right) \cdot \left(\mathsf{copysign}\left(1, y\right) \cdot \left(\mathsf{copysign}\left(1, z\right) \cdot \begin{array}{l}
\mathbf{if}\;\left|z\right| \leq 1.55 \cdot 10^{-220}:\\
\;\;\;\;\frac{\left|z\right| \cdot t\_1}{-\left|z\right|} \cdot t\_2\\
\mathbf{else}:\\
\;\;\;\;\left(1 \cdot t\_2\right) \cdot t\_1\\
\end{array}\right)\right)
\end{array}
if z < 1.5500000000000001e-220Initial program 60.7%
Taylor expanded in z around -inf
lower-*.f6442.3%
Applied rewrites42.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
associate-*r/N/A
lift-*.f64N/A
lower-/.f6441.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6441.4%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6441.4%
Applied rewrites41.4%
if 1.5500000000000001e-220 < z Initial program 60.7%
Applied rewrites63.8%
Taylor expanded in z around inf
Applied rewrites42.7%
(FPCore (x y z t a) :precision binary64 (* (copysign 1.0 z) (* (* 1.0 y) x)))
double code(double x, double y, double z, double t, double a) {
return copysign(1.0, z) * ((1.0 * y) * x);
}
public static double code(double x, double y, double z, double t, double a) {
return Math.copySign(1.0, z) * ((1.0 * y) * x);
}
def code(x, y, z, t, a): return math.copysign(1.0, z) * ((1.0 * y) * x)
function code(x, y, z, t, a) return Float64(copysign(1.0, z) * Float64(Float64(1.0 * y) * x)) end
function tmp = code(x, y, z, t, a) tmp = (sign(z) * abs(1.0)) * ((1.0 * y) * x); end
code[x_, y_, z_, t_, a_] := N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * N[(N[(1.0 * y), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]
\mathsf{copysign}\left(1, z\right) \cdot \left(\left(1 \cdot y\right) \cdot x\right)
Initial program 60.7%
Applied rewrites63.8%
Taylor expanded in z around inf
Applied rewrites42.7%
(FPCore (x y z t a) :precision binary64 (* (- y) x))
double code(double x, double y, double z, double t, double a) {
return -y * x;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
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), intent (in) :: a
code = -y * x
end function
public static double code(double x, double y, double z, double t, double a) {
return -y * x;
}
def code(x, y, z, t, a): return -y * x
function code(x, y, z, t, a) return Float64(Float64(-y) * x) end
function tmp = code(x, y, z, t, a) tmp = -y * x; end
code[x_, y_, z_, t_, a_] := N[((-y) * x), $MachinePrecision]
\left(-y\right) \cdot x
Initial program 60.7%
Taylor expanded in z around -inf
lower-*.f64N/A
lower-*.f6444.0%
Applied rewrites44.0%
lift-*.f64N/A
mul-1-negN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
distribute-lft-neg-inN/A
lower-*.f64N/A
lower-neg.f6444.0%
Applied rewrites44.0%
herbie shell --seed 2025212
(FPCore (x y z t a)
:name "Statistics.Math.RootFinding:ridders from math-functions-0.1.5.2"
:precision binary64
(/ (* (* x y) z) (sqrt (- (* z z) (* t a)))))