
(FPCore (x y z t a) :precision binary64 (/ (- x (* y z)) (- t (* a z))))
double code(double x, double y, double z, double t, double a) {
return (x - (y * z)) / (t - (a * z));
}
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)) / (t - (a * z))
end function
public static double code(double x, double y, double z, double t, double a) {
return (x - (y * z)) / (t - (a * z));
}
def code(x, y, z, t, a): return (x - (y * z)) / (t - (a * z))
function code(x, y, z, t, a) return Float64(Float64(x - Float64(y * z)) / Float64(t - Float64(a * z))) end
function tmp = code(x, y, z, t, a) tmp = (x - (y * z)) / (t - (a * z)); end
code[x_, y_, z_, t_, a_] := N[(N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision] / N[(t - N[(a * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\frac{x - y \cdot z}{t - a \cdot z}
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (/ (- x (* y z)) (- t (* a z))))
double code(double x, double y, double z, double t, double a) {
return (x - (y * z)) / (t - (a * z));
}
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)) / (t - (a * z))
end function
public static double code(double x, double y, double z, double t, double a) {
return (x - (y * z)) / (t - (a * z));
}
def code(x, y, z, t, a): return (x - (y * z)) / (t - (a * z))
function code(x, y, z, t, a) return Float64(Float64(x - Float64(y * z)) / Float64(t - Float64(a * z))) end
function tmp = code(x, y, z, t, a) tmp = (x - (y * z)) / (t - (a * z)); end
code[x_, y_, z_, t_, a_] := N[(N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision] / N[(t - N[(a * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\frac{x - y \cdot z}{t - a \cdot z}
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- t (* a z))) (t_2 (/ (- x (* y z)) t_1)))
(if (<= t_2 (- INFINITY))
(fma (/ y (- (* a z) t)) z (/ x t_1))
(if (<= t_2 5e+294) t_2 (* -1.0 (/ (- (/ x z) y) a))))))double code(double x, double y, double z, double t, double a) {
double t_1 = t - (a * z);
double t_2 = (x - (y * z)) / t_1;
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = fma((y / ((a * z) - t)), z, (x / t_1));
} else if (t_2 <= 5e+294) {
tmp = t_2;
} else {
tmp = -1.0 * (((x / z) - y) / a);
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(t - Float64(a * z)) t_2 = Float64(Float64(x - Float64(y * z)) / t_1) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = fma(Float64(y / Float64(Float64(a * z) - t)), z, Float64(x / t_1)); elseif (t_2 <= 5e+294) tmp = t_2; else tmp = Float64(-1.0 * Float64(Float64(Float64(x / z) - y) / a)); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(t - N[(a * z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], N[(N[(y / N[(N[(a * z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision] * z + N[(x / t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 5e+294], t$95$2, N[(-1.0 * N[(N[(N[(x / z), $MachinePrecision] - y), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
t_1 := t - a \cdot z\\
t_2 := \frac{x - y \cdot z}{t\_1}\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{a \cdot z - t}, z, \frac{x}{t\_1}\right)\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+294}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;-1 \cdot \frac{\frac{x}{z} - y}{a}\\
\end{array}
if (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) < -inf.0Initial program 84.8%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
distribute-lft-inN/A
distribute-rgt-neg-outN/A
*-commutativeN/A
mult-flipN/A
distribute-neg-frac2N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
*-commutativeN/A
mult-flipN/A
lower-fma.f64N/A
Applied rewrites85.2%
if -inf.0 < (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) < 4.9999999999999999e294Initial program 84.8%
if 4.9999999999999999e294 < (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) Initial program 84.8%
Taylor expanded in z around 0
Applied rewrites50.5%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
lower--.f64N/A
lower-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6450.4
Applied rewrites50.4%
Taylor expanded in a around -inf
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-/.f6451.9
Applied rewrites51.9%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* -1.0 (/ (- (/ x z) y) a))))
(if (<= z -2.2e+119)
t_1
(if (<= z 2.25e+104) (/ (- x (* y z)) (- t (* a z))) t_1))))double code(double x, double y, double z, double t, double a) {
double t_1 = -1.0 * (((x / z) - y) / a);
double tmp;
if (z <= -2.2e+119) {
tmp = t_1;
} else if (z <= 2.25e+104) {
tmp = (x - (y * z)) / (t - (a * z));
} 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 = (-1.0d0) * (((x / z) - y) / a)
if (z <= (-2.2d+119)) then
tmp = t_1
else if (z <= 2.25d+104) then
tmp = (x - (y * z)) / (t - (a * z))
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 = -1.0 * (((x / z) - y) / a);
double tmp;
if (z <= -2.2e+119) {
tmp = t_1;
} else if (z <= 2.25e+104) {
tmp = (x - (y * z)) / (t - (a * z));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = -1.0 * (((x / z) - y) / a) tmp = 0 if z <= -2.2e+119: tmp = t_1 elif z <= 2.25e+104: tmp = (x - (y * z)) / (t - (a * z)) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(-1.0 * Float64(Float64(Float64(x / z) - y) / a)) tmp = 0.0 if (z <= -2.2e+119) tmp = t_1; elseif (z <= 2.25e+104) tmp = Float64(Float64(x - Float64(y * z)) / Float64(t - Float64(a * z))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = -1.0 * (((x / z) - y) / a); tmp = 0.0; if (z <= -2.2e+119) tmp = t_1; elseif (z <= 2.25e+104) tmp = (x - (y * z)) / (t - (a * z)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(-1.0 * N[(N[(N[(x / z), $MachinePrecision] - y), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -2.2e+119], t$95$1, If[LessEqual[z, 2.25e+104], N[(N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision] / N[(t - N[(a * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := -1 \cdot \frac{\frac{x}{z} - y}{a}\\
\mathbf{if}\;z \leq -2.2 \cdot 10^{+119}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 2.25 \cdot 10^{+104}:\\
\;\;\;\;\frac{x - y \cdot z}{t - a \cdot z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if z < -2.2000000000000001e119 or 2.2499999999999999e104 < z Initial program 84.8%
Taylor expanded in z around 0
Applied rewrites50.5%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
lower--.f64N/A
lower-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6450.4
Applied rewrites50.4%
Taylor expanded in a around -inf
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-/.f6451.9
Applied rewrites51.9%
if -2.2000000000000001e119 < z < 2.2499999999999999e104Initial program 84.8%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- t (* a z))))
(if (<= (/ (- x (* y z)) t_1) INFINITY)
(fma (/ z (- (* a z) t)) y (/ x t_1))
(/ y a))))double code(double x, double y, double z, double t, double a) {
double t_1 = t - (a * z);
double tmp;
if (((x - (y * z)) / t_1) <= ((double) INFINITY)) {
tmp = fma((z / ((a * z) - t)), y, (x / t_1));
} else {
tmp = y / a;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(t - Float64(a * z)) tmp = 0.0 if (Float64(Float64(x - Float64(y * z)) / t_1) <= Inf) tmp = fma(Float64(z / Float64(Float64(a * z) - t)), y, Float64(x / t_1)); else tmp = Float64(y / a); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(t - N[(a * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision], Infinity], N[(N[(z / N[(N[(a * z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision] * y + N[(x / t$95$1), $MachinePrecision]), $MachinePrecision], N[(y / a), $MachinePrecision]]]
\begin{array}{l}
t_1 := t - a \cdot z\\
\mathbf{if}\;\frac{x - y \cdot z}{t\_1} \leq \infty:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{a \cdot z - t}, y, \frac{x}{t\_1}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a}\\
\end{array}
if (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) < +inf.0Initial program 84.8%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
distribute-lft-inN/A
distribute-rgt-neg-outN/A
*-commutativeN/A
mult-flipN/A
distribute-neg-frac2N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
*-commutativeN/A
mult-flipN/A
lower-fma.f64N/A
Applied rewrites88.2%
if +inf.0 < (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) Initial program 84.8%
Taylor expanded in z around inf
lower-/.f6435.7
Applied rewrites35.7%
(FPCore (x y z t a) :precision binary64 (if (<= t -4.8e-117) (- (/ x t) (* (/ y t) z)) (if (<= t 1.7e-18) (* -1.0 (/ (- (/ x z) y) a)) (/ (- x (* y z)) t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -4.8e-117) {
tmp = (x / t) - ((y / t) * z);
} else if (t <= 1.7e-18) {
tmp = -1.0 * (((x / z) - y) / a);
} else {
tmp = (x - (y * z)) / t;
}
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 (t <= (-4.8d-117)) then
tmp = (x / t) - ((y / t) * z)
else if (t <= 1.7d-18) then
tmp = (-1.0d0) * (((x / z) - y) / a)
else
tmp = (x - (y * z)) / t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -4.8e-117) {
tmp = (x / t) - ((y / t) * z);
} else if (t <= 1.7e-18) {
tmp = -1.0 * (((x / z) - y) / a);
} else {
tmp = (x - (y * z)) / t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -4.8e-117: tmp = (x / t) - ((y / t) * z) elif t <= 1.7e-18: tmp = -1.0 * (((x / z) - y) / a) else: tmp = (x - (y * z)) / t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -4.8e-117) tmp = Float64(Float64(x / t) - Float64(Float64(y / t) * z)); elseif (t <= 1.7e-18) tmp = Float64(-1.0 * Float64(Float64(Float64(x / z) - y) / a)); else tmp = Float64(Float64(x - Float64(y * z)) / t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -4.8e-117) tmp = (x / t) - ((y / t) * z); elseif (t <= 1.7e-18) tmp = -1.0 * (((x / z) - y) / a); else tmp = (x - (y * z)) / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -4.8e-117], N[(N[(x / t), $MachinePrecision] - N[(N[(y / t), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.7e-18], N[(-1.0 * N[(N[(N[(x / z), $MachinePrecision] - y), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;t \leq -4.8 \cdot 10^{-117}:\\
\;\;\;\;\frac{x}{t} - \frac{y}{t} \cdot z\\
\mathbf{elif}\;t \leq 1.7 \cdot 10^{-18}:\\
\;\;\;\;-1 \cdot \frac{\frac{x}{z} - y}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x - y \cdot z}{t}\\
\end{array}
if t < -4.80000000000000028e-117Initial program 84.8%
Taylor expanded in z around 0
Applied rewrites50.5%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
lower--.f64N/A
lower-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6450.4
Applied rewrites50.4%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
mult-flipN/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
mult-flipN/A
lower-/.f6450.1
Applied rewrites50.1%
if -4.80000000000000028e-117 < t < 1.70000000000000001e-18Initial program 84.8%
Taylor expanded in z around 0
Applied rewrites50.5%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
lower--.f64N/A
lower-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6450.4
Applied rewrites50.4%
Taylor expanded in a around -inf
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-/.f6451.9
Applied rewrites51.9%
if 1.70000000000000001e-18 < t Initial program 84.8%
Taylor expanded in z around 0
Applied rewrites50.5%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (* -1.0 (/ (- (/ x z) y) a)))) (if (<= z -2.15e+23) t_1 (if (<= z 8.5e+14) (/ (- x (* y z)) t) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = -1.0 * (((x / z) - y) / a);
double tmp;
if (z <= -2.15e+23) {
tmp = t_1;
} else if (z <= 8.5e+14) {
tmp = (x - (y * z)) / t;
} 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 = (-1.0d0) * (((x / z) - y) / a)
if (z <= (-2.15d+23)) then
tmp = t_1
else if (z <= 8.5d+14) then
tmp = (x - (y * z)) / t
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 = -1.0 * (((x / z) - y) / a);
double tmp;
if (z <= -2.15e+23) {
tmp = t_1;
} else if (z <= 8.5e+14) {
tmp = (x - (y * z)) / t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = -1.0 * (((x / z) - y) / a) tmp = 0 if z <= -2.15e+23: tmp = t_1 elif z <= 8.5e+14: tmp = (x - (y * z)) / t else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(-1.0 * Float64(Float64(Float64(x / z) - y) / a)) tmp = 0.0 if (z <= -2.15e+23) tmp = t_1; elseif (z <= 8.5e+14) tmp = Float64(Float64(x - Float64(y * z)) / t); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = -1.0 * (((x / z) - y) / a); tmp = 0.0; if (z <= -2.15e+23) tmp = t_1; elseif (z <= 8.5e+14) tmp = (x - (y * z)) / t; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(-1.0 * N[(N[(N[(x / z), $MachinePrecision] - y), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -2.15e+23], t$95$1, If[LessEqual[z, 8.5e+14], N[(N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := -1 \cdot \frac{\frac{x}{z} - y}{a}\\
\mathbf{if}\;z \leq -2.15 \cdot 10^{+23}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 8.5 \cdot 10^{+14}:\\
\;\;\;\;\frac{x - y \cdot z}{t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if z < -2.1499999999999999e23 or 8.5e14 < z Initial program 84.8%
Taylor expanded in z around 0
Applied rewrites50.5%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
lower--.f64N/A
lower-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6450.4
Applied rewrites50.4%
Taylor expanded in a around -inf
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-/.f6451.9
Applied rewrites51.9%
if -2.1499999999999999e23 < z < 8.5e14Initial program 84.8%
Taylor expanded in z around 0
Applied rewrites50.5%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- x (* y z)) t)))
(if (<= t -4.8e-117)
t_1
(if (<= t 6.6e-23) (/ (- (* y z) x) (* a z)) t_1))))double code(double x, double y, double z, double t, double a) {
double t_1 = (x - (y * z)) / t;
double tmp;
if (t <= -4.8e-117) {
tmp = t_1;
} else if (t <= 6.6e-23) {
tmp = ((y * z) - x) / (a * z);
} 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 = (x - (y * z)) / t
if (t <= (-4.8d-117)) then
tmp = t_1
else if (t <= 6.6d-23) then
tmp = ((y * z) - x) / (a * z)
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 = (x - (y * z)) / t;
double tmp;
if (t <= -4.8e-117) {
tmp = t_1;
} else if (t <= 6.6e-23) {
tmp = ((y * z) - x) / (a * z);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (x - (y * z)) / t tmp = 0 if t <= -4.8e-117: tmp = t_1 elif t <= 6.6e-23: tmp = ((y * z) - x) / (a * z) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(x - Float64(y * z)) / t) tmp = 0.0 if (t <= -4.8e-117) tmp = t_1; elseif (t <= 6.6e-23) tmp = Float64(Float64(Float64(y * z) - x) / Float64(a * z)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (x - (y * z)) / t; tmp = 0.0; if (t <= -4.8e-117) tmp = t_1; elseif (t <= 6.6e-23) tmp = ((y * z) - x) / (a * z); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]}, If[LessEqual[t, -4.8e-117], t$95$1, If[LessEqual[t, 6.6e-23], N[(N[(N[(y * z), $MachinePrecision] - x), $MachinePrecision] / N[(a * z), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := \frac{x - y \cdot z}{t}\\
\mathbf{if}\;t \leq -4.8 \cdot 10^{-117}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 6.6 \cdot 10^{-23}:\\
\;\;\;\;\frac{y \cdot z - x}{a \cdot z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if t < -4.80000000000000028e-117 or 6.60000000000000041e-23 < t Initial program 84.8%
Taylor expanded in z around 0
Applied rewrites50.5%
if -4.80000000000000028e-117 < t < 6.60000000000000041e-23Initial program 84.8%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
distribute-lft-inN/A
distribute-rgt-neg-outN/A
*-commutativeN/A
mult-flipN/A
distribute-neg-frac2N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
*-commutativeN/A
mult-flipN/A
lower-fma.f64N/A
Applied rewrites85.2%
lift-fma.f64N/A
lift-/.f64N/A
mult-flipN/A
lift-/.f64N/A
fp-cancel-sign-sub-invN/A
lift-/.f64N/A
associate-*l/N/A
lift-*.f64N/A
mult-flipN/A
distribute-lft-neg-inN/A
distribute-rgt-neg-inN/A
lift-/.f64N/A
distribute-frac-neg2N/A
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
distribute-rgt-out--N/A
Applied rewrites84.3%
Taylor expanded in t around 0
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-*.f6440.9
Applied rewrites40.9%
(FPCore (x y z t a) :precision binary64 (if (<= z -3.4e+118) (/ y a) (if (<= z 6.2e+73) (/ (- x (* y z)) t) (/ 1.0 (/ a y)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -3.4e+118) {
tmp = y / a;
} else if (z <= 6.2e+73) {
tmp = (x - (y * z)) / t;
} else {
tmp = 1.0 / (a / y);
}
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 (z <= (-3.4d+118)) then
tmp = y / a
else if (z <= 6.2d+73) then
tmp = (x - (y * z)) / t
else
tmp = 1.0d0 / (a / y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -3.4e+118) {
tmp = y / a;
} else if (z <= 6.2e+73) {
tmp = (x - (y * z)) / t;
} else {
tmp = 1.0 / (a / y);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -3.4e+118: tmp = y / a elif z <= 6.2e+73: tmp = (x - (y * z)) / t else: tmp = 1.0 / (a / y) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -3.4e+118) tmp = Float64(y / a); elseif (z <= 6.2e+73) tmp = Float64(Float64(x - Float64(y * z)) / t); else tmp = Float64(1.0 / Float64(a / y)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -3.4e+118) tmp = y / a; elseif (z <= 6.2e+73) tmp = (x - (y * z)) / t; else tmp = 1.0 / (a / y); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -3.4e+118], N[(y / a), $MachinePrecision], If[LessEqual[z, 6.2e+73], N[(N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision], N[(1.0 / N[(a / y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;z \leq -3.4 \cdot 10^{+118}:\\
\;\;\;\;\frac{y}{a}\\
\mathbf{elif}\;z \leq 6.2 \cdot 10^{+73}:\\
\;\;\;\;\frac{x - y \cdot z}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{a}{y}}\\
\end{array}
if z < -3.39999999999999986e118Initial program 84.8%
Taylor expanded in z around inf
lower-/.f6435.7
Applied rewrites35.7%
if -3.39999999999999986e118 < z < 6.1999999999999999e73Initial program 84.8%
Taylor expanded in z around 0
Applied rewrites50.5%
if 6.1999999999999999e73 < z Initial program 84.8%
Taylor expanded in z around inf
lower-/.f6435.7
Applied rewrites35.7%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6435.5
Applied rewrites35.5%
(FPCore (x y z t a) :precision binary64 (if (<= z -4.4e+86) (/ y a) (if (<= z 1.9e+57) (/ x (- t (* a z))) (/ 1.0 (/ a y)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -4.4e+86) {
tmp = y / a;
} else if (z <= 1.9e+57) {
tmp = x / (t - (a * z));
} else {
tmp = 1.0 / (a / y);
}
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 (z <= (-4.4d+86)) then
tmp = y / a
else if (z <= 1.9d+57) then
tmp = x / (t - (a * z))
else
tmp = 1.0d0 / (a / y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -4.4e+86) {
tmp = y / a;
} else if (z <= 1.9e+57) {
tmp = x / (t - (a * z));
} else {
tmp = 1.0 / (a / y);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -4.4e+86: tmp = y / a elif z <= 1.9e+57: tmp = x / (t - (a * z)) else: tmp = 1.0 / (a / y) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -4.4e+86) tmp = Float64(y / a); elseif (z <= 1.9e+57) tmp = Float64(x / Float64(t - Float64(a * z))); else tmp = Float64(1.0 / Float64(a / y)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -4.4e+86) tmp = y / a; elseif (z <= 1.9e+57) tmp = x / (t - (a * z)); else tmp = 1.0 / (a / y); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -4.4e+86], N[(y / a), $MachinePrecision], If[LessEqual[z, 1.9e+57], N[(x / N[(t - N[(a * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(a / y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;z \leq -4.4 \cdot 10^{+86}:\\
\;\;\;\;\frac{y}{a}\\
\mathbf{elif}\;z \leq 1.9 \cdot 10^{+57}:\\
\;\;\;\;\frac{x}{t - a \cdot z}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{a}{y}}\\
\end{array}
if z < -4.40000000000000006e86Initial program 84.8%
Taylor expanded in z around inf
lower-/.f6435.7
Applied rewrites35.7%
if -4.40000000000000006e86 < z < 1.8999999999999999e57Initial program 84.8%
Taylor expanded in x around inf
lower-/.f64N/A
lower--.f64N/A
lower-*.f6452.9
Applied rewrites52.9%
if 1.8999999999999999e57 < z Initial program 84.8%
Taylor expanded in z around inf
lower-/.f6435.7
Applied rewrites35.7%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6435.5
Applied rewrites35.5%
(FPCore (x y z t a) :precision binary64 (if (<= z -2.25e+20) (/ y a) (if (<= z 1.75e+47) (/ x t) (/ 1.0 (/ a y)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2.25e+20) {
tmp = y / a;
} else if (z <= 1.75e+47) {
tmp = x / t;
} else {
tmp = 1.0 / (a / y);
}
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 (z <= (-2.25d+20)) then
tmp = y / a
else if (z <= 1.75d+47) then
tmp = x / t
else
tmp = 1.0d0 / (a / y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2.25e+20) {
tmp = y / a;
} else if (z <= 1.75e+47) {
tmp = x / t;
} else {
tmp = 1.0 / (a / y);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -2.25e+20: tmp = y / a elif z <= 1.75e+47: tmp = x / t else: tmp = 1.0 / (a / y) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -2.25e+20) tmp = Float64(y / a); elseif (z <= 1.75e+47) tmp = Float64(x / t); else tmp = Float64(1.0 / Float64(a / y)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -2.25e+20) tmp = y / a; elseif (z <= 1.75e+47) tmp = x / t; else tmp = 1.0 / (a / y); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -2.25e+20], N[(y / a), $MachinePrecision], If[LessEqual[z, 1.75e+47], N[(x / t), $MachinePrecision], N[(1.0 / N[(a / y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;z \leq -2.25 \cdot 10^{+20}:\\
\;\;\;\;\frac{y}{a}\\
\mathbf{elif}\;z \leq 1.75 \cdot 10^{+47}:\\
\;\;\;\;\frac{x}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{a}{y}}\\
\end{array}
if z < -2.25e20Initial program 84.8%
Taylor expanded in z around inf
lower-/.f6435.7
Applied rewrites35.7%
if -2.25e20 < z < 1.75000000000000008e47Initial program 84.8%
Taylor expanded in z around 0
lower-/.f6435.0
Applied rewrites35.0%
if 1.75000000000000008e47 < z Initial program 84.8%
Taylor expanded in z around inf
lower-/.f6435.7
Applied rewrites35.7%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6435.5
Applied rewrites35.5%
(FPCore (x y z t a) :precision binary64 (if (<= z -2.25e+20) (/ y a) (if (<= z 1.75e+47) (/ x t) (/ y a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2.25e+20) {
tmp = y / a;
} else if (z <= 1.75e+47) {
tmp = x / t;
} else {
tmp = y / 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 (z <= (-2.25d+20)) then
tmp = y / a
else if (z <= 1.75d+47) then
tmp = x / t
else
tmp = y / a
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2.25e+20) {
tmp = y / a;
} else if (z <= 1.75e+47) {
tmp = x / t;
} else {
tmp = y / a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -2.25e+20: tmp = y / a elif z <= 1.75e+47: tmp = x / t else: tmp = y / a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -2.25e+20) tmp = Float64(y / a); elseif (z <= 1.75e+47) tmp = Float64(x / t); else tmp = Float64(y / a); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -2.25e+20) tmp = y / a; elseif (z <= 1.75e+47) tmp = x / t; else tmp = y / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -2.25e+20], N[(y / a), $MachinePrecision], If[LessEqual[z, 1.75e+47], N[(x / t), $MachinePrecision], N[(y / a), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;z \leq -2.25 \cdot 10^{+20}:\\
\;\;\;\;\frac{y}{a}\\
\mathbf{elif}\;z \leq 1.75 \cdot 10^{+47}:\\
\;\;\;\;\frac{x}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a}\\
\end{array}
if z < -2.25e20 or 1.75000000000000008e47 < z Initial program 84.8%
Taylor expanded in z around inf
lower-/.f6435.7
Applied rewrites35.7%
if -2.25e20 < z < 1.75000000000000008e47Initial program 84.8%
Taylor expanded in z around 0
lower-/.f6435.0
Applied rewrites35.0%
(FPCore (x y z t a) :precision binary64 (/ x t))
double code(double x, double y, double z, double t, double a) {
return x / t;
}
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 / t
end function
public static double code(double x, double y, double z, double t, double a) {
return x / t;
}
def code(x, y, z, t, a): return x / t
function code(x, y, z, t, a) return Float64(x / t) end
function tmp = code(x, y, z, t, a) tmp = x / t; end
code[x_, y_, z_, t_, a_] := N[(x / t), $MachinePrecision]
\frac{x}{t}
Initial program 84.8%
Taylor expanded in z around 0
lower-/.f6435.0
Applied rewrites35.0%
herbie shell --seed 2025167
(FPCore (x y z t a)
:name "Diagrams.Solve.Tridiagonal:solveTriDiagonal from diagrams-solve-0.1, A"
:precision binary64
(/ (- x (* y z)) (- t (* a z))))