
(FPCore (x y z t a) :precision binary64 (+ x (* y (/ (- z t) (- z a)))))
double code(double x, double y, double z, double t, double a) {
return x + (y * ((z - t) / (z - a)));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x + (y * ((z - t) / (z - a)))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (y * ((z - t) / (z - a)));
}
def code(x, y, z, t, a): return x + (y * ((z - t) / (z - a)))
function code(x, y, z, t, a) return Float64(x + Float64(y * Float64(Float64(z - t) / Float64(z - a)))) end
function tmp = code(x, y, z, t, a) tmp = x + (y * ((z - t) / (z - a))); end
code[x_, y_, z_, t_, a_] := N[(x + N[(y * N[(N[(z - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
x + y \cdot \frac{z - t}{z - a}
Herbie found 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (+ x (* y (/ (- z t) (- z a)))))
double code(double x, double y, double z, double t, double a) {
return x + (y * ((z - t) / (z - a)));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x + (y * ((z - t) / (z - a)))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (y * ((z - t) / (z - a)));
}
def code(x, y, z, t, a): return x + (y * ((z - t) / (z - a)))
function code(x, y, z, t, a) return Float64(x + Float64(y * Float64(Float64(z - t) / Float64(z - a)))) end
function tmp = code(x, y, z, t, a) tmp = x + (y * ((z - t) / (z - a))); end
code[x_, y_, z_, t_, a_] := N[(x + N[(y * N[(N[(z - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
x + y \cdot \frac{z - t}{z - a}
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- z t) (- z a))))
(if (<= t_1 -1e+75)
(* (/ y (- a z)) t)
(if (<= t_1 2e-5)
(- x (* (/ (- z t) a) y))
(if (<= t_1 1e+201)
(+ x (* y (/ (- z t) z)))
(+ x (/ (* t y) a)))))))double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) / (z - a);
double tmp;
if (t_1 <= -1e+75) {
tmp = (y / (a - z)) * t;
} else if (t_1 <= 2e-5) {
tmp = x - (((z - t) / a) * y);
} else if (t_1 <= 1e+201) {
tmp = x + (y * ((z - t) / z));
} else {
tmp = x + ((t * 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) :: t_1
real(8) :: tmp
t_1 = (z - t) / (z - a)
if (t_1 <= (-1d+75)) then
tmp = (y / (a - z)) * t
else if (t_1 <= 2d-5) then
tmp = x - (((z - t) / a) * y)
else if (t_1 <= 1d+201) then
tmp = x + (y * ((z - t) / z))
else
tmp = x + ((t * y) / a)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) / (z - a);
double tmp;
if (t_1 <= -1e+75) {
tmp = (y / (a - z)) * t;
} else if (t_1 <= 2e-5) {
tmp = x - (((z - t) / a) * y);
} else if (t_1 <= 1e+201) {
tmp = x + (y * ((z - t) / z));
} else {
tmp = x + ((t * y) / a);
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (z - t) / (z - a) tmp = 0 if t_1 <= -1e+75: tmp = (y / (a - z)) * t elif t_1 <= 2e-5: tmp = x - (((z - t) / a) * y) elif t_1 <= 1e+201: tmp = x + (y * ((z - t) / z)) else: tmp = x + ((t * y) / a) return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(z - t) / Float64(z - a)) tmp = 0.0 if (t_1 <= -1e+75) tmp = Float64(Float64(y / Float64(a - z)) * t); elseif (t_1 <= 2e-5) tmp = Float64(x - Float64(Float64(Float64(z - t) / a) * y)); elseif (t_1 <= 1e+201) tmp = Float64(x + Float64(y * Float64(Float64(z - t) / z))); else tmp = Float64(x + Float64(Float64(t * y) / a)); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (z - t) / (z - a); tmp = 0.0; if (t_1 <= -1e+75) tmp = (y / (a - z)) * t; elseif (t_1 <= 2e-5) tmp = x - (((z - t) / a) * y); elseif (t_1 <= 1e+201) tmp = x + (y * ((z - t) / z)); else tmp = x + ((t * y) / a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -1e+75], N[(N[(y / N[(a - z), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision], If[LessEqual[t$95$1, 2e-5], N[(x - N[(N[(N[(z - t), $MachinePrecision] / a), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e+201], N[(x + N[(y * N[(N[(z - t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(t * y), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
t_1 := \frac{z - t}{z - a}\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{+75}:\\
\;\;\;\;\frac{y}{a - z} \cdot t\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-5}:\\
\;\;\;\;x - \frac{z - t}{a} \cdot y\\
\mathbf{elif}\;t\_1 \leq 10^{+201}:\\
\;\;\;\;x + y \cdot \frac{z - t}{z}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{t \cdot y}{a}\\
\end{array}
if (/.f64 (-.f64 z t) (-.f64 z a)) < -9.9999999999999993e74Initial program 98.0%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6497.9%
Applied rewrites97.9%
lift-+.f64N/A
add-flipN/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
div-flip-revN/A
lift--.f64N/A
lift--.f64N/A
lower--.f64N/A
lift--.f64N/A
lift--.f64N/A
associate-*r/N/A
*-commutativeN/A
associate-/l*N/A
distribute-rgt-neg-inN/A
distribute-frac-neg2N/A
*-commutativeN/A
Applied rewrites96.0%
Taylor expanded in t around inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f6425.9%
Applied rewrites25.9%
lift--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift--.f6428.3%
Applied rewrites28.3%
if -9.9999999999999993e74 < (/.f64 (-.f64 z t) (-.f64 z a)) < 2.0000000000000002e-5Initial program 98.0%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6497.9%
Applied rewrites97.9%
lift-+.f64N/A
add-flipN/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
div-flip-revN/A
lift--.f64N/A
lift--.f64N/A
lower--.f64N/A
lift--.f64N/A
lift--.f64N/A
associate-*r/N/A
*-commutativeN/A
associate-/l*N/A
distribute-rgt-neg-inN/A
distribute-frac-neg2N/A
*-commutativeN/A
Applied rewrites96.0%
Taylor expanded in z around 0
Applied rewrites60.2%
lift-*.f64N/A
lift-/.f64N/A
mult-flipN/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
associate-*l/N/A
*-lft-identityN/A
lower-/.f6459.5%
Applied rewrites59.5%
if 2.0000000000000002e-5 < (/.f64 (-.f64 z t) (-.f64 z a)) < 1e201Initial program 98.0%
Taylor expanded in a around 0
lower-/.f64N/A
lower--.f6467.8%
Applied rewrites67.8%
if 1e201 < (/.f64 (-.f64 z t) (-.f64 z a)) Initial program 98.0%
Taylor expanded in z around 0
lower-/.f64N/A
lower-*.f6459.6%
Applied rewrites59.6%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- z t) (- z a))))
(if (<= t_1 -1e+75)
(* (/ y (- a z)) t)
(if (<= t_1 2e-5)
(- x (* (/ y a) (- z t)))
(if (<= t_1 1e+201)
(+ x (* y (/ (- z t) z)))
(+ x (/ (* t y) a)))))))double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) / (z - a);
double tmp;
if (t_1 <= -1e+75) {
tmp = (y / (a - z)) * t;
} else if (t_1 <= 2e-5) {
tmp = x - ((y / a) * (z - t));
} else if (t_1 <= 1e+201) {
tmp = x + (y * ((z - t) / z));
} else {
tmp = x + ((t * 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) :: t_1
real(8) :: tmp
t_1 = (z - t) / (z - a)
if (t_1 <= (-1d+75)) then
tmp = (y / (a - z)) * t
else if (t_1 <= 2d-5) then
tmp = x - ((y / a) * (z - t))
else if (t_1 <= 1d+201) then
tmp = x + (y * ((z - t) / z))
else
tmp = x + ((t * y) / a)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) / (z - a);
double tmp;
if (t_1 <= -1e+75) {
tmp = (y / (a - z)) * t;
} else if (t_1 <= 2e-5) {
tmp = x - ((y / a) * (z - t));
} else if (t_1 <= 1e+201) {
tmp = x + (y * ((z - t) / z));
} else {
tmp = x + ((t * y) / a);
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (z - t) / (z - a) tmp = 0 if t_1 <= -1e+75: tmp = (y / (a - z)) * t elif t_1 <= 2e-5: tmp = x - ((y / a) * (z - t)) elif t_1 <= 1e+201: tmp = x + (y * ((z - t) / z)) else: tmp = x + ((t * y) / a) return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(z - t) / Float64(z - a)) tmp = 0.0 if (t_1 <= -1e+75) tmp = Float64(Float64(y / Float64(a - z)) * t); elseif (t_1 <= 2e-5) tmp = Float64(x - Float64(Float64(y / a) * Float64(z - t))); elseif (t_1 <= 1e+201) tmp = Float64(x + Float64(y * Float64(Float64(z - t) / z))); else tmp = Float64(x + Float64(Float64(t * y) / a)); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (z - t) / (z - a); tmp = 0.0; if (t_1 <= -1e+75) tmp = (y / (a - z)) * t; elseif (t_1 <= 2e-5) tmp = x - ((y / a) * (z - t)); elseif (t_1 <= 1e+201) tmp = x + (y * ((z - t) / z)); else tmp = x + ((t * y) / a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -1e+75], N[(N[(y / N[(a - z), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision], If[LessEqual[t$95$1, 2e-5], N[(x - N[(N[(y / a), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e+201], N[(x + N[(y * N[(N[(z - t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(t * y), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
t_1 := \frac{z - t}{z - a}\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{+75}:\\
\;\;\;\;\frac{y}{a - z} \cdot t\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-5}:\\
\;\;\;\;x - \frac{y}{a} \cdot \left(z - t\right)\\
\mathbf{elif}\;t\_1 \leq 10^{+201}:\\
\;\;\;\;x + y \cdot \frac{z - t}{z}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{t \cdot y}{a}\\
\end{array}
if (/.f64 (-.f64 z t) (-.f64 z a)) < -9.9999999999999993e74Initial program 98.0%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6497.9%
Applied rewrites97.9%
lift-+.f64N/A
add-flipN/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
div-flip-revN/A
lift--.f64N/A
lift--.f64N/A
lower--.f64N/A
lift--.f64N/A
lift--.f64N/A
associate-*r/N/A
*-commutativeN/A
associate-/l*N/A
distribute-rgt-neg-inN/A
distribute-frac-neg2N/A
*-commutativeN/A
Applied rewrites96.0%
Taylor expanded in t around inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f6425.9%
Applied rewrites25.9%
lift--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift--.f6428.3%
Applied rewrites28.3%
if -9.9999999999999993e74 < (/.f64 (-.f64 z t) (-.f64 z a)) < 2.0000000000000002e-5Initial program 98.0%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6497.9%
Applied rewrites97.9%
lift-+.f64N/A
add-flipN/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
div-flip-revN/A
lift--.f64N/A
lift--.f64N/A
lower--.f64N/A
lift--.f64N/A
lift--.f64N/A
associate-*r/N/A
*-commutativeN/A
associate-/l*N/A
distribute-rgt-neg-inN/A
distribute-frac-neg2N/A
*-commutativeN/A
Applied rewrites96.0%
Taylor expanded in z around 0
Applied rewrites60.2%
if 2.0000000000000002e-5 < (/.f64 (-.f64 z t) (-.f64 z a)) < 1e201Initial program 98.0%
Taylor expanded in a around 0
lower-/.f64N/A
lower--.f6467.8%
Applied rewrites67.8%
if 1e201 < (/.f64 (-.f64 z t) (-.f64 z a)) Initial program 98.0%
Taylor expanded in z around 0
lower-/.f64N/A
lower-*.f6459.6%
Applied rewrites59.6%
(FPCore (x y z t a)
:precision binary64
(if (<= a -2.4e-69)
(+ x (* y (/ z (- z a))))
(if (<= a -4.2e-108)
(* (/ (- t z) (- a z)) y)
(if (<= a 17500000000.0)
(+ x (* (/ y z) (- z t)))
(+ x (* y (/ t a)))))))double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -2.4e-69) {
tmp = x + (y * (z / (z - a)));
} else if (a <= -4.2e-108) {
tmp = ((t - z) / (a - z)) * y;
} else if (a <= 17500000000.0) {
tmp = x + ((y / z) * (z - t));
} else {
tmp = x + (y * (t / a));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (a <= (-2.4d-69)) then
tmp = x + (y * (z / (z - a)))
else if (a <= (-4.2d-108)) then
tmp = ((t - z) / (a - z)) * y
else if (a <= 17500000000.0d0) then
tmp = x + ((y / z) * (z - t))
else
tmp = x + (y * (t / a))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -2.4e-69) {
tmp = x + (y * (z / (z - a)));
} else if (a <= -4.2e-108) {
tmp = ((t - z) / (a - z)) * y;
} else if (a <= 17500000000.0) {
tmp = x + ((y / z) * (z - t));
} else {
tmp = x + (y * (t / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -2.4e-69: tmp = x + (y * (z / (z - a))) elif a <= -4.2e-108: tmp = ((t - z) / (a - z)) * y elif a <= 17500000000.0: tmp = x + ((y / z) * (z - t)) else: tmp = x + (y * (t / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -2.4e-69) tmp = Float64(x + Float64(y * Float64(z / Float64(z - a)))); elseif (a <= -4.2e-108) tmp = Float64(Float64(Float64(t - z) / Float64(a - z)) * y); elseif (a <= 17500000000.0) tmp = Float64(x + Float64(Float64(y / z) * Float64(z - t))); else tmp = Float64(x + Float64(y * Float64(t / a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (a <= -2.4e-69) tmp = x + (y * (z / (z - a))); elseif (a <= -4.2e-108) tmp = ((t - z) / (a - z)) * y; elseif (a <= 17500000000.0) tmp = x + ((y / z) * (z - t)); else tmp = x + (y * (t / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -2.4e-69], N[(x + N[(y * N[(z / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, -4.2e-108], N[(N[(N[(t - z), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[a, 17500000000.0], N[(x + N[(N[(y / z), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\mathbf{if}\;a \leq -2.4 \cdot 10^{-69}:\\
\;\;\;\;x + y \cdot \frac{z}{z - a}\\
\mathbf{elif}\;a \leq -4.2 \cdot 10^{-108}:\\
\;\;\;\;\frac{t - z}{a - z} \cdot y\\
\mathbf{elif}\;a \leq 17500000000:\\
\;\;\;\;x + \frac{y}{z} \cdot \left(z - t\right)\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{t}{a}\\
\end{array}
if a < -2.4000000000000001e-69Initial program 98.0%
Taylor expanded in t around 0
lower-/.f64N/A
lower--.f6472.1%
Applied rewrites72.1%
if -2.4000000000000001e-69 < a < -4.1999999999999998e-108Initial program 98.0%
Taylor expanded in x around 0
lower-/.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower--.f6438.9%
Applied rewrites38.9%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift--.f64N/A
lift--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
distribute-frac-neg2N/A
distribute-frac-negN/A
lower-/.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6449.1%
Applied rewrites49.1%
if -4.1999999999999998e-108 < a < 1.75e10Initial program 98.0%
Taylor expanded in a around 0
lower-/.f64N/A
lower-*.f64N/A
lower--.f6459.0%
Applied rewrites59.0%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
mult-flipN/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
mult-flip-revN/A
lower-/.f6466.7%
Applied rewrites66.7%
if 1.75e10 < a Initial program 98.0%
Taylor expanded in z around 0
lower-/.f6461.4%
Applied rewrites61.4%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (* y (/ t a)))))
(if (<= a -3.6e-81)
t_1
(if (<= a 17500000000.0) (+ x (* (/ y z) (- z t))) t_1))))double code(double x, double y, double z, double t, double a) {
double t_1 = x + (y * (t / a));
double tmp;
if (a <= -3.6e-81) {
tmp = t_1;
} else if (a <= 17500000000.0) {
tmp = x + ((y / z) * (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 = x + (y * (t / a))
if (a <= (-3.6d-81)) then
tmp = t_1
else if (a <= 17500000000.0d0) then
tmp = x + ((y / z) * (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 = x + (y * (t / a));
double tmp;
if (a <= -3.6e-81) {
tmp = t_1;
} else if (a <= 17500000000.0) {
tmp = x + ((y / z) * (z - t));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x + (y * (t / a)) tmp = 0 if a <= -3.6e-81: tmp = t_1 elif a <= 17500000000.0: tmp = x + ((y / z) * (z - t)) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(x + Float64(y * Float64(t / a))) tmp = 0.0 if (a <= -3.6e-81) tmp = t_1; elseif (a <= 17500000000.0) tmp = Float64(x + Float64(Float64(y / z) * Float64(z - t))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x + (y * (t / a)); tmp = 0.0; if (a <= -3.6e-81) tmp = t_1; elseif (a <= 17500000000.0) tmp = x + ((y / z) * (z - t)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(y * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -3.6e-81], t$95$1, If[LessEqual[a, 17500000000.0], N[(x + N[(N[(y / z), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := x + y \cdot \frac{t}{a}\\
\mathbf{if}\;a \leq -3.6 \cdot 10^{-81}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 17500000000:\\
\;\;\;\;x + \frac{y}{z} \cdot \left(z - t\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if a < -3.5999999999999999e-81 or 1.75e10 < a Initial program 98.0%
Taylor expanded in z around 0
lower-/.f6461.4%
Applied rewrites61.4%
if -3.5999999999999999e-81 < a < 1.75e10Initial program 98.0%
Taylor expanded in a around 0
lower-/.f64N/A
lower-*.f64N/A
lower--.f6459.0%
Applied rewrites59.0%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
mult-flipN/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
mult-flip-revN/A
lower-/.f6466.7%
Applied rewrites66.7%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- z t) (- z a))))
(if (<= t_1 -1e+75)
(* (/ y (- a z)) t)
(if (<= t_1 5e-35)
(+ x (* y (/ t a)))
(if (<= t_1 1.0) (+ x y) (* (/ y (- z a)) (- z t)))))))double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) / (z - a);
double tmp;
if (t_1 <= -1e+75) {
tmp = (y / (a - z)) * t;
} else if (t_1 <= 5e-35) {
tmp = x + (y * (t / a));
} else if (t_1 <= 1.0) {
tmp = x + y;
} else {
tmp = (y / (z - a)) * (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) :: t_1
real(8) :: tmp
t_1 = (z - t) / (z - a)
if (t_1 <= (-1d+75)) then
tmp = (y / (a - z)) * t
else if (t_1 <= 5d-35) then
tmp = x + (y * (t / a))
else if (t_1 <= 1.0d0) then
tmp = x + y
else
tmp = (y / (z - a)) * (z - t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) / (z - a);
double tmp;
if (t_1 <= -1e+75) {
tmp = (y / (a - z)) * t;
} else if (t_1 <= 5e-35) {
tmp = x + (y * (t / a));
} else if (t_1 <= 1.0) {
tmp = x + y;
} else {
tmp = (y / (z - a)) * (z - t);
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (z - t) / (z - a) tmp = 0 if t_1 <= -1e+75: tmp = (y / (a - z)) * t elif t_1 <= 5e-35: tmp = x + (y * (t / a)) elif t_1 <= 1.0: tmp = x + y else: tmp = (y / (z - a)) * (z - t) return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(z - t) / Float64(z - a)) tmp = 0.0 if (t_1 <= -1e+75) tmp = Float64(Float64(y / Float64(a - z)) * t); elseif (t_1 <= 5e-35) tmp = Float64(x + Float64(y * Float64(t / a))); elseif (t_1 <= 1.0) tmp = Float64(x + y); else tmp = Float64(Float64(y / Float64(z - a)) * Float64(z - t)); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (z - t) / (z - a); tmp = 0.0; if (t_1 <= -1e+75) tmp = (y / (a - z)) * t; elseif (t_1 <= 5e-35) tmp = x + (y * (t / a)); elseif (t_1 <= 1.0) tmp = x + y; else tmp = (y / (z - a)) * (z - t); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -1e+75], N[(N[(y / N[(a - z), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision], If[LessEqual[t$95$1, 5e-35], N[(x + N[(y * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1.0], N[(x + y), $MachinePrecision], N[(N[(y / N[(z - a), $MachinePrecision]), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
t_1 := \frac{z - t}{z - a}\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{+75}:\\
\;\;\;\;\frac{y}{a - z} \cdot t\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{-35}:\\
\;\;\;\;x + y \cdot \frac{t}{a}\\
\mathbf{elif}\;t\_1 \leq 1:\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{z - a} \cdot \left(z - t\right)\\
\end{array}
if (/.f64 (-.f64 z t) (-.f64 z a)) < -9.9999999999999993e74Initial program 98.0%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6497.9%
Applied rewrites97.9%
lift-+.f64N/A
add-flipN/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
div-flip-revN/A
lift--.f64N/A
lift--.f64N/A
lower--.f64N/A
lift--.f64N/A
lift--.f64N/A
associate-*r/N/A
*-commutativeN/A
associate-/l*N/A
distribute-rgt-neg-inN/A
distribute-frac-neg2N/A
*-commutativeN/A
Applied rewrites96.0%
Taylor expanded in t around inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f6425.9%
Applied rewrites25.9%
lift--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift--.f6428.3%
Applied rewrites28.3%
if -9.9999999999999993e74 < (/.f64 (-.f64 z t) (-.f64 z a)) < 4.9999999999999996e-35Initial program 98.0%
Taylor expanded in z around 0
lower-/.f6461.4%
Applied rewrites61.4%
if 4.9999999999999996e-35 < (/.f64 (-.f64 z t) (-.f64 z a)) < 1Initial program 98.0%
Taylor expanded in z around inf
lower-+.f6461.2%
Applied rewrites61.2%
if 1 < (/.f64 (-.f64 z t) (-.f64 z a)) Initial program 98.0%
Taylor expanded in x around 0
lower-/.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower--.f6438.9%
Applied rewrites38.9%
lift-/.f64N/A
lift-*.f64N/A
associate-*l/N/A
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
distribute-neg-frac2N/A
lift-/.f64N/A
lower-*.f64N/A
lift-/.f64N/A
distribute-neg-frac2N/A
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
lower-/.f6447.3%
Applied rewrites47.3%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- z t) (- z a))) (t_2 (* (/ y (- a z)) t)))
(if (<= t_1 -1e+75)
t_2
(if (<= t_1 5e-35)
(+ x (* y (/ t a)))
(if (<= t_1 2e+21) (+ x y) t_2)))))double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) / (z - a);
double t_2 = (y / (a - z)) * t;
double tmp;
if (t_1 <= -1e+75) {
tmp = t_2;
} else if (t_1 <= 5e-35) {
tmp = x + (y * (t / a));
} else if (t_1 <= 2e+21) {
tmp = x + y;
} else {
tmp = t_2;
}
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 = (z - t) / (z - a)
t_2 = (y / (a - z)) * t
if (t_1 <= (-1d+75)) then
tmp = t_2
else if (t_1 <= 5d-35) then
tmp = x + (y * (t / a))
else if (t_1 <= 2d+21) then
tmp = x + y
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) / (z - a);
double t_2 = (y / (a - z)) * t;
double tmp;
if (t_1 <= -1e+75) {
tmp = t_2;
} else if (t_1 <= 5e-35) {
tmp = x + (y * (t / a));
} else if (t_1 <= 2e+21) {
tmp = x + y;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (z - t) / (z - a) t_2 = (y / (a - z)) * t tmp = 0 if t_1 <= -1e+75: tmp = t_2 elif t_1 <= 5e-35: tmp = x + (y * (t / a)) elif t_1 <= 2e+21: tmp = x + y else: tmp = t_2 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(z - t) / Float64(z - a)) t_2 = Float64(Float64(y / Float64(a - z)) * t) tmp = 0.0 if (t_1 <= -1e+75) tmp = t_2; elseif (t_1 <= 5e-35) tmp = Float64(x + Float64(y * Float64(t / a))); elseif (t_1 <= 2e+21) tmp = Float64(x + y); else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (z - t) / (z - a); t_2 = (y / (a - z)) * t; tmp = 0.0; if (t_1 <= -1e+75) tmp = t_2; elseif (t_1 <= 5e-35) tmp = x + (y * (t / a)); elseif (t_1 <= 2e+21) tmp = x + y; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(y / N[(a - z), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]}, If[LessEqual[t$95$1, -1e+75], t$95$2, If[LessEqual[t$95$1, 5e-35], N[(x + N[(y * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e+21], N[(x + y), $MachinePrecision], t$95$2]]]]]
\begin{array}{l}
t_1 := \frac{z - t}{z - a}\\
t_2 := \frac{y}{a - z} \cdot t\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{+75}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{-35}:\\
\;\;\;\;x + y \cdot \frac{t}{a}\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+21}:\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
if (/.f64 (-.f64 z t) (-.f64 z a)) < -9.9999999999999993e74 or 2e21 < (/.f64 (-.f64 z t) (-.f64 z a)) Initial program 98.0%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6497.9%
Applied rewrites97.9%
lift-+.f64N/A
add-flipN/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
div-flip-revN/A
lift--.f64N/A
lift--.f64N/A
lower--.f64N/A
lift--.f64N/A
lift--.f64N/A
associate-*r/N/A
*-commutativeN/A
associate-/l*N/A
distribute-rgt-neg-inN/A
distribute-frac-neg2N/A
*-commutativeN/A
Applied rewrites96.0%
Taylor expanded in t around inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f6425.9%
Applied rewrites25.9%
lift--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift--.f6428.3%
Applied rewrites28.3%
if -9.9999999999999993e74 < (/.f64 (-.f64 z t) (-.f64 z a)) < 4.9999999999999996e-35Initial program 98.0%
Taylor expanded in z around 0
lower-/.f6461.4%
Applied rewrites61.4%
if 4.9999999999999996e-35 < (/.f64 (-.f64 z t) (-.f64 z a)) < 2e21Initial program 98.0%
Taylor expanded in z around inf
lower-+.f6461.2%
Applied rewrites61.2%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- z t) (- z a))))
(if (<= t_1 -4e+18)
(* (/ t (- a z)) y)
(if (<= t_1 5e-35)
(+ x (/ (* t y) a))
(if (<= t_1 2e+21) (+ x y) (* (/ y (- a z)) t))))))double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) / (z - a);
double tmp;
if (t_1 <= -4e+18) {
tmp = (t / (a - z)) * y;
} else if (t_1 <= 5e-35) {
tmp = x + ((t * y) / a);
} else if (t_1 <= 2e+21) {
tmp = x + y;
} else {
tmp = (y / (a - 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) :: t_1
real(8) :: tmp
t_1 = (z - t) / (z - a)
if (t_1 <= (-4d+18)) then
tmp = (t / (a - z)) * y
else if (t_1 <= 5d-35) then
tmp = x + ((t * y) / a)
else if (t_1 <= 2d+21) then
tmp = x + y
else
tmp = (y / (a - z)) * t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) / (z - a);
double tmp;
if (t_1 <= -4e+18) {
tmp = (t / (a - z)) * y;
} else if (t_1 <= 5e-35) {
tmp = x + ((t * y) / a);
} else if (t_1 <= 2e+21) {
tmp = x + y;
} else {
tmp = (y / (a - z)) * t;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (z - t) / (z - a) tmp = 0 if t_1 <= -4e+18: tmp = (t / (a - z)) * y elif t_1 <= 5e-35: tmp = x + ((t * y) / a) elif t_1 <= 2e+21: tmp = x + y else: tmp = (y / (a - z)) * t return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(z - t) / Float64(z - a)) tmp = 0.0 if (t_1 <= -4e+18) tmp = Float64(Float64(t / Float64(a - z)) * y); elseif (t_1 <= 5e-35) tmp = Float64(x + Float64(Float64(t * y) / a)); elseif (t_1 <= 2e+21) tmp = Float64(x + y); else tmp = Float64(Float64(y / Float64(a - z)) * t); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (z - t) / (z - a); tmp = 0.0; if (t_1 <= -4e+18) tmp = (t / (a - z)) * y; elseif (t_1 <= 5e-35) tmp = x + ((t * y) / a); elseif (t_1 <= 2e+21) tmp = x + y; else tmp = (y / (a - z)) * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -4e+18], N[(N[(t / N[(a - z), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[t$95$1, 5e-35], N[(x + N[(N[(t * y), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e+21], N[(x + y), $MachinePrecision], N[(N[(y / N[(a - z), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]]]]]
\begin{array}{l}
t_1 := \frac{z - t}{z - a}\\
\mathbf{if}\;t\_1 \leq -4 \cdot 10^{+18}:\\
\;\;\;\;\frac{t}{a - z} \cdot y\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{-35}:\\
\;\;\;\;x + \frac{t \cdot y}{a}\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+21}:\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a - z} \cdot t\\
\end{array}
if (/.f64 (-.f64 z t) (-.f64 z a)) < -4e18Initial program 98.0%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6497.9%
Applied rewrites97.9%
lift-+.f64N/A
add-flipN/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
div-flip-revN/A
lift--.f64N/A
lift--.f64N/A
lower--.f64N/A
lift--.f64N/A
lift--.f64N/A
associate-*r/N/A
*-commutativeN/A
associate-/l*N/A
distribute-rgt-neg-inN/A
distribute-frac-neg2N/A
*-commutativeN/A
Applied rewrites96.0%
Taylor expanded in t around inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f6425.9%
Applied rewrites25.9%
lift--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift--.f6427.9%
Applied rewrites27.9%
if -4e18 < (/.f64 (-.f64 z t) (-.f64 z a)) < 4.9999999999999996e-35Initial program 98.0%
Taylor expanded in z around 0
lower-/.f64N/A
lower-*.f6459.6%
Applied rewrites59.6%
if 4.9999999999999996e-35 < (/.f64 (-.f64 z t) (-.f64 z a)) < 2e21Initial program 98.0%
Taylor expanded in z around inf
lower-+.f6461.2%
Applied rewrites61.2%
if 2e21 < (/.f64 (-.f64 z t) (-.f64 z a)) Initial program 98.0%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6497.9%
Applied rewrites97.9%
lift-+.f64N/A
add-flipN/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
div-flip-revN/A
lift--.f64N/A
lift--.f64N/A
lower--.f64N/A
lift--.f64N/A
lift--.f64N/A
associate-*r/N/A
*-commutativeN/A
associate-/l*N/A
distribute-rgt-neg-inN/A
distribute-frac-neg2N/A
*-commutativeN/A
Applied rewrites96.0%
Taylor expanded in t around inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f6425.9%
Applied rewrites25.9%
lift--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift--.f6428.3%
Applied rewrites28.3%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- z t) (- z a))))
(if (<= t_1 -40000000000000.0)
(* (/ t (- a z)) y)
(if (<= t_1 2e+21) (+ x y) (* (/ y (- a z)) t)))))double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) / (z - a);
double tmp;
if (t_1 <= -40000000000000.0) {
tmp = (t / (a - z)) * y;
} else if (t_1 <= 2e+21) {
tmp = x + y;
} else {
tmp = (y / (a - 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) :: t_1
real(8) :: tmp
t_1 = (z - t) / (z - a)
if (t_1 <= (-40000000000000.0d0)) then
tmp = (t / (a - z)) * y
else if (t_1 <= 2d+21) then
tmp = x + y
else
tmp = (y / (a - z)) * t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) / (z - a);
double tmp;
if (t_1 <= -40000000000000.0) {
tmp = (t / (a - z)) * y;
} else if (t_1 <= 2e+21) {
tmp = x + y;
} else {
tmp = (y / (a - z)) * t;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (z - t) / (z - a) tmp = 0 if t_1 <= -40000000000000.0: tmp = (t / (a - z)) * y elif t_1 <= 2e+21: tmp = x + y else: tmp = (y / (a - z)) * t return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(z - t) / Float64(z - a)) tmp = 0.0 if (t_1 <= -40000000000000.0) tmp = Float64(Float64(t / Float64(a - z)) * y); elseif (t_1 <= 2e+21) tmp = Float64(x + y); else tmp = Float64(Float64(y / Float64(a - z)) * t); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (z - t) / (z - a); tmp = 0.0; if (t_1 <= -40000000000000.0) tmp = (t / (a - z)) * y; elseif (t_1 <= 2e+21) tmp = x + y; else tmp = (y / (a - z)) * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -40000000000000.0], N[(N[(t / N[(a - z), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[t$95$1, 2e+21], N[(x + y), $MachinePrecision], N[(N[(y / N[(a - z), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]]]]
\begin{array}{l}
t_1 := \frac{z - t}{z - a}\\
\mathbf{if}\;t\_1 \leq -40000000000000:\\
\;\;\;\;\frac{t}{a - z} \cdot y\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+21}:\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a - z} \cdot t\\
\end{array}
if (/.f64 (-.f64 z t) (-.f64 z a)) < -4e13Initial program 98.0%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6497.9%
Applied rewrites97.9%
lift-+.f64N/A
add-flipN/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
div-flip-revN/A
lift--.f64N/A
lift--.f64N/A
lower--.f64N/A
lift--.f64N/A
lift--.f64N/A
associate-*r/N/A
*-commutativeN/A
associate-/l*N/A
distribute-rgt-neg-inN/A
distribute-frac-neg2N/A
*-commutativeN/A
Applied rewrites96.0%
Taylor expanded in t around inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f6425.9%
Applied rewrites25.9%
lift--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift--.f6427.9%
Applied rewrites27.9%
if -4e13 < (/.f64 (-.f64 z t) (-.f64 z a)) < 2e21Initial program 98.0%
Taylor expanded in z around inf
lower-+.f6461.2%
Applied rewrites61.2%
if 2e21 < (/.f64 (-.f64 z t) (-.f64 z a)) Initial program 98.0%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6497.9%
Applied rewrites97.9%
lift-+.f64N/A
add-flipN/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
div-flip-revN/A
lift--.f64N/A
lift--.f64N/A
lower--.f64N/A
lift--.f64N/A
lift--.f64N/A
associate-*r/N/A
*-commutativeN/A
associate-/l*N/A
distribute-rgt-neg-inN/A
distribute-frac-neg2N/A
*-commutativeN/A
Applied rewrites96.0%
Taylor expanded in t around inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f6425.9%
Applied rewrites25.9%
lift--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift--.f6428.3%
Applied rewrites28.3%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (/ (- z t) (- z a))) (t_2 (* (/ t (- a z)) y))) (if (<= t_1 -40000000000000.0) t_2 (if (<= t_1 2e+21) (+ x y) t_2))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) / (z - a);
double t_2 = (t / (a - z)) * y;
double tmp;
if (t_1 <= -40000000000000.0) {
tmp = t_2;
} else if (t_1 <= 2e+21) {
tmp = x + y;
} else {
tmp = t_2;
}
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 = (z - t) / (z - a)
t_2 = (t / (a - z)) * y
if (t_1 <= (-40000000000000.0d0)) then
tmp = t_2
else if (t_1 <= 2d+21) then
tmp = x + y
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) / (z - a);
double t_2 = (t / (a - z)) * y;
double tmp;
if (t_1 <= -40000000000000.0) {
tmp = t_2;
} else if (t_1 <= 2e+21) {
tmp = x + y;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (z - t) / (z - a) t_2 = (t / (a - z)) * y tmp = 0 if t_1 <= -40000000000000.0: tmp = t_2 elif t_1 <= 2e+21: tmp = x + y else: tmp = t_2 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(z - t) / Float64(z - a)) t_2 = Float64(Float64(t / Float64(a - z)) * y) tmp = 0.0 if (t_1 <= -40000000000000.0) tmp = t_2; elseif (t_1 <= 2e+21) tmp = Float64(x + y); else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (z - t) / (z - a); t_2 = (t / (a - z)) * y; tmp = 0.0; if (t_1 <= -40000000000000.0) tmp = t_2; elseif (t_1 <= 2e+21) tmp = x + y; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(t / N[(a - z), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]}, If[LessEqual[t$95$1, -40000000000000.0], t$95$2, If[LessEqual[t$95$1, 2e+21], N[(x + y), $MachinePrecision], t$95$2]]]]
\begin{array}{l}
t_1 := \frac{z - t}{z - a}\\
t_2 := \frac{t}{a - z} \cdot y\\
\mathbf{if}\;t\_1 \leq -40000000000000:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+21}:\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
if (/.f64 (-.f64 z t) (-.f64 z a)) < -4e13 or 2e21 < (/.f64 (-.f64 z t) (-.f64 z a)) Initial program 98.0%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6497.9%
Applied rewrites97.9%
lift-+.f64N/A
add-flipN/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
div-flip-revN/A
lift--.f64N/A
lift--.f64N/A
lower--.f64N/A
lift--.f64N/A
lift--.f64N/A
associate-*r/N/A
*-commutativeN/A
associate-/l*N/A
distribute-rgt-neg-inN/A
distribute-frac-neg2N/A
*-commutativeN/A
Applied rewrites96.0%
Taylor expanded in t around inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f6425.9%
Applied rewrites25.9%
lift--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift--.f6427.9%
Applied rewrites27.9%
if -4e13 < (/.f64 (-.f64 z t) (-.f64 z a)) < 2e21Initial program 98.0%
Taylor expanded in z around inf
lower-+.f6461.2%
Applied rewrites61.2%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (* (/ y z) (- z t))) (t_2 (* y (/ (- z t) (- z a))))) (if (<= t_2 -5e+232) t_1 (if (<= t_2 2e+244) (+ x y) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (y / z) * (z - t);
double t_2 = y * ((z - t) / (z - a));
double tmp;
if (t_2 <= -5e+232) {
tmp = t_1;
} else if (t_2 <= 2e+244) {
tmp = x + y;
} 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 / z) * (z - t)
t_2 = y * ((z - t) / (z - a))
if (t_2 <= (-5d+232)) then
tmp = t_1
else if (t_2 <= 2d+244) then
tmp = x + y
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 / z) * (z - t);
double t_2 = y * ((z - t) / (z - a));
double tmp;
if (t_2 <= -5e+232) {
tmp = t_1;
} else if (t_2 <= 2e+244) {
tmp = x + y;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (y / z) * (z - t) t_2 = y * ((z - t) / (z - a)) tmp = 0 if t_2 <= -5e+232: tmp = t_1 elif t_2 <= 2e+244: tmp = x + y else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(y / z) * Float64(z - t)) t_2 = Float64(y * Float64(Float64(z - t) / Float64(z - a))) tmp = 0.0 if (t_2 <= -5e+232) tmp = t_1; elseif (t_2 <= 2e+244) tmp = Float64(x + y); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (y / z) * (z - t); t_2 = y * ((z - t) / (z - a)); tmp = 0.0; if (t_2 <= -5e+232) tmp = t_1; elseif (t_2 <= 2e+244) tmp = x + y; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y / z), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(y * N[(N[(z - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -5e+232], t$95$1, If[LessEqual[t$95$2, 2e+244], N[(x + y), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
t_1 := \frac{y}{z} \cdot \left(z - t\right)\\
t_2 := y \cdot \frac{z - t}{z - a}\\
\mathbf{if}\;t\_2 \leq -5 \cdot 10^{+232}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+244}:\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if (*.f64 y (/.f64 (-.f64 z t) (-.f64 z a))) < -4.9999999999999999e232 or 2.0000000000000001e244 < (*.f64 y (/.f64 (-.f64 z t) (-.f64 z a))) Initial program 98.0%
Taylor expanded in x around 0
lower-/.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower--.f6438.9%
Applied rewrites38.9%
lift-/.f64N/A
lift-*.f64N/A
associate-*l/N/A
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
distribute-neg-frac2N/A
lift-/.f64N/A
lower-*.f64N/A
lift-/.f64N/A
distribute-neg-frac2N/A
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
lower-/.f6447.3%
Applied rewrites47.3%
Taylor expanded in z around inf
lower-/.f6430.3%
Applied rewrites30.3%
if -4.9999999999999999e232 < (*.f64 y (/.f64 (-.f64 z t) (-.f64 z a))) < 2.0000000000000001e244Initial program 98.0%
Taylor expanded in z around inf
lower-+.f6461.2%
Applied rewrites61.2%
(FPCore (x y z t a) :precision binary64 (+ x y))
double code(double x, double y, double z, double t, double a) {
return x + y;
}
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
end function
public static double code(double x, double y, double z, double t, double a) {
return x + y;
}
def code(x, y, z, t, a): return x + y
function code(x, y, z, t, a) return Float64(x + y) end
function tmp = code(x, y, z, t, a) tmp = x + y; end
code[x_, y_, z_, t_, a_] := N[(x + y), $MachinePrecision]
x + y
Initial program 98.0%
Taylor expanded in z around inf
lower-+.f6461.2%
Applied rewrites61.2%
(FPCore (x y z t a) :precision binary64 y)
double code(double x, double y, double z, double t, double a) {
return y;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = y
end function
public static double code(double x, double y, double z, double t, double a) {
return y;
}
def code(x, y, z, t, a): return y
function code(x, y, z, t, a) return y end
function tmp = code(x, y, z, t, a) tmp = y; end
code[x_, y_, z_, t_, a_] := y
y
Initial program 98.0%
Taylor expanded in z around inf
lower-+.f6461.2%
Applied rewrites61.2%
Taylor expanded in x around 0
Applied rewrites19.4%
herbie shell --seed 2025258
(FPCore (x y z t a)
:name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisLine from plot-0.2.3.4, A"
:precision binary64
(+ x (* y (/ (- z t) (- z a)))))