
(FPCore (x y z t a) :precision binary64 (/ (- (* x y) (* (* z 9.0) t)) (* a 2.0)))
double code(double x, double y, double z, double t, double a) {
return ((x * y) - ((z * 9.0) * t)) / (a * 2.0);
}
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 * 9.0d0) * t)) / (a * 2.0d0)
end function
public static double code(double x, double y, double z, double t, double a) {
return ((x * y) - ((z * 9.0) * t)) / (a * 2.0);
}
def code(x, y, z, t, a): return ((x * y) - ((z * 9.0) * t)) / (a * 2.0)
function code(x, y, z, t, a) return Float64(Float64(Float64(x * y) - Float64(Float64(z * 9.0) * t)) / Float64(a * 2.0)) end
function tmp = code(x, y, z, t, a) tmp = ((x * y) - ((z * 9.0) * t)) / (a * 2.0); end
code[x_, y_, z_, t_, a_] := N[(N[(N[(x * y), $MachinePrecision] - N[(N[(z * 9.0), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision]
\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2}
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (/ (- (* x y) (* (* z 9.0) t)) (* a 2.0)))
double code(double x, double y, double z, double t, double a) {
return ((x * y) - ((z * 9.0) * t)) / (a * 2.0);
}
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 * 9.0d0) * t)) / (a * 2.0d0)
end function
public static double code(double x, double y, double z, double t, double a) {
return ((x * y) - ((z * 9.0) * t)) / (a * 2.0);
}
def code(x, y, z, t, a): return ((x * y) - ((z * 9.0) * t)) / (a * 2.0)
function code(x, y, z, t, a) return Float64(Float64(Float64(x * y) - Float64(Float64(z * 9.0) * t)) / Float64(a * 2.0)) end
function tmp = code(x, y, z, t, a) tmp = ((x * y) - ((z * 9.0) * t)) / (a * 2.0); end
code[x_, y_, z_, t_, a_] := N[(N[(N[(x * y), $MachinePrecision] - N[(N[(z * 9.0), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision]
\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2}
(FPCore (x y z t a)
:precision binary64
(let* ((t_1
(fma
(- (fmin z t))
(* 4.5 (/ (fmax z t) a))
(* (/ (fmin x y) (+ a a)) (fmax x y))))
(t_2 (- (* (fmin x y) (fmax x y)) (* (* (fmin z t) 9.0) (fmax z t)))))
(if (<= t_2 (- INFINITY))
t_1
(if (<= t_2 2e+256)
(/
(* (fma (* (fmax z t) (fmin z t)) -9.0 (* (fmax x y) (fmin x y))) 0.5)
a)
t_1))))double code(double x, double y, double z, double t, double a) {
double t_1 = fma(-fmin(z, t), (4.5 * (fmax(z, t) / a)), ((fmin(x, y) / (a + a)) * fmax(x, y)));
double t_2 = (fmin(x, y) * fmax(x, y)) - ((fmin(z, t) * 9.0) * fmax(z, t));
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = t_1;
} else if (t_2 <= 2e+256) {
tmp = (fma((fmax(z, t) * fmin(z, t)), -9.0, (fmax(x, y) * fmin(x, y))) * 0.5) / a;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(-fmin(z, t)), Float64(4.5 * Float64(fmax(z, t) / a)), Float64(Float64(fmin(x, y) / Float64(a + a)) * fmax(x, y))) t_2 = Float64(Float64(fmin(x, y) * fmax(x, y)) - Float64(Float64(fmin(z, t) * 9.0) * fmax(z, t))) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = t_1; elseif (t_2 <= 2e+256) tmp = Float64(Float64(fma(Float64(fmax(z, t) * fmin(z, t)), -9.0, Float64(fmax(x, y) * fmin(x, y))) * 0.5) / a); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[((-N[Min[z, t], $MachinePrecision]) * N[(4.5 * N[(N[Max[z, t], $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision] + N[(N[(N[Min[x, y], $MachinePrecision] / N[(a + a), $MachinePrecision]), $MachinePrecision] * N[Max[x, y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[Min[x, y], $MachinePrecision] * N[Max[x, y], $MachinePrecision]), $MachinePrecision] - N[(N[(N[Min[z, t], $MachinePrecision] * 9.0), $MachinePrecision] * N[Max[z, t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], t$95$1, If[LessEqual[t$95$2, 2e+256], N[(N[(N[(N[(N[Max[z, t], $MachinePrecision] * N[Min[z, t], $MachinePrecision]), $MachinePrecision] * -9.0 + N[(N[Max[x, y], $MachinePrecision] * N[Min[x, y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision] / a), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
t_1 := \mathsf{fma}\left(-\mathsf{min}\left(z, t\right), 4.5 \cdot \frac{\mathsf{max}\left(z, t\right)}{a}, \frac{\mathsf{min}\left(x, y\right)}{a + a} \cdot \mathsf{max}\left(x, y\right)\right)\\
t_2 := \mathsf{min}\left(x, y\right) \cdot \mathsf{max}\left(x, y\right) - \left(\mathsf{min}\left(z, t\right) \cdot 9\right) \cdot \mathsf{max}\left(z, t\right)\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+256}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\mathsf{max}\left(z, t\right) \cdot \mathsf{min}\left(z, t\right), -9, \mathsf{max}\left(x, y\right) \cdot \mathsf{min}\left(x, y\right)\right) \cdot 0.5}{a}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if (-.f64 (*.f64 x y) (*.f64 (*.f64 z #s(literal 9 binary64)) t)) < -inf.0 or 2.0000000000000001e256 < (-.f64 (*.f64 x y) (*.f64 (*.f64 z #s(literal 9 binary64)) t)) Initial program 90.8%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
sub-flipN/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
associate-/l*N/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
lower-neg.f64N/A
lift-*.f64N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
metadata-evalN/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites87.6%
if -inf.0 < (-.f64 (*.f64 x y) (*.f64 (*.f64 z #s(literal 9 binary64)) t)) < 2.0000000000000001e256Initial program 90.8%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
mult-flipN/A
lower-*.f64N/A
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
distribute-rgt-neg-inN/A
lower-fma.f64N/A
lower-*.f64N/A
metadata-evalN/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
metadata-eval90.9%
Applied rewrites90.9%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ y (+ a a)))
(t_2 (- (* x y) (* (* (fmin z t) 9.0) (fmax z t)))))
(if (<= t_2 (- INFINITY))
(fma x t_1 (* (* (/ (fmax z t) a) (fmin z t)) -4.5))
(if (<= t_2 4e+292)
(/ (* (fma (* (fmax z t) (fmin z t)) -9.0 (* y x)) 0.5) a)
(fma (fmax z t) (* (/ (fmin z t) a) -4.5) (* x t_1))))))double code(double x, double y, double z, double t, double a) {
double t_1 = y / (a + a);
double t_2 = (x * y) - ((fmin(z, t) * 9.0) * fmax(z, t));
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = fma(x, t_1, (((fmax(z, t) / a) * fmin(z, t)) * -4.5));
} else if (t_2 <= 4e+292) {
tmp = (fma((fmax(z, t) * fmin(z, t)), -9.0, (y * x)) * 0.5) / a;
} else {
tmp = fma(fmax(z, t), ((fmin(z, t) / a) * -4.5), (x * t_1));
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(y / Float64(a + a)) t_2 = Float64(Float64(x * y) - Float64(Float64(fmin(z, t) * 9.0) * fmax(z, t))) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = fma(x, t_1, Float64(Float64(Float64(fmax(z, t) / a) * fmin(z, t)) * -4.5)); elseif (t_2 <= 4e+292) tmp = Float64(Float64(fma(Float64(fmax(z, t) * fmin(z, t)), -9.0, Float64(y * x)) * 0.5) / a); else tmp = fma(fmax(z, t), Float64(Float64(fmin(z, t) / a) * -4.5), Float64(x * t_1)); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(y / N[(a + a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x * y), $MachinePrecision] - N[(N[(N[Min[z, t], $MachinePrecision] * 9.0), $MachinePrecision] * N[Max[z, t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], N[(x * t$95$1 + N[(N[(N[(N[Max[z, t], $MachinePrecision] / a), $MachinePrecision] * N[Min[z, t], $MachinePrecision]), $MachinePrecision] * -4.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 4e+292], N[(N[(N[(N[(N[Max[z, t], $MachinePrecision] * N[Min[z, t], $MachinePrecision]), $MachinePrecision] * -9.0 + N[(y * x), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision] / a), $MachinePrecision], N[(N[Max[z, t], $MachinePrecision] * N[(N[(N[Min[z, t], $MachinePrecision] / a), $MachinePrecision] * -4.5), $MachinePrecision] + N[(x * t$95$1), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
t_1 := \frac{y}{a + a}\\
t_2 := x \cdot y - \left(\mathsf{min}\left(z, t\right) \cdot 9\right) \cdot \mathsf{max}\left(z, t\right)\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;\mathsf{fma}\left(x, t\_1, \left(\frac{\mathsf{max}\left(z, t\right)}{a} \cdot \mathsf{min}\left(z, t\right)\right) \cdot -4.5\right)\\
\mathbf{elif}\;t\_2 \leq 4 \cdot 10^{+292}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\mathsf{max}\left(z, t\right) \cdot \mathsf{min}\left(z, t\right), -9, y \cdot x\right) \cdot 0.5}{a}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{max}\left(z, t\right), \frac{\mathsf{min}\left(z, t\right)}{a} \cdot -4.5, x \cdot t\_1\right)\\
\end{array}
if (-.f64 (*.f64 x y) (*.f64 (*.f64 z #s(literal 9 binary64)) t)) < -inf.0Initial program 90.8%
lift-/.f64N/A
mult-flipN/A
lower-*.f64N/A
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
distribute-rgt-neg-inN/A
lower-fma.f64N/A
lower-*.f64N/A
metadata-evalN/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
metadata-eval90.8%
Applied rewrites90.8%
lift-/.f64N/A
metadata-evalN/A
associate-/r*N/A
*-commutativeN/A
lower-*.f64N/A
mult-flip-revN/A
lift-fma.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
+-commutativeN/A
div-add-revN/A
lift-*.f64N/A
associate-/l*N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
times-fracN/A
metadata-evalN/A
lift-/.f64N/A
Applied rewrites87.9%
if -inf.0 < (-.f64 (*.f64 x y) (*.f64 (*.f64 z #s(literal 9 binary64)) t)) < 4.0000000000000001e292Initial program 90.8%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
mult-flipN/A
lower-*.f64N/A
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
distribute-rgt-neg-inN/A
lower-fma.f64N/A
lower-*.f64N/A
metadata-evalN/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
metadata-eval90.9%
Applied rewrites90.9%
if 4.0000000000000001e292 < (-.f64 (*.f64 x y) (*.f64 (*.f64 z #s(literal 9 binary64)) t)) Initial program 90.8%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
mult-flipN/A
lower-*.f64N/A
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
distribute-rgt-neg-inN/A
lower-fma.f64N/A
lower-*.f64N/A
metadata-evalN/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
metadata-eval90.9%
Applied rewrites90.9%
lift-/.f64N/A
lift-*.f64N/A
metadata-evalN/A
mult-flip-revN/A
associate-/r*N/A
lift-fma.f64N/A
count-2N/A
lift-+.f64N/A
div-addN/A
lift-*.f64N/A
associate-*l*N/A
associate-/l*N/A
lift-+.f64N/A
count-2N/A
*-commutativeN/A
frac-timesN/A
metadata-evalN/A
lift-*.f64N/A
*-commutativeN/A
lift-+.f64N/A
count-2N/A
*-commutativeN/A
lift-*.f64N/A
Applied rewrites88.1%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ (fabs a) (fabs a))))
(*
(copysign 1.0 a)
(if (<= (fabs a) 5e-57)
(/ (fma (* -9.0 (fmin z t)) (fmax z t) (* x y)) t_1)
(fma (fmax z t) (* (/ (fmin z t) (fabs a)) -4.5) (* x (/ y t_1)))))))double code(double x, double y, double z, double t, double a) {
double t_1 = fabs(a) + fabs(a);
double tmp;
if (fabs(a) <= 5e-57) {
tmp = fma((-9.0 * fmin(z, t)), fmax(z, t), (x * y)) / t_1;
} else {
tmp = fma(fmax(z, t), ((fmin(z, t) / fabs(a)) * -4.5), (x * (y / t_1)));
}
return copysign(1.0, a) * tmp;
}
function code(x, y, z, t, a) t_1 = Float64(abs(a) + abs(a)) tmp = 0.0 if (abs(a) <= 5e-57) tmp = Float64(fma(Float64(-9.0 * fmin(z, t)), fmax(z, t), Float64(x * y)) / t_1); else tmp = fma(fmax(z, t), Float64(Float64(fmin(z, t) / abs(a)) * -4.5), Float64(x * Float64(y / t_1))); end return Float64(copysign(1.0, a) * tmp) end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[Abs[a], $MachinePrecision] + N[Abs[a], $MachinePrecision]), $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[Abs[a], $MachinePrecision], 5e-57], N[(N[(N[(-9.0 * N[Min[z, t], $MachinePrecision]), $MachinePrecision] * N[Max[z, t], $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision], N[(N[Max[z, t], $MachinePrecision] * N[(N[(N[Min[z, t], $MachinePrecision] / N[Abs[a], $MachinePrecision]), $MachinePrecision] * -4.5), $MachinePrecision] + N[(x * N[(y / t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]]
\begin{array}{l}
t_1 := \left|a\right| + \left|a\right|\\
\mathsf{copysign}\left(1, a\right) \cdot \begin{array}{l}
\mathbf{if}\;\left|a\right| \leq 5 \cdot 10^{-57}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-9 \cdot \mathsf{min}\left(z, t\right), \mathsf{max}\left(z, t\right), x \cdot y\right)}{t\_1}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{max}\left(z, t\right), \frac{\mathsf{min}\left(z, t\right)}{\left|a\right|} \cdot -4.5, x \cdot \frac{y}{t\_1}\right)\\
\end{array}
\end{array}
if a < 5.0000000000000002e-57Initial program 90.8%
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
distribute-rgt-neg-inN/A
lower-fma.f64N/A
lower-*.f64N/A
metadata-eval90.9%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6490.9%
lift-*.f64N/A
*-commutativeN/A
count-2-revN/A
lower-+.f6490.9%
Applied rewrites90.9%
lift-fma.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6491.0%
Applied rewrites91.0%
if 5.0000000000000002e-57 < a Initial program 90.8%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
mult-flipN/A
lower-*.f64N/A
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
distribute-rgt-neg-inN/A
lower-fma.f64N/A
lower-*.f64N/A
metadata-evalN/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
metadata-eval90.9%
Applied rewrites90.9%
lift-/.f64N/A
lift-*.f64N/A
metadata-evalN/A
mult-flip-revN/A
associate-/r*N/A
lift-fma.f64N/A
count-2N/A
lift-+.f64N/A
div-addN/A
lift-*.f64N/A
associate-*l*N/A
associate-/l*N/A
lift-+.f64N/A
count-2N/A
*-commutativeN/A
frac-timesN/A
metadata-evalN/A
lift-*.f64N/A
*-commutativeN/A
lift-+.f64N/A
count-2N/A
*-commutativeN/A
lift-*.f64N/A
Applied rewrites88.1%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* (* (fmin z t) 9.0) (fmax z t))))
(if (<= t_1 (- INFINITY))
(* (/ (fmax z t) a) (* -4.5 (fmin z t)))
(if (<= t_1 1e+308)
(/ (* (fma (* (fmax z t) (fmin z t)) -9.0 (* y x)) 0.5) a)
(* -4.5 (* (/ (fmin z t) a) (fmax z t)))))))double code(double x, double y, double z, double t, double a) {
double t_1 = (fmin(z, t) * 9.0) * fmax(z, t);
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = (fmax(z, t) / a) * (-4.5 * fmin(z, t));
} else if (t_1 <= 1e+308) {
tmp = (fma((fmax(z, t) * fmin(z, t)), -9.0, (y * x)) * 0.5) / a;
} else {
tmp = -4.5 * ((fmin(z, t) / a) * fmax(z, t));
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(fmin(z, t) * 9.0) * fmax(z, t)) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(Float64(fmax(z, t) / a) * Float64(-4.5 * fmin(z, t))); elseif (t_1 <= 1e+308) tmp = Float64(Float64(fma(Float64(fmax(z, t) * fmin(z, t)), -9.0, Float64(y * x)) * 0.5) / a); else tmp = Float64(-4.5 * Float64(Float64(fmin(z, t) / a) * fmax(z, t))); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[Min[z, t], $MachinePrecision] * 9.0), $MachinePrecision] * N[Max[z, t], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(N[(N[Max[z, t], $MachinePrecision] / a), $MachinePrecision] * N[(-4.5 * N[Min[z, t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e+308], N[(N[(N[(N[(N[Max[z, t], $MachinePrecision] * N[Min[z, t], $MachinePrecision]), $MachinePrecision] * -9.0 + N[(y * x), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision] / a), $MachinePrecision], N[(-4.5 * N[(N[(N[Min[z, t], $MachinePrecision] / a), $MachinePrecision] * N[Max[z, t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
t_1 := \left(\mathsf{min}\left(z, t\right) \cdot 9\right) \cdot \mathsf{max}\left(z, t\right)\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;\frac{\mathsf{max}\left(z, t\right)}{a} \cdot \left(-4.5 \cdot \mathsf{min}\left(z, t\right)\right)\\
\mathbf{elif}\;t\_1 \leq 10^{+308}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\mathsf{max}\left(z, t\right) \cdot \mathsf{min}\left(z, t\right), -9, y \cdot x\right) \cdot 0.5}{a}\\
\mathbf{else}:\\
\;\;\;\;-4.5 \cdot \left(\frac{\mathsf{min}\left(z, t\right)}{a} \cdot \mathsf{max}\left(z, t\right)\right)\\
\end{array}
if (*.f64 (*.f64 z #s(literal 9 binary64)) t) < -inf.0Initial program 90.8%
Taylor expanded in x around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6449.5%
Applied rewrites49.5%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6450.6%
Applied rewrites50.6%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6450.6%
Applied rewrites50.6%
if -inf.0 < (*.f64 (*.f64 z #s(literal 9 binary64)) t) < 1e308Initial program 90.8%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
mult-flipN/A
lower-*.f64N/A
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
distribute-rgt-neg-inN/A
lower-fma.f64N/A
lower-*.f64N/A
metadata-evalN/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
metadata-eval90.9%
Applied rewrites90.9%
if 1e308 < (*.f64 (*.f64 z #s(literal 9 binary64)) t) Initial program 90.8%
Taylor expanded in x around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6449.5%
Applied rewrites49.5%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6450.5%
Applied rewrites50.5%
(FPCore (x y z t a) :precision binary64 (if (<= (* (* (fmin z t) 9.0) (fmax z t)) 1e+233) (/ (fma (* -9.0 (fmin z t)) (fmax z t) (* x y)) (+ a a)) (* (* -4.5 (/ (fmax z t) a)) (fmin z t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (((fmin(z, t) * 9.0) * fmax(z, t)) <= 1e+233) {
tmp = fma((-9.0 * fmin(z, t)), fmax(z, t), (x * y)) / (a + a);
} else {
tmp = (-4.5 * (fmax(z, t) / a)) * fmin(z, t);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (Float64(Float64(fmin(z, t) * 9.0) * fmax(z, t)) <= 1e+233) tmp = Float64(fma(Float64(-9.0 * fmin(z, t)), fmax(z, t), Float64(x * y)) / Float64(a + a)); else tmp = Float64(Float64(-4.5 * Float64(fmax(z, t) / a)) * fmin(z, t)); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[N[(N[(N[Min[z, t], $MachinePrecision] * 9.0), $MachinePrecision] * N[Max[z, t], $MachinePrecision]), $MachinePrecision], 1e+233], N[(N[(N[(-9.0 * N[Min[z, t], $MachinePrecision]), $MachinePrecision] * N[Max[z, t], $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision] / N[(a + a), $MachinePrecision]), $MachinePrecision], N[(N[(-4.5 * N[(N[Max[z, t], $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision] * N[Min[z, t], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;\left(\mathsf{min}\left(z, t\right) \cdot 9\right) \cdot \mathsf{max}\left(z, t\right) \leq 10^{+233}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-9 \cdot \mathsf{min}\left(z, t\right), \mathsf{max}\left(z, t\right), x \cdot y\right)}{a + a}\\
\mathbf{else}:\\
\;\;\;\;\left(-4.5 \cdot \frac{\mathsf{max}\left(z, t\right)}{a}\right) \cdot \mathsf{min}\left(z, t\right)\\
\end{array}
if (*.f64 (*.f64 z #s(literal 9 binary64)) t) < 9.9999999999999997e232Initial program 90.8%
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
distribute-rgt-neg-inN/A
lower-fma.f64N/A
lower-*.f64N/A
metadata-eval90.9%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6490.9%
lift-*.f64N/A
*-commutativeN/A
count-2-revN/A
lower-+.f6490.9%
Applied rewrites90.9%
lift-fma.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6491.0%
Applied rewrites91.0%
if 9.9999999999999997e232 < (*.f64 (*.f64 z #s(literal 9 binary64)) t) Initial program 90.8%
Taylor expanded in x around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6449.5%
Applied rewrites49.5%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6450.6%
Applied rewrites50.6%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6450.6%
Applied rewrites50.6%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* 0.5 (/ (* x y) a))))
(if (<= (* x y) -2e+16)
t_1
(if (<= (* x y) 5e-24) (/ (* -4.5 (* t z)) a) t_1))))double code(double x, double y, double z, double t, double a) {
double t_1 = 0.5 * ((x * y) / a);
double tmp;
if ((x * y) <= -2e+16) {
tmp = t_1;
} else if ((x * y) <= 5e-24) {
tmp = (-4.5 * (t * z)) / a;
} else {
tmp = t_1;
}
return tmp;
}
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
real(8) :: t_1
real(8) :: tmp
t_1 = 0.5d0 * ((x * y) / a)
if ((x * y) <= (-2d+16)) then
tmp = t_1
else if ((x * y) <= 5d-24) then
tmp = ((-4.5d0) * (t * z)) / a
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = 0.5 * ((x * y) / a);
double tmp;
if ((x * y) <= -2e+16) {
tmp = t_1;
} else if ((x * y) <= 5e-24) {
tmp = (-4.5 * (t * z)) / a;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = 0.5 * ((x * y) / a) tmp = 0 if (x * y) <= -2e+16: tmp = t_1 elif (x * y) <= 5e-24: tmp = (-4.5 * (t * z)) / a else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(0.5 * Float64(Float64(x * y) / a)) tmp = 0.0 if (Float64(x * y) <= -2e+16) tmp = t_1; elseif (Float64(x * y) <= 5e-24) tmp = Float64(Float64(-4.5 * Float64(t * z)) / a); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = 0.5 * ((x * y) / a); tmp = 0.0; if ((x * y) <= -2e+16) tmp = t_1; elseif ((x * y) <= 5e-24) tmp = (-4.5 * (t * z)) / a; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(0.5 * N[(N[(x * y), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x * y), $MachinePrecision], -2e+16], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 5e-24], N[(N[(-4.5 * N[(t * z), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := 0.5 \cdot \frac{x \cdot y}{a}\\
\mathbf{if}\;x \cdot y \leq -2 \cdot 10^{+16}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{-24}:\\
\;\;\;\;\frac{-4.5 \cdot \left(t \cdot z\right)}{a}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if (*.f64 x y) < -2e16 or 4.9999999999999998e-24 < (*.f64 x y) Initial program 90.8%
Taylor expanded in x around inf
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6451.0%
Applied rewrites51.0%
if -2e16 < (*.f64 x y) < 4.9999999999999998e-24Initial program 90.8%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
mult-flipN/A
lower-*.f64N/A
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
distribute-rgt-neg-inN/A
lower-fma.f64N/A
lower-*.f64N/A
metadata-evalN/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
metadata-eval90.9%
Applied rewrites90.9%
Taylor expanded in x around 0
lower-*.f64N/A
lower-*.f6449.4%
Applied rewrites49.4%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* 0.5 (/ (* x y) a))))
(if (<= (* x y) -2.8e+16)
t_1
(if (<= (* x y) 1.1e-21) (* -4.5 (/ (* t z) a)) t_1))))double code(double x, double y, double z, double t, double a) {
double t_1 = 0.5 * ((x * y) / a);
double tmp;
if ((x * y) <= -2.8e+16) {
tmp = t_1;
} else if ((x * y) <= 1.1e-21) {
tmp = -4.5 * ((t * z) / a);
} else {
tmp = t_1;
}
return tmp;
}
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
real(8) :: t_1
real(8) :: tmp
t_1 = 0.5d0 * ((x * y) / a)
if ((x * y) <= (-2.8d+16)) then
tmp = t_1
else if ((x * y) <= 1.1d-21) then
tmp = (-4.5d0) * ((t * z) / a)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = 0.5 * ((x * y) / a);
double tmp;
if ((x * y) <= -2.8e+16) {
tmp = t_1;
} else if ((x * y) <= 1.1e-21) {
tmp = -4.5 * ((t * z) / a);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = 0.5 * ((x * y) / a) tmp = 0 if (x * y) <= -2.8e+16: tmp = t_1 elif (x * y) <= 1.1e-21: tmp = -4.5 * ((t * z) / a) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(0.5 * Float64(Float64(x * y) / a)) tmp = 0.0 if (Float64(x * y) <= -2.8e+16) tmp = t_1; elseif (Float64(x * y) <= 1.1e-21) tmp = Float64(-4.5 * Float64(Float64(t * z) / a)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = 0.5 * ((x * y) / a); tmp = 0.0; if ((x * y) <= -2.8e+16) tmp = t_1; elseif ((x * y) <= 1.1e-21) tmp = -4.5 * ((t * z) / a); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(0.5 * N[(N[(x * y), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x * y), $MachinePrecision], -2.8e+16], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 1.1e-21], N[(-4.5 * N[(N[(t * z), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := 0.5 \cdot \frac{x \cdot y}{a}\\
\mathbf{if}\;x \cdot y \leq -2.8 \cdot 10^{+16}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \cdot y \leq 1.1 \cdot 10^{-21}:\\
\;\;\;\;-4.5 \cdot \frac{t \cdot z}{a}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if (*.f64 x y) < -2.8e16 or 1.1e-21 < (*.f64 x y) Initial program 90.8%
Taylor expanded in x around inf
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6451.0%
Applied rewrites51.0%
if -2.8e16 < (*.f64 x y) < 1.1e-21Initial program 90.8%
Taylor expanded in x around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6449.5%
Applied rewrites49.5%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* -4.5 (* z (/ t (fabs a)))))
(t_2 (/ (- (* x y) (* (* z 9.0) t)) (* (fabs a) 2.0))))
(*
(copysign 1.0 a)
(if (<= t_2 -1.5e+274)
t_1
(if (<= t_2 1e+204) (* -4.5 (/ (* t z) (fabs a))) t_1)))))double code(double x, double y, double z, double t, double a) {
double t_1 = -4.5 * (z * (t / fabs(a)));
double t_2 = ((x * y) - ((z * 9.0) * t)) / (fabs(a) * 2.0);
double tmp;
if (t_2 <= -1.5e+274) {
tmp = t_1;
} else if (t_2 <= 1e+204) {
tmp = -4.5 * ((t * z) / fabs(a));
} else {
tmp = t_1;
}
return copysign(1.0, a) * tmp;
}
public static double code(double x, double y, double z, double t, double a) {
double t_1 = -4.5 * (z * (t / Math.abs(a)));
double t_2 = ((x * y) - ((z * 9.0) * t)) / (Math.abs(a) * 2.0);
double tmp;
if (t_2 <= -1.5e+274) {
tmp = t_1;
} else if (t_2 <= 1e+204) {
tmp = -4.5 * ((t * z) / Math.abs(a));
} else {
tmp = t_1;
}
return Math.copySign(1.0, a) * tmp;
}
def code(x, y, z, t, a): t_1 = -4.5 * (z * (t / math.fabs(a))) t_2 = ((x * y) - ((z * 9.0) * t)) / (math.fabs(a) * 2.0) tmp = 0 if t_2 <= -1.5e+274: tmp = t_1 elif t_2 <= 1e+204: tmp = -4.5 * ((t * z) / math.fabs(a)) else: tmp = t_1 return math.copysign(1.0, a) * tmp
function code(x, y, z, t, a) t_1 = Float64(-4.5 * Float64(z * Float64(t / abs(a)))) t_2 = Float64(Float64(Float64(x * y) - Float64(Float64(z * 9.0) * t)) / Float64(abs(a) * 2.0)) tmp = 0.0 if (t_2 <= -1.5e+274) tmp = t_1; elseif (t_2 <= 1e+204) tmp = Float64(-4.5 * Float64(Float64(t * z) / abs(a))); else tmp = t_1; end return Float64(copysign(1.0, a) * tmp) end
function tmp_2 = code(x, y, z, t, a) t_1 = -4.5 * (z * (t / abs(a))); t_2 = ((x * y) - ((z * 9.0) * t)) / (abs(a) * 2.0); tmp = 0.0; if (t_2 <= -1.5e+274) tmp = t_1; elseif (t_2 <= 1e+204) tmp = -4.5 * ((t * z) / abs(a)); else tmp = t_1; end tmp_2 = (sign(a) * abs(1.0)) * tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(-4.5 * N[(z * N[(t / N[Abs[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(x * y), $MachinePrecision] - N[(N[(z * 9.0), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] / N[(N[Abs[a], $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[t$95$2, -1.5e+274], t$95$1, If[LessEqual[t$95$2, 1e+204], N[(-4.5 * N[(N[(t * z), $MachinePrecision] / N[Abs[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]), $MachinePrecision]]]
\begin{array}{l}
t_1 := -4.5 \cdot \left(z \cdot \frac{t}{\left|a\right|}\right)\\
t_2 := \frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{\left|a\right| \cdot 2}\\
\mathsf{copysign}\left(1, a\right) \cdot \begin{array}{l}
\mathbf{if}\;t\_2 \leq -1.5 \cdot 10^{+274}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 10^{+204}:\\
\;\;\;\;-4.5 \cdot \frac{t \cdot z}{\left|a\right|}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (/.f64 (-.f64 (*.f64 x y) (*.f64 (*.f64 z #s(literal 9 binary64)) t)) (*.f64 a #s(literal 2 binary64))) < -1.5e274 or 9.9999999999999999e203 < (/.f64 (-.f64 (*.f64 x y) (*.f64 (*.f64 z #s(literal 9 binary64)) t)) (*.f64 a #s(literal 2 binary64))) Initial program 90.8%
Taylor expanded in x around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6449.5%
Applied rewrites49.5%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6450.6%
Applied rewrites50.6%
if -1.5e274 < (/.f64 (-.f64 (*.f64 x y) (*.f64 (*.f64 z #s(literal 9 binary64)) t)) (*.f64 a #s(literal 2 binary64))) < 9.9999999999999999e203Initial program 90.8%
Taylor expanded in x around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6449.5%
Applied rewrites49.5%
(FPCore (x y z t a) :precision binary64 (if (<= (fmin z t) -4e+129) (* -4.5 (* (/ (fmin z t) a) (fmax z t))) (* -4.5 (* (fmin z t) (/ (fmax z t) a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (fmin(z, t) <= -4e+129) {
tmp = -4.5 * ((fmin(z, t) / a) * fmax(z, t));
} else {
tmp = -4.5 * (fmin(z, t) * (fmax(z, t) / a));
}
return tmp;
}
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
real(8) :: tmp
if (fmin(z, t) <= (-4d+129)) then
tmp = (-4.5d0) * ((fmin(z, t) / a) * fmax(z, t))
else
tmp = (-4.5d0) * (fmin(z, t) * (fmax(z, t) / a))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (fmin(z, t) <= -4e+129) {
tmp = -4.5 * ((fmin(z, t) / a) * fmax(z, t));
} else {
tmp = -4.5 * (fmin(z, t) * (fmax(z, t) / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if fmin(z, t) <= -4e+129: tmp = -4.5 * ((fmin(z, t) / a) * fmax(z, t)) else: tmp = -4.5 * (fmin(z, t) * (fmax(z, t) / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (fmin(z, t) <= -4e+129) tmp = Float64(-4.5 * Float64(Float64(fmin(z, t) / a) * fmax(z, t))); else tmp = Float64(-4.5 * Float64(fmin(z, t) * Float64(fmax(z, t) / a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (min(z, t) <= -4e+129) tmp = -4.5 * ((min(z, t) / a) * max(z, t)); else tmp = -4.5 * (min(z, t) * (max(z, t) / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[N[Min[z, t], $MachinePrecision], -4e+129], N[(-4.5 * N[(N[(N[Min[z, t], $MachinePrecision] / a), $MachinePrecision] * N[Max[z, t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-4.5 * N[(N[Min[z, t], $MachinePrecision] * N[(N[Max[z, t], $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;\mathsf{min}\left(z, t\right) \leq -4 \cdot 10^{+129}:\\
\;\;\;\;-4.5 \cdot \left(\frac{\mathsf{min}\left(z, t\right)}{a} \cdot \mathsf{max}\left(z, t\right)\right)\\
\mathbf{else}:\\
\;\;\;\;-4.5 \cdot \left(\mathsf{min}\left(z, t\right) \cdot \frac{\mathsf{max}\left(z, t\right)}{a}\right)\\
\end{array}
if z < -4e129Initial program 90.8%
Taylor expanded in x around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6449.5%
Applied rewrites49.5%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6450.5%
Applied rewrites50.5%
if -4e129 < z Initial program 90.8%
Taylor expanded in x around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6449.5%
Applied rewrites49.5%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6450.6%
Applied rewrites50.6%
(FPCore (x y z t a) :precision binary64 (* -4.5 (* z (/ t a))))
double code(double x, double y, double z, double t, double a) {
return -4.5 * (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 = (-4.5d0) * (z * (t / a))
end function
public static double code(double x, double y, double z, double t, double a) {
return -4.5 * (z * (t / a));
}
def code(x, y, z, t, a): return -4.5 * (z * (t / a))
function code(x, y, z, t, a) return Float64(-4.5 * Float64(z * Float64(t / a))) end
function tmp = code(x, y, z, t, a) tmp = -4.5 * (z * (t / a)); end
code[x_, y_, z_, t_, a_] := N[(-4.5 * N[(z * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
-4.5 \cdot \left(z \cdot \frac{t}{a}\right)
Initial program 90.8%
Taylor expanded in x around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6449.5%
Applied rewrites49.5%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6450.6%
Applied rewrites50.6%
herbie shell --seed 2025191
(FPCore (x y z t a)
:name "Diagrams.Solve.Polynomial:cubForm from diagrams-solve-0.1, I"
:precision binary64
(/ (- (* x y) (* (* z 9.0) t)) (* a 2.0)))