
(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(x + Float64(Float64(Float64(y - z) * 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[(x + N[(N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
x + \frac{\left(y - z\right) \cdot t}{a - z}
Herbie found 15 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(x + Float64(Float64(Float64(y - z) * 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[(x + N[(N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
x + \frac{\left(y - z\right) \cdot t}{a - z}
(FPCore (x y z t a) :precision binary64 (fma (/ z (- z a)) t (fma (/ y (- a z)) t x)))
double code(double x, double y, double z, double t, double a) {
return fma((z / (z - a)), t, fma((y / (a - z)), t, x));
}
function code(x, y, z, t, a) return fma(Float64(z / Float64(z - a)), t, fma(Float64(y / Float64(a - z)), t, x)) end
code[x_, y_, z_, t_, a_] := N[(N[(z / N[(z - a), $MachinePrecision]), $MachinePrecision] * t + N[(N[(y / N[(a - z), $MachinePrecision]), $MachinePrecision] * t + x), $MachinePrecision]), $MachinePrecision]
\mathsf{fma}\left(\frac{z}{z - a}, t, \mathsf{fma}\left(\frac{y}{a - z}, t, x\right)\right)
Initial program 85.9%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
sub-flipN/A
distribute-lft-inN/A
div-addN/A
*-commutativeN/A
+-commutativeN/A
associate-+l+N/A
*-commutativeN/A
associate-/l*N/A
mult-flipN/A
*-commutativeN/A
associate-*r*N/A
mult-flipN/A
Applied rewrites98.1%
(FPCore (x y z t a) :precision binary64 (fma (/ (- z y) (- z a)) t x))
double code(double x, double y, double z, double t, double a) {
return fma(((z - y) / (z - a)), t, x);
}
function code(x, y, z, t, a) return fma(Float64(Float64(z - y) / Float64(z - a)), t, x) end
code[x_, y_, z_, t_, a_] := N[(N[(N[(z - y), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision] * t + x), $MachinePrecision]
\mathsf{fma}\left(\frac{z - y}{z - a}, t, x\right)
Initial program 85.9%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
sub-flipN/A
lift-/.f64N/A
lift-*.f64N/A
associate-*l/N/A
mult-flip-revN/A
remove-double-negN/A
lower-fma.f64N/A
mult-flip-revN/A
frac-2negN/A
lift--.f64N/A
sub-negate-revN/A
lower-/.f64N/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6498.1%
Applied rewrites98.1%
(FPCore (x y z t a) :precision binary64 (fma (/ t (- z a)) (- z y) x))
double code(double x, double y, double z, double t, double a) {
return fma((t / (z - a)), (z - y), x);
}
function code(x, y, z, t, a) return fma(Float64(t / Float64(z - a)), Float64(z - y), x) end
code[x_, y_, z_, t_, a_] := N[(N[(t / N[(z - a), $MachinePrecision]), $MachinePrecision] * N[(z - y), $MachinePrecision] + x), $MachinePrecision]
\mathsf{fma}\left(\frac{t}{z - a}, z - y, x\right)
Initial program 85.9%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
sub-flipN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lift--.f64N/A
sub-negate-revN/A
distribute-rgt-neg-outN/A
distribute-lft-neg-inN/A
remove-double-negN/A
lower-fma.f64N/A
distribute-neg-frac2N/A
lower-/.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f64N/A
lower--.f6495.7%
Applied rewrites95.7%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (+ x (/ (* t y) (- a z))))) (if (<= y -7e+97) t_1 (if (<= y 1.26e+37) (fma (/ z (- z a)) t x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x + ((t * y) / (a - z));
double tmp;
if (y <= -7e+97) {
tmp = t_1;
} else if (y <= 1.26e+37) {
tmp = fma((z / (z - a)), t, x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(x + Float64(Float64(t * y) / Float64(a - z))) tmp = 0.0 if (y <= -7e+97) tmp = t_1; elseif (y <= 1.26e+37) tmp = fma(Float64(z / Float64(z - a)), t, x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(N[(t * y), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -7e+97], t$95$1, If[LessEqual[y, 1.26e+37], N[(N[(z / N[(z - a), $MachinePrecision]), $MachinePrecision] * t + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := x + \frac{t \cdot y}{a - z}\\
\mathbf{if}\;y \leq -7 \cdot 10^{+97}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 1.26 \cdot 10^{+37}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{z - a}, t, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if y < -7.0000000000000001e97 or 1.26e37 < y Initial program 85.9%
Taylor expanded in y around inf
lower-*.f6473.5%
Applied rewrites73.5%
if -7.0000000000000001e97 < y < 1.26e37Initial program 85.9%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
sub-flipN/A
lift-/.f64N/A
lift-*.f64N/A
associate-*l/N/A
mult-flip-revN/A
remove-double-negN/A
lower-fma.f64N/A
mult-flip-revN/A
frac-2negN/A
lift--.f64N/A
sub-negate-revN/A
lower-/.f64N/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6498.1%
Applied rewrites98.1%
Taylor expanded in y around 0
Applied rewrites71.6%
(FPCore (x y z t a) :precision binary64 (if (<= a -2.1e-127) (fma (/ z (- z a)) t x) (if (<= a 9.4e-91) (fma (/ t z) (- z y) x) (+ x (* (/ t a) y)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -2.1e-127) {
tmp = fma((z / (z - a)), t, x);
} else if (a <= 9.4e-91) {
tmp = fma((t / z), (z - y), x);
} else {
tmp = x + ((t / a) * y);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (a <= -2.1e-127) tmp = fma(Float64(z / Float64(z - a)), t, x); elseif (a <= 9.4e-91) tmp = fma(Float64(t / z), Float64(z - y), x); else tmp = Float64(x + Float64(Float64(t / a) * y)); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -2.1e-127], N[(N[(z / N[(z - a), $MachinePrecision]), $MachinePrecision] * t + x), $MachinePrecision], If[LessEqual[a, 9.4e-91], N[(N[(t / z), $MachinePrecision] * N[(z - y), $MachinePrecision] + x), $MachinePrecision], N[(x + N[(N[(t / a), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;a \leq -2.1 \cdot 10^{-127}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{z - a}, t, x\right)\\
\mathbf{elif}\;a \leq 9.4 \cdot 10^{-91}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t}{z}, z - y, x\right)\\
\mathbf{else}:\\
\;\;\;\;x + \frac{t}{a} \cdot y\\
\end{array}
if a < -2.1000000000000001e-127Initial program 85.9%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
sub-flipN/A
lift-/.f64N/A
lift-*.f64N/A
associate-*l/N/A
mult-flip-revN/A
remove-double-negN/A
lower-fma.f64N/A
mult-flip-revN/A
frac-2negN/A
lift--.f64N/A
sub-negate-revN/A
lower-/.f64N/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6498.1%
Applied rewrites98.1%
Taylor expanded in y around 0
Applied rewrites71.6%
if -2.1000000000000001e-127 < a < 9.40000000000000013e-91Initial program 85.9%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
sub-flipN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lift--.f64N/A
sub-negate-revN/A
distribute-rgt-neg-outN/A
distribute-lft-neg-inN/A
remove-double-negN/A
lower-fma.f64N/A
distribute-neg-frac2N/A
lower-/.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f64N/A
lower--.f6495.7%
Applied rewrites95.7%
Taylor expanded in z around inf
lower-/.f6465.6%
Applied rewrites65.6%
if 9.40000000000000013e-91 < a Initial program 85.9%
Taylor expanded in z around 0
lower-/.f64N/A
lower-*.f6460.7%
Applied rewrites60.7%
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
mult-flip-revN/A
lower-/.f6462.3%
Applied rewrites62.3%
(FPCore (x y z t a) :precision binary64 (if (<= a -2.05e-127) (fma (/ t (- z a)) z x) (if (<= a 9.4e-91) (fma (/ t z) (- z y) x) (+ x (* (/ t a) y)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -2.05e-127) {
tmp = fma((t / (z - a)), z, x);
} else if (a <= 9.4e-91) {
tmp = fma((t / z), (z - y), x);
} else {
tmp = x + ((t / a) * y);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (a <= -2.05e-127) tmp = fma(Float64(t / Float64(z - a)), z, x); elseif (a <= 9.4e-91) tmp = fma(Float64(t / z), Float64(z - y), x); else tmp = Float64(x + Float64(Float64(t / a) * y)); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -2.05e-127], N[(N[(t / N[(z - a), $MachinePrecision]), $MachinePrecision] * z + x), $MachinePrecision], If[LessEqual[a, 9.4e-91], N[(N[(t / z), $MachinePrecision] * N[(z - y), $MachinePrecision] + x), $MachinePrecision], N[(x + N[(N[(t / a), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;a \leq -2.05 \cdot 10^{-127}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t}{z - a}, z, x\right)\\
\mathbf{elif}\;a \leq 9.4 \cdot 10^{-91}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t}{z}, z - y, x\right)\\
\mathbf{else}:\\
\;\;\;\;x + \frac{t}{a} \cdot y\\
\end{array}
if a < -2.05e-127Initial program 85.9%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
sub-flipN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lift--.f64N/A
sub-negate-revN/A
distribute-rgt-neg-outN/A
distribute-lft-neg-inN/A
remove-double-negN/A
lower-fma.f64N/A
distribute-neg-frac2N/A
lower-/.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f64N/A
lower--.f6495.7%
Applied rewrites95.7%
Taylor expanded in y around 0
Applied rewrites70.3%
if -2.05e-127 < a < 9.40000000000000013e-91Initial program 85.9%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
sub-flipN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lift--.f64N/A
sub-negate-revN/A
distribute-rgt-neg-outN/A
distribute-lft-neg-inN/A
remove-double-negN/A
lower-fma.f64N/A
distribute-neg-frac2N/A
lower-/.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f64N/A
lower--.f6495.7%
Applied rewrites95.7%
Taylor expanded in z around inf
lower-/.f6465.6%
Applied rewrites65.6%
if 9.40000000000000013e-91 < a Initial program 85.9%
Taylor expanded in z around 0
lower-/.f64N/A
lower-*.f6460.7%
Applied rewrites60.7%
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
mult-flip-revN/A
lower-/.f6462.3%
Applied rewrites62.3%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (fma (/ t z) (- z y) x))) (if (<= z -3.2e+53) t_1 (if (<= z 2.05e-73) (+ x (* (/ t a) y)) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma((t / z), (z - y), x);
double tmp;
if (z <= -3.2e+53) {
tmp = t_1;
} else if (z <= 2.05e-73) {
tmp = x + ((t / a) * y);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(t / z), Float64(z - y), x) tmp = 0.0 if (z <= -3.2e+53) tmp = t_1; elseif (z <= 2.05e-73) tmp = Float64(x + Float64(Float64(t / a) * y)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(t / z), $MachinePrecision] * N[(z - y), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[z, -3.2e+53], t$95$1, If[LessEqual[z, 2.05e-73], N[(x + N[(N[(t / a), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{t}{z}, z - y, x\right)\\
\mathbf{if}\;z \leq -3.2 \cdot 10^{+53}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 2.05 \cdot 10^{-73}:\\
\;\;\;\;x + \frac{t}{a} \cdot y\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if z < -3.2e53 or 2.05000000000000008e-73 < z Initial program 85.9%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
sub-flipN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lift--.f64N/A
sub-negate-revN/A
distribute-rgt-neg-outN/A
distribute-lft-neg-inN/A
remove-double-negN/A
lower-fma.f64N/A
distribute-neg-frac2N/A
lower-/.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f64N/A
lower--.f6495.7%
Applied rewrites95.7%
Taylor expanded in z around inf
lower-/.f6465.6%
Applied rewrites65.6%
if -3.2e53 < z < 2.05000000000000008e-73Initial program 85.9%
Taylor expanded in z around 0
lower-/.f64N/A
lower-*.f6460.7%
Applied rewrites60.7%
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
mult-flip-revN/A
lower-/.f6462.3%
Applied rewrites62.3%
(FPCore (x y z t a) :precision binary64 (if (<= z -9e+109) (+ x t) (if (<= z 4.5e+56) (+ x (* (/ t a) y)) (+ x t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -9e+109) {
tmp = x + t;
} else if (z <= 4.5e+56) {
tmp = x + ((t / a) * y);
} else {
tmp = x + 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 (z <= (-9d+109)) then
tmp = x + t
else if (z <= 4.5d+56) then
tmp = x + ((t / a) * y)
else
tmp = x + t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -9e+109) {
tmp = x + t;
} else if (z <= 4.5e+56) {
tmp = x + ((t / a) * y);
} else {
tmp = x + t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -9e+109: tmp = x + t elif z <= 4.5e+56: tmp = x + ((t / a) * y) else: tmp = x + t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -9e+109) tmp = Float64(x + t); elseif (z <= 4.5e+56) tmp = Float64(x + Float64(Float64(t / a) * y)); else tmp = Float64(x + t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -9e+109) tmp = x + t; elseif (z <= 4.5e+56) tmp = x + ((t / a) * y); else tmp = x + t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -9e+109], N[(x + t), $MachinePrecision], If[LessEqual[z, 4.5e+56], N[(x + N[(N[(t / a), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision], N[(x + t), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;z \leq -9 \cdot 10^{+109}:\\
\;\;\;\;x + t\\
\mathbf{elif}\;z \leq 4.5 \cdot 10^{+56}:\\
\;\;\;\;x + \frac{t}{a} \cdot y\\
\mathbf{else}:\\
\;\;\;\;x + t\\
\end{array}
if z < -8.9999999999999992e109 or 4.5000000000000003e56 < z Initial program 85.9%
Taylor expanded in z around inf
Applied rewrites61.0%
if -8.9999999999999992e109 < z < 4.5000000000000003e56Initial program 85.9%
Taylor expanded in z around 0
lower-/.f64N/A
lower-*.f6460.7%
Applied rewrites60.7%
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
mult-flip-revN/A
lower-/.f6462.3%
Applied rewrites62.3%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (* (- y z) t) (- a z))))
(if (<= t_1 -5e+153)
(* (/ y (- a z)) t)
(if (<= t_1 1e+90) (+ x t) (* (- z y) (/ t z))))))double code(double x, double y, double z, double t, double a) {
double t_1 = ((y - z) * t) / (a - z);
double tmp;
if (t_1 <= -5e+153) {
tmp = (y / (a - z)) * t;
} else if (t_1 <= 1e+90) {
tmp = x + t;
} else {
tmp = (z - y) * (t / z);
}
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 = ((y - z) * t) / (a - z)
if (t_1 <= (-5d+153)) then
tmp = (y / (a - z)) * t
else if (t_1 <= 1d+90) then
tmp = x + t
else
tmp = (z - y) * (t / z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = ((y - z) * t) / (a - z);
double tmp;
if (t_1 <= -5e+153) {
tmp = (y / (a - z)) * t;
} else if (t_1 <= 1e+90) {
tmp = x + t;
} else {
tmp = (z - y) * (t / z);
}
return tmp;
}
def code(x, y, z, t, a): t_1 = ((y - z) * t) / (a - z) tmp = 0 if t_1 <= -5e+153: tmp = (y / (a - z)) * t elif t_1 <= 1e+90: tmp = x + t else: tmp = (z - y) * (t / z) return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(Float64(y - z) * t) / Float64(a - z)) tmp = 0.0 if (t_1 <= -5e+153) tmp = Float64(Float64(y / Float64(a - z)) * t); elseif (t_1 <= 1e+90) tmp = Float64(x + t); else tmp = Float64(Float64(z - y) * Float64(t / z)); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = ((y - z) * t) / (a - z); tmp = 0.0; if (t_1 <= -5e+153) tmp = (y / (a - z)) * t; elseif (t_1 <= 1e+90) tmp = x + t; else tmp = (z - y) * (t / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -5e+153], N[(N[(y / N[(a - z), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision], If[LessEqual[t$95$1, 1e+90], N[(x + t), $MachinePrecision], N[(N[(z - y), $MachinePrecision] * N[(t / z), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
t_1 := \frac{\left(y - z\right) \cdot t}{a - z}\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+153}:\\
\;\;\;\;\frac{y}{a - z} \cdot t\\
\mathbf{elif}\;t\_1 \leq 10^{+90}:\\
\;\;\;\;x + t\\
\mathbf{else}:\\
\;\;\;\;\left(z - y\right) \cdot \frac{t}{z}\\
\end{array}
if (/.f64 (*.f64 (-.f64 y z) t) (-.f64 a z)) < -5.00000000000000018e153Initial program 85.9%
Taylor expanded in y around inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f6426.4%
Applied rewrites26.4%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6428.7%
Applied rewrites28.7%
if -5.00000000000000018e153 < (/.f64 (*.f64 (-.f64 y z) t) (-.f64 a z)) < 9.99999999999999966e89Initial program 85.9%
Taylor expanded in z around inf
Applied rewrites61.0%
if 9.99999999999999966e89 < (/.f64 (*.f64 (-.f64 y z) t) (-.f64 a z)) Initial program 85.9%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
sub-flipN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lift--.f64N/A
sub-negate-revN/A
distribute-rgt-neg-outN/A
distribute-lft-neg-inN/A
remove-double-negN/A
lower-fma.f64N/A
distribute-neg-frac2N/A
lower-/.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f64N/A
lower--.f6495.7%
Applied rewrites95.7%
Taylor expanded in x around 0
lower-/.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower--.f6439.5%
Applied rewrites39.5%
Taylor expanded in a around 0
lower-/.f64N/A
lower-*.f64N/A
lower--.f6423.8%
Applied rewrites23.8%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lift-/.f64N/A
lower-*.f6429.3%
Applied rewrites29.3%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (* (/ y (- a z)) t)) (t_2 (/ (* (- y z) t) (- a z)))) (if (<= t_2 -5e+153) t_1 (if (<= t_2 5e+188) (+ x t) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (y / (a - z)) * t;
double t_2 = ((y - z) * t) / (a - z);
double tmp;
if (t_2 <= -5e+153) {
tmp = t_1;
} else if (t_2 <= 5e+188) {
tmp = x + 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) :: t_2
real(8) :: tmp
t_1 = (y / (a - z)) * t
t_2 = ((y - z) * t) / (a - z)
if (t_2 <= (-5d+153)) then
tmp = t_1
else if (t_2 <= 5d+188) then
tmp = x + 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 = (y / (a - z)) * t;
double t_2 = ((y - z) * t) / (a - z);
double tmp;
if (t_2 <= -5e+153) {
tmp = t_1;
} else if (t_2 <= 5e+188) {
tmp = x + t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (y / (a - z)) * t t_2 = ((y - z) * t) / (a - z) tmp = 0 if t_2 <= -5e+153: tmp = t_1 elif t_2 <= 5e+188: tmp = x + t else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(y / Float64(a - z)) * t) t_2 = Float64(Float64(Float64(y - z) * t) / Float64(a - z)) tmp = 0.0 if (t_2 <= -5e+153) tmp = t_1; elseif (t_2 <= 5e+188) tmp = Float64(x + t); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (y / (a - z)) * t; t_2 = ((y - z) * t) / (a - z); tmp = 0.0; if (t_2 <= -5e+153) tmp = t_1; elseif (t_2 <= 5e+188) tmp = x + t; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y / N[(a - z), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -5e+153], t$95$1, If[LessEqual[t$95$2, 5e+188], N[(x + t), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
t_1 := \frac{y}{a - z} \cdot t\\
t_2 := \frac{\left(y - z\right) \cdot t}{a - z}\\
\mathbf{if}\;t\_2 \leq -5 \cdot 10^{+153}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+188}:\\
\;\;\;\;x + t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if (/.f64 (*.f64 (-.f64 y z) t) (-.f64 a z)) < -5.00000000000000018e153 or 5.0000000000000001e188 < (/.f64 (*.f64 (-.f64 y z) t) (-.f64 a z)) Initial program 85.9%
Taylor expanded in y around inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f6426.4%
Applied rewrites26.4%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6428.7%
Applied rewrites28.7%
if -5.00000000000000018e153 < (/.f64 (*.f64 (-.f64 y z) t) (-.f64 a z)) < 5.0000000000000001e188Initial program 85.9%
Taylor expanded in z around inf
Applied rewrites61.0%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (* (/ t (- a z)) y)) (t_2 (/ (* (- y z) t) (- a z)))) (if (<= t_2 -5e+153) t_1 (if (<= t_2 5e+188) (+ x t) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (t / (a - z)) * y;
double t_2 = ((y - z) * t) / (a - z);
double tmp;
if (t_2 <= -5e+153) {
tmp = t_1;
} else if (t_2 <= 5e+188) {
tmp = x + 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) :: t_2
real(8) :: tmp
t_1 = (t / (a - z)) * y
t_2 = ((y - z) * t) / (a - z)
if (t_2 <= (-5d+153)) then
tmp = t_1
else if (t_2 <= 5d+188) then
tmp = x + 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 = (t / (a - z)) * y;
double t_2 = ((y - z) * t) / (a - z);
double tmp;
if (t_2 <= -5e+153) {
tmp = t_1;
} else if (t_2 <= 5e+188) {
tmp = x + t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (t / (a - z)) * y t_2 = ((y - z) * t) / (a - z) tmp = 0 if t_2 <= -5e+153: tmp = t_1 elif t_2 <= 5e+188: tmp = x + t else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(t / Float64(a - z)) * y) t_2 = Float64(Float64(Float64(y - z) * t) / Float64(a - z)) tmp = 0.0 if (t_2 <= -5e+153) tmp = t_1; elseif (t_2 <= 5e+188) tmp = Float64(x + t); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (t / (a - z)) * y; t_2 = ((y - z) * t) / (a - z); tmp = 0.0; if (t_2 <= -5e+153) tmp = t_1; elseif (t_2 <= 5e+188) tmp = x + t; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(t / N[(a - z), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -5e+153], t$95$1, If[LessEqual[t$95$2, 5e+188], N[(x + t), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
t_1 := \frac{t}{a - z} \cdot y\\
t_2 := \frac{\left(y - z\right) \cdot t}{a - z}\\
\mathbf{if}\;t\_2 \leq -5 \cdot 10^{+153}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+188}:\\
\;\;\;\;x + t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if (/.f64 (*.f64 (-.f64 y z) t) (-.f64 a z)) < -5.00000000000000018e153 or 5.0000000000000001e188 < (/.f64 (*.f64 (-.f64 y z) t) (-.f64 a z)) Initial program 85.9%
Taylor expanded in y around inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f6426.4%
Applied rewrites26.4%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6428.6%
Applied rewrites28.6%
if -5.00000000000000018e153 < (/.f64 (*.f64 (-.f64 y z) t) (-.f64 a z)) < 5.0000000000000001e188Initial program 85.9%
Taylor expanded in z around inf
Applied rewrites61.0%
(FPCore (x y z t a) :precision binary64 (if (<= (/ (* (- y z) t) (- a z)) -5e+153) (* (/ y a) t) (+ x t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((((y - z) * t) / (a - z)) <= -5e+153) {
tmp = (y / a) * t;
} else {
tmp = x + 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 ((((y - z) * t) / (a - z)) <= (-5d+153)) then
tmp = (y / a) * t
else
tmp = x + t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((((y - z) * t) / (a - z)) <= -5e+153) {
tmp = (y / a) * t;
} else {
tmp = x + t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (((y - z) * t) / (a - z)) <= -5e+153: tmp = (y / a) * t else: tmp = x + t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (Float64(Float64(Float64(y - z) * t) / Float64(a - z)) <= -5e+153) tmp = Float64(Float64(y / a) * t); else tmp = Float64(x + t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((((y - z) * t) / (a - z)) <= -5e+153) tmp = (y / a) * t; else tmp = x + t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[N[(N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision], -5e+153], N[(N[(y / a), $MachinePrecision] * t), $MachinePrecision], N[(x + t), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;\frac{\left(y - z\right) \cdot t}{a - z} \leq -5 \cdot 10^{+153}:\\
\;\;\;\;\frac{y}{a} \cdot t\\
\mathbf{else}:\\
\;\;\;\;x + t\\
\end{array}
if (/.f64 (*.f64 (-.f64 y z) t) (-.f64 a z)) < -5.00000000000000018e153Initial program 85.9%
Taylor expanded in y around inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f6426.4%
Applied rewrites26.4%
Taylor expanded in z around 0
Applied rewrites19.0%
+-commutative19.0%
lift--.f64N/A
*-commutativeN/A
associate-/l*N/A
frac-2neg-revN/A
lift--.f6419.0%
sub-negate-rev19.0%
lift--.f64N/A
sub-negate-revN/A
associate-/l*N/A
associate-*l/N/A
lift--.f6419.0%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6420.8%
Applied rewrites20.8%
if -5.00000000000000018e153 < (/.f64 (*.f64 (-.f64 y z) t) (-.f64 a z)) Initial program 85.9%
Taylor expanded in z around inf
Applied rewrites61.0%
(FPCore (x y z t a) :precision binary64 (if (<= (/ (* (- y z) t) (- a z)) -5e+153) (* y (/ t a)) (+ x t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((((y - z) * t) / (a - z)) <= -5e+153) {
tmp = y * (t / a);
} else {
tmp = x + 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 ((((y - z) * t) / (a - z)) <= (-5d+153)) then
tmp = y * (t / a)
else
tmp = x + t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((((y - z) * t) / (a - z)) <= -5e+153) {
tmp = y * (t / a);
} else {
tmp = x + t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (((y - z) * t) / (a - z)) <= -5e+153: tmp = y * (t / a) else: tmp = x + t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (Float64(Float64(Float64(y - z) * t) / Float64(a - z)) <= -5e+153) tmp = Float64(y * Float64(t / a)); else tmp = Float64(x + t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((((y - z) * t) / (a - z)) <= -5e+153) tmp = y * (t / a); else tmp = x + t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[N[(N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision], -5e+153], N[(y * N[(t / a), $MachinePrecision]), $MachinePrecision], N[(x + t), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;\frac{\left(y - z\right) \cdot t}{a - z} \leq -5 \cdot 10^{+153}:\\
\;\;\;\;y \cdot \frac{t}{a}\\
\mathbf{else}:\\
\;\;\;\;x + t\\
\end{array}
if (/.f64 (*.f64 (-.f64 y z) t) (-.f64 a z)) < -5.00000000000000018e153Initial program 85.9%
Taylor expanded in y around inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f6426.4%
Applied rewrites26.4%
Taylor expanded in z around 0
Applied rewrites19.0%
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
mult-flip-revN/A
lower-/.f6420.7%
Applied rewrites20.7%
if -5.00000000000000018e153 < (/.f64 (*.f64 (-.f64 y z) t) (-.f64 a z)) Initial program 85.9%
Taylor expanded in z around inf
Applied rewrites61.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]
x + t
Initial program 85.9%
Taylor expanded in z around inf
Applied rewrites61.0%
(FPCore (x y z t a) :precision binary64 t)
double code(double x, double y, double z, double t, double a) {
return 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 = t
end function
public static double code(double x, double y, double z, double t, double a) {
return t;
}
def code(x, y, z, t, a): return t
function code(x, y, z, t, a) return t end
function tmp = code(x, y, z, t, a) tmp = t; end
code[x_, y_, z_, t_, a_] := t
t
Initial program 85.9%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
sub-flipN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lift--.f64N/A
sub-negate-revN/A
distribute-rgt-neg-outN/A
distribute-lft-neg-inN/A
remove-double-negN/A
lower-fma.f64N/A
distribute-neg-frac2N/A
lower-/.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f64N/A
lower--.f6495.7%
Applied rewrites95.7%
Taylor expanded in x around 0
lower-/.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower--.f6439.5%
Applied rewrites39.5%
Taylor expanded in a around 0
lower-/.f64N/A
lower-*.f64N/A
lower--.f6423.8%
Applied rewrites23.8%
Taylor expanded in y around 0
Applied rewrites18.9%
herbie shell --seed 2025188
(FPCore (x y z t a)
:name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisTick from plot-0.2.3.4, A"
:precision binary64
(+ x (/ (* (- y z) t) (- a z))))