
(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 8 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 x)
(*
(copysign 1 y)
(*
(copysign 1 z)
(if (<=
(fabs z)
8409788860576655/5922386521532855740161817506647119732883018558947359509044845726112560091729648156474603305162988578607512400425457279991804428268870599332596921062626576000993556884845161077691136496092218188572933193945756793025561702170624)
(* (/ 1 (sqrt (* (- t) a))) (* (* (fabs z) t_1) t_2))
(if (<=
(fabs z)
139999999999999991285167330229307404975375020111088221626015833673130848699810489861179420414813756105335038937414138448123527168)
(*
(*
(/ (fabs z) (sqrt (- (* (fabs z) (fabs z)) (* t a))))
t_2)
t_1)
(* 1 (* 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) <= 1.42e-210) {
tmp = (1.0 / sqrt((-t * a))) * ((fabs(z) * t_1) * t_2);
} else if (fabs(z) <= 1.4e+128) {
tmp = ((fabs(z) / sqrt(((fabs(z) * fabs(z)) - (t * a)))) * t_2) * t_1;
} 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) <= 1.42e-210) {
tmp = (1.0 / Math.sqrt((-t * a))) * ((Math.abs(z) * t_1) * t_2);
} else if (Math.abs(z) <= 1.4e+128) {
tmp = ((Math.abs(z) / Math.sqrt(((Math.abs(z) * Math.abs(z)) - (t * a)))) * t_2) * t_1;
} 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) <= 1.42e-210: tmp = (1.0 / math.sqrt((-t * a))) * ((math.fabs(z) * t_1) * t_2) elif math.fabs(z) <= 1.4e+128: tmp = ((math.fabs(z) / math.sqrt(((math.fabs(z) * math.fabs(z)) - (t * a)))) * t_2) * t_1 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) <= 1.42e-210) tmp = Float64(Float64(1.0 / sqrt(Float64(Float64(-t) * a))) * Float64(Float64(abs(z) * t_1) * t_2)); elseif (abs(z) <= 1.4e+128) tmp = Float64(Float64(Float64(abs(z) / sqrt(Float64(Float64(abs(z) * abs(z)) - Float64(t * a)))) * t_2) * t_1); else tmp = Float64(1.0 * Float64(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) <= 1.42e-210) tmp = (1.0 / sqrt((-t * a))) * ((abs(z) * t_1) * t_2); elseif (abs(z) <= 1.4e+128) tmp = ((abs(z) / sqrt(((abs(z) * abs(z)) - (t * a)))) * t_2) * t_1; 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], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * N[(N[With[{TMP1 = Abs[1], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * N[(N[With[{TMP1 = Abs[1], TMP2 = Sign[z]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[Abs[z], $MachinePrecision], 8409788860576655/5922386521532855740161817506647119732883018558947359509044845726112560091729648156474603305162988578607512400425457279991804428268870599332596921062626576000993556884845161077691136496092218188572933193945756793025561702170624], N[(N[(1 / N[Sqrt[N[((-t) * a), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[(N[Abs[z], $MachinePrecision] * t$95$1), $MachinePrecision] * t$95$2), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Abs[z], $MachinePrecision], 139999999999999991285167330229307404975375020111088221626015833673130848699810489861179420414813756105335038937414138448123527168], N[(N[(N[(N[Abs[z], $MachinePrecision] / N[Sqrt[N[(N[(N[Abs[z], $MachinePrecision] * N[Abs[z], $MachinePrecision]), $MachinePrecision] - N[(t * a), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * t$95$2), $MachinePrecision] * t$95$1), $MachinePrecision], N[(1 * N[(t$95$1 * t$95$2), $MachinePrecision]), $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 \frac{8409788860576655}{5922386521532855740161817506647119732883018558947359509044845726112560091729648156474603305162988578607512400425457279991804428268870599332596921062626576000993556884845161077691136496092218188572933193945756793025561702170624}:\\
\;\;\;\;\frac{1}{\sqrt{\left(-t\right) \cdot a}} \cdot \left(\left(\left|z\right| \cdot t\_1\right) \cdot t\_2\right)\\
\mathbf{elif}\;\left|z\right| \leq 139999999999999991285167330229307404975375020111088221626015833673130848699810489861179420414813756105335038937414138448123527168:\\
\;\;\;\;\left(\frac{\left|z\right|}{\sqrt{\left|z\right| \cdot \left|z\right| - t \cdot a}} \cdot t\_2\right) \cdot t\_1\\
\mathbf{else}:\\
\;\;\;\;1 \cdot \left(t\_1 \cdot t\_2\right)\\
\end{array}\right)\right)
\end{array}
if z < 1.42e-210Initial program 62.0%
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
associate-*l*N/A
*-commutativeN/A
*-commutativeN/A
lower-*.f64N/A
mult-flip-revN/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6459.8%
Applied rewrites59.8%
Taylor expanded in z around 0
lower-sqrt.f64N/A
lower-neg.f64N/A
lower-*.f6432.2%
Applied rewrites32.2%
lift-*.f64N/A
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
associate-*l*N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
lower-*.f64N/A
Applied rewrites32.5%
if 1.42e-210 < z < 1.3999999999999999e128Initial program 62.0%
Applied rewrites20.7%
lift-*.f64N/A
*-commutativeN/A
lift-neg.f64N/A
distribute-rgt-neg-outN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
Applied rewrites64.0%
if 1.3999999999999999e128 < z Initial program 62.0%
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
inv-powN/A
lift-sqrt.f64N/A
sqrt-fabs-revN/A
lift-sqrt.f64N/A
rem-sqrt-square-revN/A
sqrt-pow2N/A
sqr-neg-revN/A
metadata-evalN/A
metadata-evalN/A
unpow-prod-downN/A
pow-addN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
Applied rewrites64.1%
Taylor expanded in z around inf
Applied rewrites43.6%
(FPCore (x y z t a)
:precision binary64
(*
(copysign 1 z)
(if (<=
(fabs z)
139999999999999991285167330229307404975375020111088221626015833673130848699810489861179420414813756105335038937414138448123527168)
(* (/ (fabs z) (sqrt (- (* (fabs z) (fabs z)) (* a t)))) (* y x))
(* 1 (* y x)))))double code(double x, double y, double z, double t, double a) {
double tmp;
if (fabs(z) <= 1.4e+128) {
tmp = (fabs(z) / sqrt(((fabs(z) * fabs(z)) - (a * t)))) * (y * x);
} 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) <= 1.4e+128) {
tmp = (Math.abs(z) / Math.sqrt(((Math.abs(z) * Math.abs(z)) - (a * t)))) * (y * x);
} 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) <= 1.4e+128: tmp = (math.fabs(z) / math.sqrt(((math.fabs(z) * math.fabs(z)) - (a * t)))) * (y * x) 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) <= 1.4e+128) tmp = Float64(Float64(abs(z) / sqrt(Float64(Float64(abs(z) * abs(z)) - Float64(a * t)))) * Float64(y * x)); else tmp = Float64(1.0 * Float64(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) <= 1.4e+128) tmp = (abs(z) / sqrt(((abs(z) * abs(z)) - (a * t)))) * (y * x); 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], TMP2 = Sign[z]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[Abs[z], $MachinePrecision], 139999999999999991285167330229307404975375020111088221626015833673130848699810489861179420414813756105335038937414138448123527168], N[(N[(N[Abs[z], $MachinePrecision] / N[Sqrt[N[(N[(N[Abs[z], $MachinePrecision] * N[Abs[z], $MachinePrecision]), $MachinePrecision] - N[(a * t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(y * x), $MachinePrecision]), $MachinePrecision], N[(1 * N[(y * x), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\mathsf{copysign}\left(1, z\right) \cdot \begin{array}{l}
\mathbf{if}\;\left|z\right| \leq 139999999999999991285167330229307404975375020111088221626015833673130848699810489861179420414813756105335038937414138448123527168:\\
\;\;\;\;\frac{\left|z\right|}{\sqrt{\left|z\right| \cdot \left|z\right| - a \cdot t}} \cdot \left(y \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;1 \cdot \left(y \cdot x\right)\\
\end{array}
if z < 1.3999999999999999e128Initial program 62.0%
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
inv-powN/A
lift-sqrt.f64N/A
sqrt-fabs-revN/A
lift-sqrt.f64N/A
rem-sqrt-square-revN/A
sqrt-pow2N/A
sqr-neg-revN/A
metadata-evalN/A
metadata-evalN/A
unpow-prod-downN/A
pow-addN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
Applied rewrites64.1%
if 1.3999999999999999e128 < z Initial program 62.0%
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
inv-powN/A
lift-sqrt.f64N/A
sqrt-fabs-revN/A
lift-sqrt.f64N/A
rem-sqrt-square-revN/A
sqrt-pow2N/A
sqr-neg-revN/A
metadata-evalN/A
metadata-evalN/A
unpow-prod-downN/A
pow-addN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
Applied rewrites64.1%
Taylor expanded in z around inf
Applied rewrites43.6%
(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 x)
(*
(copysign 1 y)
(*
(copysign 1 z)
(if (<=
(fabs z)
8409788860576655/5922386521532855740161817506647119732883018558947359509044845726112560091729648156474603305162988578607512400425457279991804428268870599332596921062626576000993556884845161077691136496092218188572933193945756793025561702170624)
(* (/ 1 (sqrt (* (- t) a))) (* (* (fabs z) t_1) t_2))
(if (<= (fabs z) 124999999999999997902848)
(*
(*
(/ t_2 (sqrt (- (* (fabs z) (fabs z)) (* t a))))
(fabs z))
t_1)
(* 1 (* 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) <= 1.42e-210) {
tmp = (1.0 / sqrt((-t * a))) * ((fabs(z) * t_1) * t_2);
} else if (fabs(z) <= 1.25e+23) {
tmp = ((t_2 / sqrt(((fabs(z) * fabs(z)) - (t * a)))) * fabs(z)) * t_1;
} 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) <= 1.42e-210) {
tmp = (1.0 / Math.sqrt((-t * a))) * ((Math.abs(z) * t_1) * t_2);
} else if (Math.abs(z) <= 1.25e+23) {
tmp = ((t_2 / Math.sqrt(((Math.abs(z) * Math.abs(z)) - (t * a)))) * Math.abs(z)) * t_1;
} 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) <= 1.42e-210: tmp = (1.0 / math.sqrt((-t * a))) * ((math.fabs(z) * t_1) * t_2) elif math.fabs(z) <= 1.25e+23: tmp = ((t_2 / math.sqrt(((math.fabs(z) * math.fabs(z)) - (t * a)))) * math.fabs(z)) * t_1 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) <= 1.42e-210) tmp = Float64(Float64(1.0 / sqrt(Float64(Float64(-t) * a))) * Float64(Float64(abs(z) * t_1) * t_2)); elseif (abs(z) <= 1.25e+23) tmp = Float64(Float64(Float64(t_2 / sqrt(Float64(Float64(abs(z) * abs(z)) - Float64(t * a)))) * abs(z)) * t_1); else tmp = Float64(1.0 * Float64(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) <= 1.42e-210) tmp = (1.0 / sqrt((-t * a))) * ((abs(z) * t_1) * t_2); elseif (abs(z) <= 1.25e+23) tmp = ((t_2 / sqrt(((abs(z) * abs(z)) - (t * a)))) * abs(z)) * t_1; 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], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * N[(N[With[{TMP1 = Abs[1], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * N[(N[With[{TMP1 = Abs[1], TMP2 = Sign[z]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[Abs[z], $MachinePrecision], 8409788860576655/5922386521532855740161817506647119732883018558947359509044845726112560091729648156474603305162988578607512400425457279991804428268870599332596921062626576000993556884845161077691136496092218188572933193945756793025561702170624], N[(N[(1 / N[Sqrt[N[((-t) * a), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[(N[Abs[z], $MachinePrecision] * t$95$1), $MachinePrecision] * t$95$2), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Abs[z], $MachinePrecision], 124999999999999997902848], N[(N[(N[(t$95$2 / N[Sqrt[N[(N[(N[Abs[z], $MachinePrecision] * N[Abs[z], $MachinePrecision]), $MachinePrecision] - N[(t * a), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Abs[z], $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision], N[(1 * N[(t$95$1 * t$95$2), $MachinePrecision]), $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 \frac{8409788860576655}{5922386521532855740161817506647119732883018558947359509044845726112560091729648156474603305162988578607512400425457279991804428268870599332596921062626576000993556884845161077691136496092218188572933193945756793025561702170624}:\\
\;\;\;\;\frac{1}{\sqrt{\left(-t\right) \cdot a}} \cdot \left(\left(\left|z\right| \cdot t\_1\right) \cdot t\_2\right)\\
\mathbf{elif}\;\left|z\right| \leq 124999999999999997902848:\\
\;\;\;\;\left(\frac{t\_2}{\sqrt{\left|z\right| \cdot \left|z\right| - t \cdot a}} \cdot \left|z\right|\right) \cdot t\_1\\
\mathbf{else}:\\
\;\;\;\;1 \cdot \left(t\_1 \cdot t\_2\right)\\
\end{array}\right)\right)
\end{array}
if z < 1.42e-210Initial program 62.0%
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
associate-*l*N/A
*-commutativeN/A
*-commutativeN/A
lower-*.f64N/A
mult-flip-revN/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6459.8%
Applied rewrites59.8%
Taylor expanded in z around 0
lower-sqrt.f64N/A
lower-neg.f64N/A
lower-*.f6432.2%
Applied rewrites32.2%
lift-*.f64N/A
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
associate-*l*N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
lower-*.f64N/A
Applied rewrites32.5%
if 1.42e-210 < z < 1.25e23Initial program 62.0%
Applied rewrites20.7%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
mult-flipN/A
inv-powN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
pow-addN/A
unpow-prod-downN/A
metadata-evalN/A
metadata-evalN/A
sqr-neg-revN/A
metadata-evalN/A
metadata-evalN/A
unpow-prod-downN/A
pow-addN/A
Applied rewrites61.4%
if 1.25e23 < z Initial program 62.0%
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
inv-powN/A
lift-sqrt.f64N/A
sqrt-fabs-revN/A
lift-sqrt.f64N/A
rem-sqrt-square-revN/A
sqrt-pow2N/A
sqr-neg-revN/A
metadata-evalN/A
metadata-evalN/A
unpow-prod-downN/A
pow-addN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
Applied rewrites64.1%
Taylor expanded in z around inf
Applied rewrites43.6%
(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 x)
(*
(copysign 1 y)
(*
(copysign 1 z)
(if (<=
(fabs z)
633237988016573/904625697166532776746648320380374280103671755200316906558262375061821325312)
(/ (* t_1 (* t_2 (fabs z))) (sqrt (- (* a t))))
(* 1 (* 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) <= 7e-61) {
tmp = (t_1 * (t_2 * fabs(z))) / sqrt(-(a * t));
} 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) <= 7e-61) {
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, 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) <= 7e-61: 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, 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) <= 7e-61) tmp = Float64(Float64(t_1 * Float64(t_2 * abs(z))) / sqrt(Float64(-Float64(a * t)))); else tmp = Float64(1.0 * Float64(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) <= 7e-61) tmp = (t_1 * (t_2 * abs(z))) / sqrt(-(a * t)); 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], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * N[(N[With[{TMP1 = Abs[1], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * N[(N[With[{TMP1 = Abs[1], TMP2 = Sign[z]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[Abs[z], $MachinePrecision], 633237988016573/904625697166532776746648320380374280103671755200316906558262375061821325312], N[(N[(t$95$1 * N[(t$95$2 * N[Abs[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[(-N[(a * t), $MachinePrecision])], $MachinePrecision]), $MachinePrecision], N[(1 * N[(t$95$2 * t$95$1), $MachinePrecision]), $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 \frac{633237988016573}{904625697166532776746648320380374280103671755200316906558262375061821325312}:\\
\;\;\;\;\frac{t\_1 \cdot \left(t\_2 \cdot \left|z\right|\right)}{\sqrt{-a \cdot t}}\\
\mathbf{else}:\\
\;\;\;\;1 \cdot \left(t\_2 \cdot t\_1\right)\\
\end{array}\right)\right)
\end{array}
if z < 7.0000000000000006e-61Initial program 62.0%
Taylor expanded in z around 0
lower-/.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-neg.f64N/A
lower-*.f6432.5%
Applied rewrites32.5%
if 7.0000000000000006e-61 < z Initial program 62.0%
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
inv-powN/A
lift-sqrt.f64N/A
sqrt-fabs-revN/A
lift-sqrt.f64N/A
rem-sqrt-square-revN/A
sqrt-pow2N/A
sqr-neg-revN/A
metadata-evalN/A
metadata-evalN/A
unpow-prod-downN/A
pow-addN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
Applied rewrites64.1%
Taylor expanded in z around inf
Applied rewrites43.6%
(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 x)
(*
(copysign 1 y)
(*
(copysign 1 z)
(if (<=
(fabs z)
1824208758453333/388129523075177233787244872115625638814221504279174152784763009506512738171594221582719602207161619487621932674282768301542895011028703597861071818760295284801113744005212476387566321407899611206315749798429117187723211713454014464)
(* (/ (* (fabs z) t_1) (- (fabs z))) t_2)
(* 1 (* 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) <= 4.7e-216) {
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) <= 4.7e-216) {
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) <= 4.7e-216: 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) <= 4.7e-216) tmp = Float64(Float64(Float64(abs(z) * t_1) / Float64(-abs(z))) * t_2); else tmp = Float64(1.0 * Float64(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) <= 4.7e-216) 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], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * N[(N[With[{TMP1 = Abs[1], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * N[(N[With[{TMP1 = Abs[1], TMP2 = Sign[z]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[Abs[z], $MachinePrecision], 1824208758453333/388129523075177233787244872115625638814221504279174152784763009506512738171594221582719602207161619487621932674282768301542895011028703597861071818760295284801113744005212476387566321407899611206315749798429117187723211713454014464], N[(N[(N[(N[Abs[z], $MachinePrecision] * t$95$1), $MachinePrecision] / (-N[Abs[z], $MachinePrecision])), $MachinePrecision] * t$95$2), $MachinePrecision], N[(1 * N[(t$95$2 * t$95$1), $MachinePrecision]), $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 \frac{1824208758453333}{388129523075177233787244872115625638814221504279174152784763009506512738171594221582719602207161619487621932674282768301542895011028703597861071818760295284801113744005212476387566321407899611206315749798429117187723211713454014464}:\\
\;\;\;\;\frac{\left|z\right| \cdot t\_1}{-\left|z\right|} \cdot t\_2\\
\mathbf{else}:\\
\;\;\;\;1 \cdot \left(t\_2 \cdot t\_1\right)\\
\end{array}\right)\right)
\end{array}
if z < 4.7e-216Initial program 62.0%
Taylor expanded in z around -inf
lower-*.f6442.7%
Applied rewrites42.7%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites41.1%
if 4.7e-216 < z Initial program 62.0%
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
inv-powN/A
lift-sqrt.f64N/A
sqrt-fabs-revN/A
lift-sqrt.f64N/A
rem-sqrt-square-revN/A
sqrt-pow2N/A
sqr-neg-revN/A
metadata-evalN/A
metadata-evalN/A
unpow-prod-downN/A
pow-addN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
Applied rewrites64.1%
Taylor expanded in z around inf
Applied rewrites43.6%
(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 x)
(*
(copysign 1 y)
(*
(copysign 1 z)
(if (<=
(* t a)
-5503834670046917/20769187434139310514121985316880384)
(* (/ t_1 (fabs z)) (* (fabs z) t_2))
(* 1 (* 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) <= -2.65e-19) {
tmp = (t_1 / fabs(z)) * (fabs(z) * 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) <= -2.65e-19) {
tmp = (t_1 / Math.abs(z)) * (Math.abs(z) * 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) <= -2.65e-19: tmp = (t_1 / math.fabs(z)) * (math.fabs(z) * 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) <= -2.65e-19) tmp = Float64(Float64(t_1 / abs(z)) * Float64(abs(z) * t_2)); else tmp = Float64(1.0 * Float64(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) <= -2.65e-19) tmp = (t_1 / abs(z)) * (abs(z) * 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], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * N[(N[With[{TMP1 = Abs[1], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * N[(N[With[{TMP1 = Abs[1], TMP2 = Sign[z]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[(t * a), $MachinePrecision], -5503834670046917/20769187434139310514121985316880384], N[(N[(t$95$1 / N[Abs[z], $MachinePrecision]), $MachinePrecision] * N[(N[Abs[z], $MachinePrecision] * t$95$2), $MachinePrecision]), $MachinePrecision], N[(1 * N[(t$95$1 * t$95$2), $MachinePrecision]), $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 \frac{-5503834670046917}{20769187434139310514121985316880384}:\\
\;\;\;\;\frac{t\_1}{\left|z\right|} \cdot \left(\left|z\right| \cdot t\_2\right)\\
\mathbf{else}:\\
\;\;\;\;1 \cdot \left(t\_1 \cdot t\_2\right)\\
\end{array}\right)\right)
\end{array}
if (*.f64 t a) < -2.6499999999999999e-19Initial program 62.0%
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
associate-*l*N/A
*-commutativeN/A
*-commutativeN/A
lower-*.f64N/A
mult-flip-revN/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6459.8%
Applied rewrites59.8%
Taylor expanded in z around inf
lower-/.f6437.5%
Applied rewrites37.5%
if -2.6499999999999999e-19 < (*.f64 t a) Initial program 62.0%
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
inv-powN/A
lift-sqrt.f64N/A
sqrt-fabs-revN/A
lift-sqrt.f64N/A
rem-sqrt-square-revN/A
sqrt-pow2N/A
sqr-neg-revN/A
metadata-evalN/A
metadata-evalN/A
unpow-prod-downN/A
pow-addN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
Applied rewrites64.1%
Taylor expanded in z around inf
Applied rewrites43.6%
(FPCore (x y z t a) :precision binary64 (* (copysign 1 z) (* 1 (* 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(1.0 * Float64(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], TMP2 = Sign[z]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * N[(1 * N[(y * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\mathsf{copysign}\left(1, z\right) \cdot \left(1 \cdot \left(y \cdot x\right)\right)
Initial program 62.0%
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
inv-powN/A
lift-sqrt.f64N/A
sqrt-fabs-revN/A
lift-sqrt.f64N/A
rem-sqrt-square-revN/A
sqrt-pow2N/A
sqr-neg-revN/A
metadata-evalN/A
metadata-evalN/A
unpow-prod-downN/A
pow-addN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
Applied rewrites64.1%
Taylor expanded in z around inf
Applied rewrites43.6%
(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 62.0%
Taylor expanded in z around -inf
lower-*.f64N/A
lower-*.f6443.8%
Applied rewrites43.8%
lift-*.f64N/A
mul-1-negN/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
lower-neg.f6443.8%
Applied rewrites43.8%
herbie shell --seed 2025271 -o generate:evaluate
(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)))))