
(FPCore (x y z t) :precision binary64 (+ x (* (- y z) (- t x))))
double code(double x, double y, double z, double t) {
return x + ((y - z) * (t - x));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x + ((y - z) * (t - x))
end function
public static double code(double x, double y, double z, double t) {
return x + ((y - z) * (t - x));
}
def code(x, y, z, t): return x + ((y - z) * (t - x))
function code(x, y, z, t) return Float64(x + Float64(Float64(y - z) * Float64(t - x))) end
function tmp = code(x, y, z, t) tmp = x + ((y - z) * (t - x)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(y - z\right) \cdot \left(t - x\right)
\end{array}
Herbie found 15 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (+ x (* (- y z) (- t x))))
double code(double x, double y, double z, double t) {
return x + ((y - z) * (t - x));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x + ((y - z) * (t - x))
end function
public static double code(double x, double y, double z, double t) {
return x + ((y - z) * (t - x));
}
def code(x, y, z, t): return x + ((y - z) * (t - x))
function code(x, y, z, t) return Float64(x + Float64(Float64(y - z) * Float64(t - x))) end
function tmp = code(x, y, z, t) tmp = x + ((y - z) * (t - x)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(y - z\right) \cdot \left(t - x\right)
\end{array}
(FPCore (x y z t) :precision binary64 (+ x (* (- y z) (- t x))))
double code(double x, double y, double z, double t) {
return x + ((y - z) * (t - x));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x + ((y - z) * (t - x))
end function
public static double code(double x, double y, double z, double t) {
return x + ((y - z) * (t - x));
}
def code(x, y, z, t): return x + ((y - z) * (t - x))
function code(x, y, z, t) return Float64(x + Float64(Float64(y - z) * Float64(t - x))) end
function tmp = code(x, y, z, t) tmp = x + ((y - z) * (t - x)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(y - z\right) \cdot \left(t - x\right)
\end{array}
Initial program 100.0%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (fma (- y z) t (* z x)))) (if (<= z -0.0014) t_1 (if (<= z 1.9e-16) (fma (- t x) y x) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = fma((y - z), t, (z * x));
double tmp;
if (z <= -0.0014) {
tmp = t_1;
} else if (z <= 1.9e-16) {
tmp = fma((t - x), y, x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = fma(Float64(y - z), t, Float64(z * x)) tmp = 0.0 if (z <= -0.0014) tmp = t_1; elseif (z <= 1.9e-16) tmp = fma(Float64(t - x), y, x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(y - z), $MachinePrecision] * t + N[(z * x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -0.0014], t$95$1, If[LessEqual[z, 1.9e-16], N[(N[(t - x), $MachinePrecision] * y + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(y - z, t, z \cdot x\right)\\
\mathbf{if}\;z \leq -0.0014:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.9 \cdot 10^{-16}:\\
\;\;\;\;\mathsf{fma}\left(t - x, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -0.00139999999999999999 or 1.90000000000000006e-16 < z Initial program 100.0%
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
*-lft-identityN/A
metadata-evalN/A
distribute-lft-neg-outN/A
lift--.f64N/A
distribute-lft-neg-outN/A
metadata-evalN/A
*-lft-identityN/A
*-lft-identityN/A
fp-cancel-sub-sign-invN/A
metadata-evalN/A
distribute-rgt-outN/A
associate-*r*N/A
+-commutativeN/A
associate-+r+N/A
Applied rewrites97.6%
Taylor expanded in z around inf
Applied rewrites85.0%
if -0.00139999999999999999 < z < 1.90000000000000006e-16Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f6491.0
Applied rewrites91.0%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (fma z x (* (- y z) t)))) (if (<= z -9.5e+61) t_1 (if (<= z 1.9e-16) (fma (- t x) y x) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = fma(z, x, ((y - z) * t));
double tmp;
if (z <= -9.5e+61) {
tmp = t_1;
} else if (z <= 1.9e-16) {
tmp = fma((t - x), y, x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = fma(z, x, Float64(Float64(y - z) * t)) tmp = 0.0 if (z <= -9.5e+61) tmp = t_1; elseif (z <= 1.9e-16) tmp = fma(Float64(t - x), y, x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(z * x + N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -9.5e+61], t$95$1, If[LessEqual[z, 1.9e-16], N[(N[(t - x), $MachinePrecision] * y + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(z, x, \left(y - z\right) \cdot t\right)\\
\mathbf{if}\;z \leq -9.5 \cdot 10^{+61}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.9 \cdot 10^{-16}:\\
\;\;\;\;\mathsf{fma}\left(t - x, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -9.49999999999999959e61 or 1.90000000000000006e-16 < z Initial program 100.0%
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
*-lft-identityN/A
metadata-evalN/A
distribute-lft-neg-outN/A
lift--.f64N/A
distribute-lft-neg-outN/A
metadata-evalN/A
*-lft-identityN/A
*-lft-identityN/A
fp-cancel-sub-sign-invN/A
metadata-evalN/A
distribute-rgt-outN/A
associate-*r*N/A
+-commutativeN/A
associate-+r+N/A
Applied rewrites97.5%
Taylor expanded in z around inf
Applied rewrites87.0%
if -9.49999999999999959e61 < z < 1.90000000000000006e-16Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f6486.8
Applied rewrites86.8%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (fma (- t x) y x))) (if (<= y -3e-48) t_1 (if (<= y 420000000000.0) (- x (* (- t x) z)) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = fma((t - x), y, x);
double tmp;
if (y <= -3e-48) {
tmp = t_1;
} else if (y <= 420000000000.0) {
tmp = x - ((t - x) * z);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = fma(Float64(t - x), y, x) tmp = 0.0 if (y <= -3e-48) tmp = t_1; elseif (y <= 420000000000.0) tmp = Float64(x - Float64(Float64(t - x) * z)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(t - x), $MachinePrecision] * y + x), $MachinePrecision]}, If[LessEqual[y, -3e-48], t$95$1, If[LessEqual[y, 420000000000.0], N[(x - N[(N[(t - x), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(t - x, y, x\right)\\
\mathbf{if}\;y \leq -3 \cdot 10^{-48}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 420000000000:\\
\;\;\;\;x - \left(t - x\right) \cdot z\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -2.9999999999999999e-48 or 4.2e11 < y Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f6477.0
Applied rewrites77.0%
if -2.9999999999999999e-48 < y < 4.2e11Initial program 100.0%
Taylor expanded in y around 0
fp-cancel-sign-sub-invN/A
lower--.f64N/A
metadata-evalN/A
*-lft-identityN/A
*-commutativeN/A
lower-*.f64N/A
lift--.f6490.7
Applied rewrites90.7%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* (- x t) z))) (if (<= z -8e+80) t_1 (if (<= z 270000.0) (fma (- t x) y x) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = (x - t) * z;
double tmp;
if (z <= -8e+80) {
tmp = t_1;
} else if (z <= 270000.0) {
tmp = fma((t - x), y, x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(Float64(x - t) * z) tmp = 0.0 if (z <= -8e+80) tmp = t_1; elseif (z <= 270000.0) tmp = fma(Float64(t - x), y, x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x - t), $MachinePrecision] * z), $MachinePrecision]}, If[LessEqual[z, -8e+80], t$95$1, If[LessEqual[z, 270000.0], N[(N[(t - x), $MachinePrecision] * y + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(x - t\right) \cdot z\\
\mathbf{if}\;z \leq -8 \cdot 10^{+80}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 270000:\\
\;\;\;\;\mathsf{fma}\left(t - x, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -8e80 or 2.7e5 < z Initial program 100.0%
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift--.f64N/A
+-commutativeN/A
*-commutativeN/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
distribute-rgt-outN/A
associate-*r*N/A
+-commutativeN/A
associate-+l+N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
fp-cancel-sign-sub-invN/A
lower--.f64N/A
Applied rewrites96.3%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6481.7
Applied rewrites81.7%
if -8e80 < z < 2.7e5Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f6484.9
Applied rewrites84.9%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (- x t) z)))
(if (<= z -0.00115)
t_1
(if (<= z -3.5e-107)
(* (- 1.0 y) x)
(if (<= z 1.9e-75)
(* (- t x) y)
(if (<= z 920.0) (- x (* z t)) t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = (x - t) * z;
double tmp;
if (z <= -0.00115) {
tmp = t_1;
} else if (z <= -3.5e-107) {
tmp = (1.0 - y) * x;
} else if (z <= 1.9e-75) {
tmp = (t - x) * y;
} else if (z <= 920.0) {
tmp = x - (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)
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) :: t_1
real(8) :: tmp
t_1 = (x - t) * z
if (z <= (-0.00115d0)) then
tmp = t_1
else if (z <= (-3.5d-107)) then
tmp = (1.0d0 - y) * x
else if (z <= 1.9d-75) then
tmp = (t - x) * y
else if (z <= 920.0d0) then
tmp = x - (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 t_1 = (x - t) * z;
double tmp;
if (z <= -0.00115) {
tmp = t_1;
} else if (z <= -3.5e-107) {
tmp = (1.0 - y) * x;
} else if (z <= 1.9e-75) {
tmp = (t - x) * y;
} else if (z <= 920.0) {
tmp = x - (z * t);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x - t) * z tmp = 0 if z <= -0.00115: tmp = t_1 elif z <= -3.5e-107: tmp = (1.0 - y) * x elif z <= 1.9e-75: tmp = (t - x) * y elif z <= 920.0: tmp = x - (z * t) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x - t) * z) tmp = 0.0 if (z <= -0.00115) tmp = t_1; elseif (z <= -3.5e-107) tmp = Float64(Float64(1.0 - y) * x); elseif (z <= 1.9e-75) tmp = Float64(Float64(t - x) * y); elseif (z <= 920.0) tmp = Float64(x - Float64(z * t)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x - t) * z; tmp = 0.0; if (z <= -0.00115) tmp = t_1; elseif (z <= -3.5e-107) tmp = (1.0 - y) * x; elseif (z <= 1.9e-75) tmp = (t - x) * y; elseif (z <= 920.0) tmp = x - (z * t); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x - t), $MachinePrecision] * z), $MachinePrecision]}, If[LessEqual[z, -0.00115], t$95$1, If[LessEqual[z, -3.5e-107], N[(N[(1.0 - y), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[z, 1.9e-75], N[(N[(t - x), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[z, 920.0], N[(x - N[(z * t), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(x - t\right) \cdot z\\
\mathbf{if}\;z \leq -0.00115:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -3.5 \cdot 10^{-107}:\\
\;\;\;\;\left(1 - y\right) \cdot x\\
\mathbf{elif}\;z \leq 1.9 \cdot 10^{-75}:\\
\;\;\;\;\left(t - x\right) \cdot y\\
\mathbf{elif}\;z \leq 920:\\
\;\;\;\;x - z \cdot t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -0.00115 or 920 < z Initial program 100.0%
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift--.f64N/A
+-commutativeN/A
*-commutativeN/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
distribute-rgt-outN/A
associate-*r*N/A
+-commutativeN/A
associate-+l+N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
fp-cancel-sign-sub-invN/A
lower--.f64N/A
Applied rewrites96.6%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6477.4
Applied rewrites77.4%
if -0.00115 < z < -3.49999999999999985e-107Initial program 100.0%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower--.f64N/A
lift--.f6454.5
Applied rewrites54.5%
Taylor expanded in y around inf
Applied rewrites53.4%
if -3.49999999999999985e-107 < z < 1.89999999999999997e-75Initial program 100.0%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lift--.f6462.0
Applied rewrites62.0%
if 1.89999999999999997e-75 < z < 920Initial program 100.0%
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift--.f64N/A
+-commutativeN/A
*-commutativeN/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
distribute-rgt-outN/A
associate-*r*N/A
+-commutativeN/A
associate-+l+N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
fp-cancel-sign-sub-invN/A
lower--.f64N/A
Applied rewrites100.0%
Taylor expanded in y around 0
*-commutativeN/A
lower--.f64N/A
lift--.f64N/A
lift-*.f6446.6
Applied rewrites46.6%
Taylor expanded in x around 0
*-commutativeN/A
lift-*.f6443.5
Applied rewrites43.5%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (- x t) z)) (t_2 (* (- 1.0 y) x)))
(if (<= z -0.00115)
t_1
(if (<= z -3.5e-107)
t_2
(if (<= z 1.9e-75) (* (- t x) y) (if (<= z 1.9e-16) t_2 t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = (x - t) * z;
double t_2 = (1.0 - y) * x;
double tmp;
if (z <= -0.00115) {
tmp = t_1;
} else if (z <= -3.5e-107) {
tmp = t_2;
} else if (z <= 1.9e-75) {
tmp = (t - x) * y;
} else if (z <= 1.9e-16) {
tmp = t_2;
} 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)
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) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = (x - t) * z
t_2 = (1.0d0 - y) * x
if (z <= (-0.00115d0)) then
tmp = t_1
else if (z <= (-3.5d-107)) then
tmp = t_2
else if (z <= 1.9d-75) then
tmp = (t - x) * y
else if (z <= 1.9d-16) then
tmp = t_2
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (x - t) * z;
double t_2 = (1.0 - y) * x;
double tmp;
if (z <= -0.00115) {
tmp = t_1;
} else if (z <= -3.5e-107) {
tmp = t_2;
} else if (z <= 1.9e-75) {
tmp = (t - x) * y;
} else if (z <= 1.9e-16) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x - t) * z t_2 = (1.0 - y) * x tmp = 0 if z <= -0.00115: tmp = t_1 elif z <= -3.5e-107: tmp = t_2 elif z <= 1.9e-75: tmp = (t - x) * y elif z <= 1.9e-16: tmp = t_2 else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x - t) * z) t_2 = Float64(Float64(1.0 - y) * x) tmp = 0.0 if (z <= -0.00115) tmp = t_1; elseif (z <= -3.5e-107) tmp = t_2; elseif (z <= 1.9e-75) tmp = Float64(Float64(t - x) * y); elseif (z <= 1.9e-16) tmp = t_2; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x - t) * z; t_2 = (1.0 - y) * x; tmp = 0.0; if (z <= -0.00115) tmp = t_1; elseif (z <= -3.5e-107) tmp = t_2; elseif (z <= 1.9e-75) tmp = (t - x) * y; elseif (z <= 1.9e-16) tmp = t_2; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x - t), $MachinePrecision] * z), $MachinePrecision]}, Block[{t$95$2 = N[(N[(1.0 - y), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[z, -0.00115], t$95$1, If[LessEqual[z, -3.5e-107], t$95$2, If[LessEqual[z, 1.9e-75], N[(N[(t - x), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[z, 1.9e-16], t$95$2, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(x - t\right) \cdot z\\
t_2 := \left(1 - y\right) \cdot x\\
\mathbf{if}\;z \leq -0.00115:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -3.5 \cdot 10^{-107}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;z \leq 1.9 \cdot 10^{-75}:\\
\;\;\;\;\left(t - x\right) \cdot y\\
\mathbf{elif}\;z \leq 1.9 \cdot 10^{-16}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -0.00115 or 1.90000000000000006e-16 < z Initial program 100.0%
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift--.f64N/A
+-commutativeN/A
*-commutativeN/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
distribute-rgt-outN/A
associate-*r*N/A
+-commutativeN/A
associate-+l+N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
fp-cancel-sign-sub-invN/A
lower--.f64N/A
Applied rewrites96.7%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6475.9
Applied rewrites75.9%
if -0.00115 < z < -3.49999999999999985e-107 or 1.89999999999999997e-75 < z < 1.90000000000000006e-16Initial program 100.0%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower--.f64N/A
lift--.f6453.2
Applied rewrites53.2%
Taylor expanded in y around inf
Applied rewrites52.5%
if -3.49999999999999985e-107 < z < 1.89999999999999997e-75Initial program 100.0%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lift--.f6462.0
Applied rewrites62.0%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* (- 1.0 y) x))) (if (<= x -4.4e-16) t_1 (if (<= x 2.55e-43) (* (- y z) t) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = (1.0 - y) * x;
double tmp;
if (x <= -4.4e-16) {
tmp = t_1;
} else if (x <= 2.55e-43) {
tmp = (y - z) * t;
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t)
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) :: t_1
real(8) :: tmp
t_1 = (1.0d0 - y) * x
if (x <= (-4.4d-16)) then
tmp = t_1
else if (x <= 2.55d-43) then
tmp = (y - z) * t
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (1.0 - y) * x;
double tmp;
if (x <= -4.4e-16) {
tmp = t_1;
} else if (x <= 2.55e-43) {
tmp = (y - z) * t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (1.0 - y) * x tmp = 0 if x <= -4.4e-16: tmp = t_1 elif x <= 2.55e-43: tmp = (y - z) * t else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(1.0 - y) * x) tmp = 0.0 if (x <= -4.4e-16) tmp = t_1; elseif (x <= 2.55e-43) tmp = Float64(Float64(y - z) * t); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (1.0 - y) * x; tmp = 0.0; if (x <= -4.4e-16) tmp = t_1; elseif (x <= 2.55e-43) tmp = (y - z) * t; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(1.0 - y), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[x, -4.4e-16], t$95$1, If[LessEqual[x, 2.55e-43], N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(1 - y\right) \cdot x\\
\mathbf{if}\;x \leq -4.4 \cdot 10^{-16}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 2.55 \cdot 10^{-43}:\\
\;\;\;\;\left(y - z\right) \cdot t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -4.40000000000000001e-16 or 2.5499999999999998e-43 < x Initial program 100.0%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower--.f64N/A
lift--.f6479.8
Applied rewrites79.8%
Taylor expanded in y around inf
Applied rewrites53.8%
if -4.40000000000000001e-16 < x < 2.5499999999999998e-43Initial program 100.0%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
lift--.f6472.2
Applied rewrites72.2%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* (- t x) y))) (if (<= y -3.2e-49) t_1 (if (<= y 1.58e-27) (* (- z) t) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = (t - x) * y;
double tmp;
if (y <= -3.2e-49) {
tmp = t_1;
} else if (y <= 1.58e-27) {
tmp = -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)
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) :: t_1
real(8) :: tmp
t_1 = (t - x) * y
if (y <= (-3.2d-49)) then
tmp = t_1
else if (y <= 1.58d-27) then
tmp = -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 t_1 = (t - x) * y;
double tmp;
if (y <= -3.2e-49) {
tmp = t_1;
} else if (y <= 1.58e-27) {
tmp = -z * t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (t - x) * y tmp = 0 if y <= -3.2e-49: tmp = t_1 elif y <= 1.58e-27: tmp = -z * t else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(t - x) * y) tmp = 0.0 if (y <= -3.2e-49) tmp = t_1; elseif (y <= 1.58e-27) tmp = Float64(Float64(-z) * t); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (t - x) * y; tmp = 0.0; if (y <= -3.2e-49) tmp = t_1; elseif (y <= 1.58e-27) tmp = -z * t; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(t - x), $MachinePrecision] * y), $MachinePrecision]}, If[LessEqual[y, -3.2e-49], t$95$1, If[LessEqual[y, 1.58e-27], N[((-z) * t), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(t - x\right) \cdot y\\
\mathbf{if}\;y \leq -3.2 \cdot 10^{-49}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 1.58 \cdot 10^{-27}:\\
\;\;\;\;\left(-z\right) \cdot t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -3.20000000000000002e-49 or 1.58e-27 < y Initial program 100.0%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lift--.f6472.9
Applied rewrites72.9%
if -3.20000000000000002e-49 < y < 1.58e-27Initial program 100.0%
Taylor expanded in z around inf
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lift--.f6460.0
Applied rewrites60.0%
Taylor expanded in x around 0
Applied rewrites36.5%
(FPCore (x y z t)
:precision binary64
(if (<= z -8e+80)
(* z x)
(if (<= z 3.9e+18)
(* (- 1.0 y) x)
(if (<= z 1.65e+80) (* z x) (* (- z) t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -8e+80) {
tmp = z * x;
} else if (z <= 3.9e+18) {
tmp = (1.0 - y) * x;
} else if (z <= 1.65e+80) {
tmp = z * x;
} else {
tmp = -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)
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) :: tmp
if (z <= (-8d+80)) then
tmp = z * x
else if (z <= 3.9d+18) then
tmp = (1.0d0 - y) * x
else if (z <= 1.65d+80) then
tmp = z * x
else
tmp = -z * t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -8e+80) {
tmp = z * x;
} else if (z <= 3.9e+18) {
tmp = (1.0 - y) * x;
} else if (z <= 1.65e+80) {
tmp = z * x;
} else {
tmp = -z * t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -8e+80: tmp = z * x elif z <= 3.9e+18: tmp = (1.0 - y) * x elif z <= 1.65e+80: tmp = z * x else: tmp = -z * t return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -8e+80) tmp = Float64(z * x); elseif (z <= 3.9e+18) tmp = Float64(Float64(1.0 - y) * x); elseif (z <= 1.65e+80) tmp = Float64(z * x); else tmp = Float64(Float64(-z) * t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -8e+80) tmp = z * x; elseif (z <= 3.9e+18) tmp = (1.0 - y) * x; elseif (z <= 1.65e+80) tmp = z * x; else tmp = -z * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -8e+80], N[(z * x), $MachinePrecision], If[LessEqual[z, 3.9e+18], N[(N[(1.0 - y), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[z, 1.65e+80], N[(z * x), $MachinePrecision], N[((-z) * t), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -8 \cdot 10^{+80}:\\
\;\;\;\;z \cdot x\\
\mathbf{elif}\;z \leq 3.9 \cdot 10^{+18}:\\
\;\;\;\;\left(1 - y\right) \cdot x\\
\mathbf{elif}\;z \leq 1.65 \cdot 10^{+80}:\\
\;\;\;\;z \cdot x\\
\mathbf{else}:\\
\;\;\;\;\left(-z\right) \cdot t\\
\end{array}
\end{array}
if z < -8e80 or 3.9e18 < z < 1.64999999999999995e80Initial program 100.0%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower--.f64N/A
lift--.f6453.1
Applied rewrites53.1%
Taylor expanded in z around inf
Applied rewrites41.7%
if -8e80 < z < 3.9e18Initial program 100.0%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower--.f64N/A
lift--.f6458.1
Applied rewrites58.1%
Taylor expanded in y around inf
Applied rewrites54.1%
if 1.64999999999999995e80 < z Initial program 100.0%
Taylor expanded in z around inf
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lift--.f6484.7
Applied rewrites84.7%
Taylor expanded in x around 0
Applied rewrites42.4%
(FPCore (x y z t)
:precision binary64
(if (<= (- y z) -5e+234)
(* (- z) t)
(if (<= (- y z) -100000.0)
(* t y)
(if (<= (- y z) 1e-7)
(* 1.0 x)
(if (<= (- y z) 5e+169) (* (- x) y) (* z x))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y - z) <= -5e+234) {
tmp = -z * t;
} else if ((y - z) <= -100000.0) {
tmp = t * y;
} else if ((y - z) <= 1e-7) {
tmp = 1.0 * x;
} else if ((y - z) <= 5e+169) {
tmp = -x * y;
} else {
tmp = z * x;
}
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)
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) :: tmp
if ((y - z) <= (-5d+234)) then
tmp = -z * t
else if ((y - z) <= (-100000.0d0)) then
tmp = t * y
else if ((y - z) <= 1d-7) then
tmp = 1.0d0 * x
else if ((y - z) <= 5d+169) then
tmp = -x * y
else
tmp = z * x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y - z) <= -5e+234) {
tmp = -z * t;
} else if ((y - z) <= -100000.0) {
tmp = t * y;
} else if ((y - z) <= 1e-7) {
tmp = 1.0 * x;
} else if ((y - z) <= 5e+169) {
tmp = -x * y;
} else {
tmp = z * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y - z) <= -5e+234: tmp = -z * t elif (y - z) <= -100000.0: tmp = t * y elif (y - z) <= 1e-7: tmp = 1.0 * x elif (y - z) <= 5e+169: tmp = -x * y else: tmp = z * x return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(y - z) <= -5e+234) tmp = Float64(Float64(-z) * t); elseif (Float64(y - z) <= -100000.0) tmp = Float64(t * y); elseif (Float64(y - z) <= 1e-7) tmp = Float64(1.0 * x); elseif (Float64(y - z) <= 5e+169) tmp = Float64(Float64(-x) * y); else tmp = Float64(z * x); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y - z) <= -5e+234) tmp = -z * t; elseif ((y - z) <= -100000.0) tmp = t * y; elseif ((y - z) <= 1e-7) tmp = 1.0 * x; elseif ((y - z) <= 5e+169) tmp = -x * y; else tmp = z * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(y - z), $MachinePrecision], -5e+234], N[((-z) * t), $MachinePrecision], If[LessEqual[N[(y - z), $MachinePrecision], -100000.0], N[(t * y), $MachinePrecision], If[LessEqual[N[(y - z), $MachinePrecision], 1e-7], N[(1.0 * x), $MachinePrecision], If[LessEqual[N[(y - z), $MachinePrecision], 5e+169], N[((-x) * y), $MachinePrecision], N[(z * x), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y - z \leq -5 \cdot 10^{+234}:\\
\;\;\;\;\left(-z\right) \cdot t\\
\mathbf{elif}\;y - z \leq -100000:\\
\;\;\;\;t \cdot y\\
\mathbf{elif}\;y - z \leq 10^{-7}:\\
\;\;\;\;1 \cdot x\\
\mathbf{elif}\;y - z \leq 5 \cdot 10^{+169}:\\
\;\;\;\;\left(-x\right) \cdot y\\
\mathbf{else}:\\
\;\;\;\;z \cdot x\\
\end{array}
\end{array}
if (-.f64 y z) < -5.0000000000000003e234Initial program 100.0%
Taylor expanded in z around inf
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lift--.f6455.8
Applied rewrites55.8%
Taylor expanded in x around 0
Applied rewrites28.3%
if -5.0000000000000003e234 < (-.f64 y z) < -1e5Initial program 100.0%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lift--.f6453.4
Applied rewrites53.4%
Taylor expanded in x around 0
Applied rewrites27.5%
if -1e5 < (-.f64 y z) < 9.9999999999999995e-8Initial program 100.0%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower--.f64N/A
lift--.f6464.4
Applied rewrites64.4%
Taylor expanded in y around 0
lower-+.f6463.5
Applied rewrites63.5%
Taylor expanded in z around 0
Applied rewrites62.6%
if 9.9999999999999995e-8 < (-.f64 y z) < 5.00000000000000017e169Initial program 100.0%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lift--.f6450.9
Applied rewrites50.9%
Taylor expanded in x around inf
mul-1-negN/A
lower-neg.f6427.3
Applied rewrites27.3%
if 5.00000000000000017e169 < (-.f64 y z) Initial program 100.0%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower--.f64N/A
lift--.f6454.2
Applied rewrites54.2%
Taylor expanded in z around inf
Applied rewrites29.9%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (- x) y)))
(if (<= (- y z) -1e+244)
t_1
(if (<= (- y z) -100000.0)
(* t y)
(if (<= (- y z) 1e-7)
(* 1.0 x)
(if (<= (- y z) 5e+169) t_1 (* z x)))))))
double code(double x, double y, double z, double t) {
double t_1 = -x * y;
double tmp;
if ((y - z) <= -1e+244) {
tmp = t_1;
} else if ((y - z) <= -100000.0) {
tmp = t * y;
} else if ((y - z) <= 1e-7) {
tmp = 1.0 * x;
} else if ((y - z) <= 5e+169) {
tmp = t_1;
} else {
tmp = z * x;
}
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)
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) :: t_1
real(8) :: tmp
t_1 = -x * y
if ((y - z) <= (-1d+244)) then
tmp = t_1
else if ((y - z) <= (-100000.0d0)) then
tmp = t * y
else if ((y - z) <= 1d-7) then
tmp = 1.0d0 * x
else if ((y - z) <= 5d+169) then
tmp = t_1
else
tmp = z * x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = -x * y;
double tmp;
if ((y - z) <= -1e+244) {
tmp = t_1;
} else if ((y - z) <= -100000.0) {
tmp = t * y;
} else if ((y - z) <= 1e-7) {
tmp = 1.0 * x;
} else if ((y - z) <= 5e+169) {
tmp = t_1;
} else {
tmp = z * x;
}
return tmp;
}
def code(x, y, z, t): t_1 = -x * y tmp = 0 if (y - z) <= -1e+244: tmp = t_1 elif (y - z) <= -100000.0: tmp = t * y elif (y - z) <= 1e-7: tmp = 1.0 * x elif (y - z) <= 5e+169: tmp = t_1 else: tmp = z * x return tmp
function code(x, y, z, t) t_1 = Float64(Float64(-x) * y) tmp = 0.0 if (Float64(y - z) <= -1e+244) tmp = t_1; elseif (Float64(y - z) <= -100000.0) tmp = Float64(t * y); elseif (Float64(y - z) <= 1e-7) tmp = Float64(1.0 * x); elseif (Float64(y - z) <= 5e+169) tmp = t_1; else tmp = Float64(z * x); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = -x * y; tmp = 0.0; if ((y - z) <= -1e+244) tmp = t_1; elseif ((y - z) <= -100000.0) tmp = t * y; elseif ((y - z) <= 1e-7) tmp = 1.0 * x; elseif ((y - z) <= 5e+169) tmp = t_1; else tmp = z * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[((-x) * y), $MachinePrecision]}, If[LessEqual[N[(y - z), $MachinePrecision], -1e+244], t$95$1, If[LessEqual[N[(y - z), $MachinePrecision], -100000.0], N[(t * y), $MachinePrecision], If[LessEqual[N[(y - z), $MachinePrecision], 1e-7], N[(1.0 * x), $MachinePrecision], If[LessEqual[N[(y - z), $MachinePrecision], 5e+169], t$95$1, N[(z * x), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(-x\right) \cdot y\\
\mathbf{if}\;y - z \leq -1 \cdot 10^{+244}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y - z \leq -100000:\\
\;\;\;\;t \cdot y\\
\mathbf{elif}\;y - z \leq 10^{-7}:\\
\;\;\;\;1 \cdot x\\
\mathbf{elif}\;y - z \leq 5 \cdot 10^{+169}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;z \cdot x\\
\end{array}
\end{array}
if (-.f64 y z) < -1.00000000000000007e244 or 9.9999999999999995e-8 < (-.f64 y z) < 5.00000000000000017e169Initial program 100.0%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lift--.f6452.3
Applied rewrites52.3%
Taylor expanded in x around inf
mul-1-negN/A
lower-neg.f6429.2
Applied rewrites29.2%
if -1.00000000000000007e244 < (-.f64 y z) < -1e5Initial program 100.0%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lift--.f6453.8
Applied rewrites53.8%
Taylor expanded in x around 0
Applied rewrites28.1%
if -1e5 < (-.f64 y z) < 9.9999999999999995e-8Initial program 100.0%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower--.f64N/A
lift--.f6464.4
Applied rewrites64.4%
Taylor expanded in y around 0
lower-+.f6463.5
Applied rewrites63.5%
Taylor expanded in z around 0
Applied rewrites62.6%
if 5.00000000000000017e169 < (-.f64 y z) Initial program 100.0%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower--.f64N/A
lift--.f6454.2
Applied rewrites54.2%
Taylor expanded in z around inf
Applied rewrites29.9%
(FPCore (x y z t) :precision binary64 (if (<= (- y z) -100000.0) (* t y) (if (<= (- y z) 1e-7) (* 1.0 x) (* z x))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y - z) <= -100000.0) {
tmp = t * y;
} else if ((y - z) <= 1e-7) {
tmp = 1.0 * x;
} else {
tmp = z * x;
}
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)
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) :: tmp
if ((y - z) <= (-100000.0d0)) then
tmp = t * y
else if ((y - z) <= 1d-7) then
tmp = 1.0d0 * x
else
tmp = z * x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y - z) <= -100000.0) {
tmp = t * y;
} else if ((y - z) <= 1e-7) {
tmp = 1.0 * x;
} else {
tmp = z * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y - z) <= -100000.0: tmp = t * y elif (y - z) <= 1e-7: tmp = 1.0 * x else: tmp = z * x return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(y - z) <= -100000.0) tmp = Float64(t * y); elseif (Float64(y - z) <= 1e-7) tmp = Float64(1.0 * x); else tmp = Float64(z * x); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y - z) <= -100000.0) tmp = t * y; elseif ((y - z) <= 1e-7) tmp = 1.0 * x; else tmp = z * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(y - z), $MachinePrecision], -100000.0], N[(t * y), $MachinePrecision], If[LessEqual[N[(y - z), $MachinePrecision], 1e-7], N[(1.0 * x), $MachinePrecision], N[(z * x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y - z \leq -100000:\\
\;\;\;\;t \cdot y\\
\mathbf{elif}\;y - z \leq 10^{-7}:\\
\;\;\;\;1 \cdot x\\
\mathbf{else}:\\
\;\;\;\;z \cdot x\\
\end{array}
\end{array}
if (-.f64 y z) < -1e5Initial program 100.0%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lift--.f6454.1
Applied rewrites54.1%
Taylor expanded in x around 0
Applied rewrites29.0%
if -1e5 < (-.f64 y z) < 9.9999999999999995e-8Initial program 100.0%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower--.f64N/A
lift--.f6464.4
Applied rewrites64.4%
Taylor expanded in y around 0
lower-+.f6463.5
Applied rewrites63.5%
Taylor expanded in z around 0
Applied rewrites62.6%
if 9.9999999999999995e-8 < (-.f64 y z) Initial program 100.0%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower--.f64N/A
lift--.f6453.4
Applied rewrites53.4%
Taylor expanded in z around inf
Applied rewrites28.0%
(FPCore (x y z t) :precision binary64 (if (<= z -0.0005) (* z x) (if (<= z 920.0) (* 1.0 x) (* z x))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -0.0005) {
tmp = z * x;
} else if (z <= 920.0) {
tmp = 1.0 * x;
} else {
tmp = z * x;
}
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)
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) :: tmp
if (z <= (-0.0005d0)) then
tmp = z * x
else if (z <= 920.0d0) then
tmp = 1.0d0 * x
else
tmp = z * x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -0.0005) {
tmp = z * x;
} else if (z <= 920.0) {
tmp = 1.0 * x;
} else {
tmp = z * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -0.0005: tmp = z * x elif z <= 920.0: tmp = 1.0 * x else: tmp = z * x return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -0.0005) tmp = Float64(z * x); elseif (z <= 920.0) tmp = Float64(1.0 * x); else tmp = Float64(z * x); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -0.0005) tmp = z * x; elseif (z <= 920.0) tmp = 1.0 * x; else tmp = z * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -0.0005], N[(z * x), $MachinePrecision], If[LessEqual[z, 920.0], N[(1.0 * x), $MachinePrecision], N[(z * x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.0005:\\
\;\;\;\;z \cdot x\\
\mathbf{elif}\;z \leq 920:\\
\;\;\;\;1 \cdot x\\
\mathbf{else}:\\
\;\;\;\;z \cdot x\\
\end{array}
\end{array}
if z < -5.0000000000000001e-4 or 920 < z Initial program 100.0%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower--.f64N/A
lift--.f6454.4
Applied rewrites54.4%
Taylor expanded in z around inf
Applied rewrites41.7%
if -5.0000000000000001e-4 < z < 920Initial program 100.0%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower--.f64N/A
lift--.f6459.2
Applied rewrites59.2%
Taylor expanded in y around 0
lower-+.f6433.5
Applied rewrites33.5%
Taylor expanded in z around 0
Applied rewrites33.0%
(FPCore (x y z t) :precision binary64 (* z x))
double code(double x, double y, double z, double t) {
return z * x;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = z * x
end function
public static double code(double x, double y, double z, double t) {
return z * x;
}
def code(x, y, z, t): return z * x
function code(x, y, z, t) return Float64(z * x) end
function tmp = code(x, y, z, t) tmp = z * x; end
code[x_, y_, z_, t_] := N[(z * x), $MachinePrecision]
\begin{array}{l}
\\
z \cdot x
\end{array}
Initial program 100.0%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower--.f64N/A
lift--.f6456.8
Applied rewrites56.8%
Taylor expanded in z around inf
Applied rewrites22.4%
herbie shell --seed 2025112
(FPCore (x y z t)
:name "Data.Metrics.Snapshot:quantile from metrics-0.3.0.2"
:precision binary64
(+ x (* (- y z) (- t x))))