
(FPCore (x y z t) :precision binary64 (/ (* x (- y z)) (- t z)))
double code(double x, double y, double z, double t) {
return (x * (y - z)) / (t - z);
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t)
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 - z)
end function
public static double code(double x, double y, double z, double t) {
return (x * (y - z)) / (t - z);
}
def code(x, y, z, t): return (x * (y - z)) / (t - z)
function code(x, y, z, t) return Float64(Float64(x * Float64(y - z)) / Float64(t - z)) end
function tmp = code(x, y, z, t) tmp = (x * (y - z)) / (t - z); end
code[x_, y_, z_, t_] := N[(N[(x * N[(y - z), $MachinePrecision]), $MachinePrecision] / N[(t - z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot \left(y - z\right)}{t - z}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 15 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (/ (* x (- y z)) (- t z)))
double code(double x, double y, double z, double t) {
return (x * (y - z)) / (t - z);
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t)
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 - z)
end function
public static double code(double x, double y, double z, double t) {
return (x * (y - z)) / (t - z);
}
def code(x, y, z, t): return (x * (y - z)) / (t - z)
function code(x, y, z, t) return Float64(Float64(x * Float64(y - z)) / Float64(t - z)) end
function tmp = code(x, y, z, t) tmp = (x * (y - z)) / (t - z); end
code[x_, y_, z_, t_] := N[(N[(x * N[(y - z), $MachinePrecision]), $MachinePrecision] / N[(t - z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot \left(y - z\right)}{t - z}
\end{array}
(FPCore (x y z t) :precision binary64 (* (/ (- y z) (- t z)) x))
double code(double x, double y, double z, double t) {
return ((y - z) / (t - 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 = ((y - z) / (t - z)) * x
end function
public static double code(double x, double y, double z, double t) {
return ((y - z) / (t - z)) * x;
}
def code(x, y, z, t): return ((y - z) / (t - z)) * x
function code(x, y, z, t) return Float64(Float64(Float64(y - z) / Float64(t - z)) * x) end
function tmp = code(x, y, z, t) tmp = ((y - z) / (t - z)) * x; end
code[x_, y_, z_, t_] := N[(N[(N[(y - z), $MachinePrecision] / N[(t - z), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]
\begin{array}{l}
\\
\frac{y - z}{t - z} \cdot x
\end{array}
Initial program 84.7%
Applied rewrites97.2%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ (* x (- y z)) (- t z))))
(if (<= t_1 -5e+92)
(* (/ x (- t z)) y)
(if (<= t_1 -2e-308)
(/ (* (- y z) x) t)
(if (<= t_1 1.0) (* (/ z (- t z)) (- x)) (fma x (/ (- t y) z) x))))))
double code(double x, double y, double z, double t) {
double t_1 = (x * (y - z)) / (t - z);
double tmp;
if (t_1 <= -5e+92) {
tmp = (x / (t - z)) * y;
} else if (t_1 <= -2e-308) {
tmp = ((y - z) * x) / t;
} else if (t_1 <= 1.0) {
tmp = (z / (t - z)) * -x;
} else {
tmp = fma(x, ((t - y) / z), x);
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(Float64(x * Float64(y - z)) / Float64(t - z)) tmp = 0.0 if (t_1 <= -5e+92) tmp = Float64(Float64(x / Float64(t - z)) * y); elseif (t_1 <= -2e-308) tmp = Float64(Float64(Float64(y - z) * x) / t); elseif (t_1 <= 1.0) tmp = Float64(Float64(z / Float64(t - z)) * Float64(-x)); else tmp = fma(x, Float64(Float64(t - y) / z), x); end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x * N[(y - z), $MachinePrecision]), $MachinePrecision] / N[(t - z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -5e+92], N[(N[(x / N[(t - z), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[t$95$1, -2e-308], N[(N[(N[(y - z), $MachinePrecision] * x), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[t$95$1, 1.0], N[(N[(z / N[(t - z), $MachinePrecision]), $MachinePrecision] * (-x)), $MachinePrecision], N[(x * N[(N[(t - y), $MachinePrecision] / z), $MachinePrecision] + x), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x \cdot \left(y - z\right)}{t - z}\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+92}:\\
\;\;\;\;\frac{x}{t - z} \cdot y\\
\mathbf{elif}\;t\_1 \leq -2 \cdot 10^{-308}:\\
\;\;\;\;\frac{\left(y - z\right) \cdot x}{t}\\
\mathbf{elif}\;t\_1 \leq 1:\\
\;\;\;\;\frac{z}{t - z} \cdot \left(-x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x, \frac{t - y}{z}, x\right)\\
\end{array}
\end{array}
if (/.f64 (*.f64 x (-.f64 y z)) (-.f64 t z)) < -5.00000000000000022e92Initial program 65.4%
Taylor expanded in y around inf
associate-*l/N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6456.9
Applied rewrites56.9%
if -5.00000000000000022e92 < (/.f64 (*.f64 x (-.f64 y z)) (-.f64 t z)) < -1.9999999999999998e-308Initial program 99.6%
Applied rewrites97.1%
Taylor expanded in t around inf
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f6456.2
Applied rewrites56.2%
if -1.9999999999999998e-308 < (/.f64 (*.f64 x (-.f64 y z)) (-.f64 t z)) < 1Initial program 92.4%
Taylor expanded in y around 0
mul-1-negN/A
associate-/l*N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
mul-1-negN/A
lower-neg.f6474.8
Applied rewrites74.8%
if 1 < (/.f64 (*.f64 x (-.f64 y z)) (-.f64 t z)) Initial program 69.7%
Taylor expanded in t around 0
mul-1-negN/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
distribute-neg-fracN/A
lower-/.f64N/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
distribute-neg-inN/A
mul-1-negN/A
remove-double-negN/A
mul-1-negN/A
metadata-evalN/A
fp-cancel-sub-sign-invN/A
*-lft-identityN/A
lower--.f6475.0
Applied rewrites75.0%
Taylor expanded in y around 0
Applied rewrites33.5%
Taylor expanded in z around inf
Applied rewrites75.7%
Final simplification65.9%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ (* x (- y z)) (- t z))))
(if (<= t_1 -2e+77)
(* (/ x (- t z)) y)
(if (<= t_1 0.0)
(* (/ (- y z) t) x)
(if (<= t_1 5e-48) (* 1.0 x) (* (/ x z) (- z y)))))))
double code(double x, double y, double z, double t) {
double t_1 = (x * (y - z)) / (t - z);
double tmp;
if (t_1 <= -2e+77) {
tmp = (x / (t - z)) * y;
} else if (t_1 <= 0.0) {
tmp = ((y - z) / t) * x;
} else if (t_1 <= 5e-48) {
tmp = 1.0 * x;
} else {
tmp = (x / z) * (z - y);
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t)
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 - z)) / (t - z)
if (t_1 <= (-2d+77)) then
tmp = (x / (t - z)) * y
else if (t_1 <= 0.0d0) then
tmp = ((y - z) / t) * x
else if (t_1 <= 5d-48) then
tmp = 1.0d0 * x
else
tmp = (x / z) * (z - y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (x * (y - z)) / (t - z);
double tmp;
if (t_1 <= -2e+77) {
tmp = (x / (t - z)) * y;
} else if (t_1 <= 0.0) {
tmp = ((y - z) / t) * x;
} else if (t_1 <= 5e-48) {
tmp = 1.0 * x;
} else {
tmp = (x / z) * (z - y);
}
return tmp;
}
def code(x, y, z, t): t_1 = (x * (y - z)) / (t - z) tmp = 0 if t_1 <= -2e+77: tmp = (x / (t - z)) * y elif t_1 <= 0.0: tmp = ((y - z) / t) * x elif t_1 <= 5e-48: tmp = 1.0 * x else: tmp = (x / z) * (z - y) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x * Float64(y - z)) / Float64(t - z)) tmp = 0.0 if (t_1 <= -2e+77) tmp = Float64(Float64(x / Float64(t - z)) * y); elseif (t_1 <= 0.0) tmp = Float64(Float64(Float64(y - z) / t) * x); elseif (t_1 <= 5e-48) tmp = Float64(1.0 * x); else tmp = Float64(Float64(x / z) * Float64(z - y)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x * (y - z)) / (t - z); tmp = 0.0; if (t_1 <= -2e+77) tmp = (x / (t - z)) * y; elseif (t_1 <= 0.0) tmp = ((y - z) / t) * x; elseif (t_1 <= 5e-48) tmp = 1.0 * x; else tmp = (x / z) * (z - y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x * N[(y - z), $MachinePrecision]), $MachinePrecision] / N[(t - z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -2e+77], N[(N[(x / N[(t - z), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[t$95$1, 0.0], N[(N[(N[(y - z), $MachinePrecision] / t), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[t$95$1, 5e-48], N[(1.0 * x), $MachinePrecision], N[(N[(x / z), $MachinePrecision] * N[(z - y), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x \cdot \left(y - z\right)}{t - z}\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{+77}:\\
\;\;\;\;\frac{x}{t - z} \cdot y\\
\mathbf{elif}\;t\_1 \leq 0:\\
\;\;\;\;\frac{y - z}{t} \cdot x\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{-48}:\\
\;\;\;\;1 \cdot x\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z} \cdot \left(z - y\right)\\
\end{array}
\end{array}
if (/.f64 (*.f64 x (-.f64 y z)) (-.f64 t z)) < -1.99999999999999997e77Initial program 67.3%
Taylor expanded in y around inf
associate-*l/N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6459.4
Applied rewrites59.4%
if -1.99999999999999997e77 < (/.f64 (*.f64 x (-.f64 y z)) (-.f64 t z)) < 0.0Initial program 94.2%
Taylor expanded in t around inf
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6461.5
Applied rewrites61.5%
if 0.0 < (/.f64 (*.f64 x (-.f64 y z)) (-.f64 t z)) < 4.9999999999999999e-48Initial program 99.4%
Taylor expanded in t around 0
mul-1-negN/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
distribute-neg-fracN/A
lower-/.f64N/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
distribute-neg-inN/A
mul-1-negN/A
remove-double-negN/A
mul-1-negN/A
metadata-evalN/A
fp-cancel-sub-sign-invN/A
*-lft-identityN/A
lower--.f6450.8
Applied rewrites50.8%
Taylor expanded in y around 0
Applied rewrites45.0%
if 4.9999999999999999e-48 < (/.f64 (*.f64 x (-.f64 y z)) (-.f64 t z)) Initial program 73.2%
Taylor expanded in t around 0
mul-1-negN/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
distribute-neg-fracN/A
lower-/.f64N/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
distribute-neg-inN/A
mul-1-negN/A
remove-double-negN/A
mul-1-negN/A
metadata-evalN/A
fp-cancel-sub-sign-invN/A
*-lft-identityN/A
lower--.f6473.1
Applied rewrites73.1%
Applied rewrites74.5%
Final simplification61.2%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ (* x (- y z)) (- t z))))
(if (<= t_1 -5e+92)
(* (/ x (- t z)) y)
(if (<= t_1 0.0)
(/ (* (- y z) x) t)
(if (<= t_1 5e-48) (* 1.0 x) (* (/ x z) (- z y)))))))
double code(double x, double y, double z, double t) {
double t_1 = (x * (y - z)) / (t - z);
double tmp;
if (t_1 <= -5e+92) {
tmp = (x / (t - z)) * y;
} else if (t_1 <= 0.0) {
tmp = ((y - z) * x) / t;
} else if (t_1 <= 5e-48) {
tmp = 1.0 * x;
} else {
tmp = (x / z) * (z - y);
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t)
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 - z)) / (t - z)
if (t_1 <= (-5d+92)) then
tmp = (x / (t - z)) * y
else if (t_1 <= 0.0d0) then
tmp = ((y - z) * x) / t
else if (t_1 <= 5d-48) then
tmp = 1.0d0 * x
else
tmp = (x / z) * (z - y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (x * (y - z)) / (t - z);
double tmp;
if (t_1 <= -5e+92) {
tmp = (x / (t - z)) * y;
} else if (t_1 <= 0.0) {
tmp = ((y - z) * x) / t;
} else if (t_1 <= 5e-48) {
tmp = 1.0 * x;
} else {
tmp = (x / z) * (z - y);
}
return tmp;
}
def code(x, y, z, t): t_1 = (x * (y - z)) / (t - z) tmp = 0 if t_1 <= -5e+92: tmp = (x / (t - z)) * y elif t_1 <= 0.0: tmp = ((y - z) * x) / t elif t_1 <= 5e-48: tmp = 1.0 * x else: tmp = (x / z) * (z - y) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x * Float64(y - z)) / Float64(t - z)) tmp = 0.0 if (t_1 <= -5e+92) tmp = Float64(Float64(x / Float64(t - z)) * y); elseif (t_1 <= 0.0) tmp = Float64(Float64(Float64(y - z) * x) / t); elseif (t_1 <= 5e-48) tmp = Float64(1.0 * x); else tmp = Float64(Float64(x / z) * Float64(z - y)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x * (y - z)) / (t - z); tmp = 0.0; if (t_1 <= -5e+92) tmp = (x / (t - z)) * y; elseif (t_1 <= 0.0) tmp = ((y - z) * x) / t; elseif (t_1 <= 5e-48) tmp = 1.0 * x; else tmp = (x / z) * (z - y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x * N[(y - z), $MachinePrecision]), $MachinePrecision] / N[(t - z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -5e+92], N[(N[(x / N[(t - z), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[t$95$1, 0.0], N[(N[(N[(y - z), $MachinePrecision] * x), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[t$95$1, 5e-48], N[(1.0 * x), $MachinePrecision], N[(N[(x / z), $MachinePrecision] * N[(z - y), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x \cdot \left(y - z\right)}{t - z}\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+92}:\\
\;\;\;\;\frac{x}{t - z} \cdot y\\
\mathbf{elif}\;t\_1 \leq 0:\\
\;\;\;\;\frac{\left(y - z\right) \cdot x}{t}\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{-48}:\\
\;\;\;\;1 \cdot x\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z} \cdot \left(z - y\right)\\
\end{array}
\end{array}
if (/.f64 (*.f64 x (-.f64 y z)) (-.f64 t z)) < -5.00000000000000022e92Initial program 65.4%
Taylor expanded in y around inf
associate-*l/N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6456.9
Applied rewrites56.9%
if -5.00000000000000022e92 < (/.f64 (*.f64 x (-.f64 y z)) (-.f64 t z)) < 0.0Initial program 94.3%
Applied rewrites97.8%
Taylor expanded in t around inf
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f6461.1
Applied rewrites61.1%
if 0.0 < (/.f64 (*.f64 x (-.f64 y z)) (-.f64 t z)) < 4.9999999999999999e-48Initial program 99.4%
Taylor expanded in t around 0
mul-1-negN/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
distribute-neg-fracN/A
lower-/.f64N/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
distribute-neg-inN/A
mul-1-negN/A
remove-double-negN/A
mul-1-negN/A
metadata-evalN/A
fp-cancel-sub-sign-invN/A
*-lft-identityN/A
lower--.f6450.8
Applied rewrites50.8%
Taylor expanded in y around 0
Applied rewrites45.0%
if 4.9999999999999999e-48 < (/.f64 (*.f64 x (-.f64 y z)) (-.f64 t z)) Initial program 73.2%
Taylor expanded in t around 0
mul-1-negN/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
distribute-neg-fracN/A
lower-/.f64N/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
distribute-neg-inN/A
mul-1-negN/A
remove-double-negN/A
mul-1-negN/A
metadata-evalN/A
fp-cancel-sub-sign-invN/A
*-lft-identityN/A
lower--.f6473.1
Applied rewrites73.1%
Applied rewrites74.5%
Final simplification60.6%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ (* x (- y z)) (- t z))) (t_2 (* (/ x z) (- z y))))
(if (<= t_1 -1e+114)
t_2
(if (<= t_1 0.0) (/ (* (- y z) x) t) (if (<= t_1 5e-48) (* 1.0 x) t_2)))))
double code(double x, double y, double z, double t) {
double t_1 = (x * (y - z)) / (t - z);
double t_2 = (x / z) * (z - y);
double tmp;
if (t_1 <= -1e+114) {
tmp = t_2;
} else if (t_1 <= 0.0) {
tmp = ((y - z) * x) / t;
} else if (t_1 <= 5e-48) {
tmp = 1.0 * x;
} 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)
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 * (y - z)) / (t - z)
t_2 = (x / z) * (z - y)
if (t_1 <= (-1d+114)) then
tmp = t_2
else if (t_1 <= 0.0d0) then
tmp = ((y - z) * x) / t
else if (t_1 <= 5d-48) then
tmp = 1.0d0 * x
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (x * (y - z)) / (t - z);
double t_2 = (x / z) * (z - y);
double tmp;
if (t_1 <= -1e+114) {
tmp = t_2;
} else if (t_1 <= 0.0) {
tmp = ((y - z) * x) / t;
} else if (t_1 <= 5e-48) {
tmp = 1.0 * x;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x * (y - z)) / (t - z) t_2 = (x / z) * (z - y) tmp = 0 if t_1 <= -1e+114: tmp = t_2 elif t_1 <= 0.0: tmp = ((y - z) * x) / t elif t_1 <= 5e-48: tmp = 1.0 * x else: tmp = t_2 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x * Float64(y - z)) / Float64(t - z)) t_2 = Float64(Float64(x / z) * Float64(z - y)) tmp = 0.0 if (t_1 <= -1e+114) tmp = t_2; elseif (t_1 <= 0.0) tmp = Float64(Float64(Float64(y - z) * x) / t); elseif (t_1 <= 5e-48) tmp = Float64(1.0 * x); else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x * (y - z)) / (t - z); t_2 = (x / z) * (z - y); tmp = 0.0; if (t_1 <= -1e+114) tmp = t_2; elseif (t_1 <= 0.0) tmp = ((y - z) * x) / t; elseif (t_1 <= 5e-48) tmp = 1.0 * x; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x * N[(y - z), $MachinePrecision]), $MachinePrecision] / N[(t - z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x / z), $MachinePrecision] * N[(z - y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -1e+114], t$95$2, If[LessEqual[t$95$1, 0.0], N[(N[(N[(y - z), $MachinePrecision] * x), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[t$95$1, 5e-48], N[(1.0 * x), $MachinePrecision], t$95$2]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x \cdot \left(y - z\right)}{t - z}\\
t_2 := \frac{x}{z} \cdot \left(z - y\right)\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{+114}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 0:\\
\;\;\;\;\frac{\left(y - z\right) \cdot x}{t}\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{-48}:\\
\;\;\;\;1 \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (/.f64 (*.f64 x (-.f64 y z)) (-.f64 t z)) < -1e114 or 4.9999999999999999e-48 < (/.f64 (*.f64 x (-.f64 y z)) (-.f64 t z)) Initial program 67.9%
Taylor expanded in t around 0
mul-1-negN/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
distribute-neg-fracN/A
lower-/.f64N/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
distribute-neg-inN/A
mul-1-negN/A
remove-double-negN/A
mul-1-negN/A
metadata-evalN/A
fp-cancel-sub-sign-invN/A
*-lft-identityN/A
lower--.f6475.6
Applied rewrites75.6%
Applied rewrites77.3%
if -1e114 < (/.f64 (*.f64 x (-.f64 y z)) (-.f64 t z)) < 0.0Initial program 94.6%
Applied rewrites97.9%
Taylor expanded in t around inf
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f6461.5
Applied rewrites61.5%
if 0.0 < (/.f64 (*.f64 x (-.f64 y z)) (-.f64 t z)) < 4.9999999999999999e-48Initial program 99.4%
Taylor expanded in t around 0
mul-1-negN/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
distribute-neg-fracN/A
lower-/.f64N/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
distribute-neg-inN/A
mul-1-negN/A
remove-double-negN/A
mul-1-negN/A
metadata-evalN/A
fp-cancel-sub-sign-invN/A
*-lft-identityN/A
lower--.f6450.8
Applied rewrites50.8%
Taylor expanded in y around 0
Applied rewrites45.0%
Final simplification65.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ (* x (- y z)) (- t z))))
(if (<= t_1 -2e+77)
(* (/ x (- t z)) y)
(if (<= t_1 0.0) (* (/ (- y z) t) x) (* (/ (- z y) z) x)))))
double code(double x, double y, double z, double t) {
double t_1 = (x * (y - z)) / (t - z);
double tmp;
if (t_1 <= -2e+77) {
tmp = (x / (t - z)) * y;
} else if (t_1 <= 0.0) {
tmp = ((y - z) / t) * x;
} else {
tmp = ((z - y) / 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 - z)) / (t - z)
if (t_1 <= (-2d+77)) then
tmp = (x / (t - z)) * y
else if (t_1 <= 0.0d0) then
tmp = ((y - z) / t) * x
else
tmp = ((z - y) / 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 - z)) / (t - z);
double tmp;
if (t_1 <= -2e+77) {
tmp = (x / (t - z)) * y;
} else if (t_1 <= 0.0) {
tmp = ((y - z) / t) * x;
} else {
tmp = ((z - y) / z) * x;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x * (y - z)) / (t - z) tmp = 0 if t_1 <= -2e+77: tmp = (x / (t - z)) * y elif t_1 <= 0.0: tmp = ((y - z) / t) * x else: tmp = ((z - y) / z) * x return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x * Float64(y - z)) / Float64(t - z)) tmp = 0.0 if (t_1 <= -2e+77) tmp = Float64(Float64(x / Float64(t - z)) * y); elseif (t_1 <= 0.0) tmp = Float64(Float64(Float64(y - z) / t) * x); else tmp = Float64(Float64(Float64(z - y) / z) * x); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x * (y - z)) / (t - z); tmp = 0.0; if (t_1 <= -2e+77) tmp = (x / (t - z)) * y; elseif (t_1 <= 0.0) tmp = ((y - z) / t) * x; else tmp = ((z - y) / z) * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x * N[(y - z), $MachinePrecision]), $MachinePrecision] / N[(t - z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -2e+77], N[(N[(x / N[(t - z), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[t$95$1, 0.0], N[(N[(N[(y - z), $MachinePrecision] / t), $MachinePrecision] * x), $MachinePrecision], N[(N[(N[(z - y), $MachinePrecision] / z), $MachinePrecision] * x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x \cdot \left(y - z\right)}{t - z}\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{+77}:\\
\;\;\;\;\frac{x}{t - z} \cdot y\\
\mathbf{elif}\;t\_1 \leq 0:\\
\;\;\;\;\frac{y - z}{t} \cdot x\\
\mathbf{else}:\\
\;\;\;\;\frac{z - y}{z} \cdot x\\
\end{array}
\end{array}
if (/.f64 (*.f64 x (-.f64 y z)) (-.f64 t z)) < -1.99999999999999997e77Initial program 67.3%
Taylor expanded in y around inf
associate-*l/N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6459.4
Applied rewrites59.4%
if -1.99999999999999997e77 < (/.f64 (*.f64 x (-.f64 y z)) (-.f64 t z)) < 0.0Initial program 94.2%
Taylor expanded in t around inf
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6461.5
Applied rewrites61.5%
if 0.0 < (/.f64 (*.f64 x (-.f64 y z)) (-.f64 t z)) Initial program 84.4%
Taylor expanded in t around 0
mul-1-negN/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
distribute-neg-fracN/A
lower-/.f64N/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
distribute-neg-inN/A
mul-1-negN/A
remove-double-negN/A
mul-1-negN/A
metadata-evalN/A
fp-cancel-sub-sign-invN/A
*-lft-identityN/A
lower--.f6463.5
Applied rewrites63.5%
Final simplification61.9%
(FPCore (x y z t)
:precision binary64
(if (<= z -4.4e+104)
(* 1.0 x)
(if (<= z -1.6e+68)
(* (/ (- y) z) x)
(if (<= z -1.12e-16)
(/ (* (- z) x) t)
(if (<= z 3.8e-15) (/ (* y x) t) (* 1.0 x))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -4.4e+104) {
tmp = 1.0 * x;
} else if (z <= -1.6e+68) {
tmp = (-y / z) * x;
} else if (z <= -1.12e-16) {
tmp = (-z * x) / t;
} else if (z <= 3.8e-15) {
tmp = (y * x) / t;
} else {
tmp = 1.0 * 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 <= (-4.4d+104)) then
tmp = 1.0d0 * x
else if (z <= (-1.6d+68)) then
tmp = (-y / z) * x
else if (z <= (-1.12d-16)) then
tmp = (-z * x) / t
else if (z <= 3.8d-15) then
tmp = (y * x) / t
else
tmp = 1.0d0 * x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -4.4e+104) {
tmp = 1.0 * x;
} else if (z <= -1.6e+68) {
tmp = (-y / z) * x;
} else if (z <= -1.12e-16) {
tmp = (-z * x) / t;
} else if (z <= 3.8e-15) {
tmp = (y * x) / t;
} else {
tmp = 1.0 * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -4.4e+104: tmp = 1.0 * x elif z <= -1.6e+68: tmp = (-y / z) * x elif z <= -1.12e-16: tmp = (-z * x) / t elif z <= 3.8e-15: tmp = (y * x) / t else: tmp = 1.0 * x return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -4.4e+104) tmp = Float64(1.0 * x); elseif (z <= -1.6e+68) tmp = Float64(Float64(Float64(-y) / z) * x); elseif (z <= -1.12e-16) tmp = Float64(Float64(Float64(-z) * x) / t); elseif (z <= 3.8e-15) tmp = Float64(Float64(y * x) / t); else tmp = Float64(1.0 * x); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -4.4e+104) tmp = 1.0 * x; elseif (z <= -1.6e+68) tmp = (-y / z) * x; elseif (z <= -1.12e-16) tmp = (-z * x) / t; elseif (z <= 3.8e-15) tmp = (y * x) / t; else tmp = 1.0 * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -4.4e+104], N[(1.0 * x), $MachinePrecision], If[LessEqual[z, -1.6e+68], N[(N[((-y) / z), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[z, -1.12e-16], N[(N[((-z) * x), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[z, 3.8e-15], N[(N[(y * x), $MachinePrecision] / t), $MachinePrecision], N[(1.0 * x), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.4 \cdot 10^{+104}:\\
\;\;\;\;1 \cdot x\\
\mathbf{elif}\;z \leq -1.6 \cdot 10^{+68}:\\
\;\;\;\;\frac{-y}{z} \cdot x\\
\mathbf{elif}\;z \leq -1.12 \cdot 10^{-16}:\\
\;\;\;\;\frac{\left(-z\right) \cdot x}{t}\\
\mathbf{elif}\;z \leq 3.8 \cdot 10^{-15}:\\
\;\;\;\;\frac{y \cdot x}{t}\\
\mathbf{else}:\\
\;\;\;\;1 \cdot x\\
\end{array}
\end{array}
if z < -4.40000000000000001e104 or 3.8000000000000002e-15 < z Initial program 70.0%
Taylor expanded in t around 0
mul-1-negN/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
distribute-neg-fracN/A
lower-/.f64N/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
distribute-neg-inN/A
mul-1-negN/A
remove-double-negN/A
mul-1-negN/A
metadata-evalN/A
fp-cancel-sub-sign-invN/A
*-lft-identityN/A
lower--.f6484.4
Applied rewrites84.4%
Taylor expanded in y around 0
Applied rewrites67.2%
if -4.40000000000000001e104 < z < -1.59999999999999997e68Initial program 91.2%
Taylor expanded in t around 0
mul-1-negN/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
distribute-neg-fracN/A
lower-/.f64N/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
distribute-neg-inN/A
mul-1-negN/A
remove-double-negN/A
mul-1-negN/A
metadata-evalN/A
fp-cancel-sub-sign-invN/A
*-lft-identityN/A
lower--.f6482.2
Applied rewrites82.2%
Taylor expanded in y around inf
Applied rewrites65.1%
if -1.59999999999999997e68 < z < -1.12e-16Initial program 95.0%
Applied rewrites99.5%
Taylor expanded in t around inf
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f6471.0
Applied rewrites71.0%
Taylor expanded in y around 0
Applied rewrites53.2%
if -1.12e-16 < z < 3.8000000000000002e-15Initial program 95.1%
Taylor expanded in z around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f6460.4
Applied rewrites60.4%
Final simplification62.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (fma x (/ (- t y) z) x)))
(if (<= z -7e+60)
t_1
(if (<= z -2.1e-30)
(/ (* (- y z) x) t)
(if (<= z 1.4e-28) (/ (* y x) (- t z)) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = fma(x, ((t - y) / z), x);
double tmp;
if (z <= -7e+60) {
tmp = t_1;
} else if (z <= -2.1e-30) {
tmp = ((y - z) * x) / t;
} else if (z <= 1.4e-28) {
tmp = (y * x) / (t - z);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = fma(x, Float64(Float64(t - y) / z), x) tmp = 0.0 if (z <= -7e+60) tmp = t_1; elseif (z <= -2.1e-30) tmp = Float64(Float64(Float64(y - z) * x) / t); elseif (z <= 1.4e-28) tmp = Float64(Float64(y * x) / Float64(t - z)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(N[(t - y), $MachinePrecision] / z), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[z, -7e+60], t$95$1, If[LessEqual[z, -2.1e-30], N[(N[(N[(y - z), $MachinePrecision] * x), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[z, 1.4e-28], N[(N[(y * x), $MachinePrecision] / N[(t - z), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(x, \frac{t - y}{z}, x\right)\\
\mathbf{if}\;z \leq -7 \cdot 10^{+60}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -2.1 \cdot 10^{-30}:\\
\;\;\;\;\frac{\left(y - z\right) \cdot x}{t}\\
\mathbf{elif}\;z \leq 1.4 \cdot 10^{-28}:\\
\;\;\;\;\frac{y \cdot x}{t - z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -7.0000000000000004e60 or 1.3999999999999999e-28 < z Initial program 72.2%
Taylor expanded in t around 0
mul-1-negN/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
distribute-neg-fracN/A
lower-/.f64N/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
distribute-neg-inN/A
mul-1-negN/A
remove-double-negN/A
mul-1-negN/A
metadata-evalN/A
fp-cancel-sub-sign-invN/A
*-lft-identityN/A
lower--.f6484.7
Applied rewrites84.7%
Taylor expanded in y around 0
Applied rewrites62.3%
Taylor expanded in z around inf
Applied rewrites85.2%
if -7.0000000000000004e60 < z < -2.1000000000000002e-30Initial program 99.5%
Applied rewrites99.5%
Taylor expanded in t around inf
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f6471.7
Applied rewrites71.7%
if -2.1000000000000002e-30 < z < 1.3999999999999999e-28Initial program 94.8%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f6478.2
Applied rewrites78.2%
Final simplification80.9%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (/ (- z y) z) x)))
(if (<= z -7e+60)
t_1
(if (<= z -2.1e-30)
(/ (* (- y z) x) t)
(if (<= z 1.4e-28) (/ (* y x) (- t z)) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = ((z - y) / z) * x;
double tmp;
if (z <= -7e+60) {
tmp = t_1;
} else if (z <= -2.1e-30) {
tmp = ((y - z) * x) / t;
} else if (z <= 1.4e-28) {
tmp = (y * x) / (t - z);
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t)
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 = ((z - y) / z) * x
if (z <= (-7d+60)) then
tmp = t_1
else if (z <= (-2.1d-30)) then
tmp = ((y - z) * x) / t
else if (z <= 1.4d-28) then
tmp = (y * x) / (t - z)
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 = ((z - y) / z) * x;
double tmp;
if (z <= -7e+60) {
tmp = t_1;
} else if (z <= -2.1e-30) {
tmp = ((y - z) * x) / t;
} else if (z <= 1.4e-28) {
tmp = (y * x) / (t - z);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = ((z - y) / z) * x tmp = 0 if z <= -7e+60: tmp = t_1 elif z <= -2.1e-30: tmp = ((y - z) * x) / t elif z <= 1.4e-28: tmp = (y * x) / (t - z) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(Float64(z - y) / z) * x) tmp = 0.0 if (z <= -7e+60) tmp = t_1; elseif (z <= -2.1e-30) tmp = Float64(Float64(Float64(y - z) * x) / t); elseif (z <= 1.4e-28) tmp = Float64(Float64(y * x) / Float64(t - z)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = ((z - y) / z) * x; tmp = 0.0; if (z <= -7e+60) tmp = t_1; elseif (z <= -2.1e-30) tmp = ((y - z) * x) / t; elseif (z <= 1.4e-28) tmp = (y * x) / (t - z); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(N[(z - y), $MachinePrecision] / z), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[z, -7e+60], t$95$1, If[LessEqual[z, -2.1e-30], N[(N[(N[(y - z), $MachinePrecision] * x), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[z, 1.4e-28], N[(N[(y * x), $MachinePrecision] / N[(t - z), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z - y}{z} \cdot x\\
\mathbf{if}\;z \leq -7 \cdot 10^{+60}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -2.1 \cdot 10^{-30}:\\
\;\;\;\;\frac{\left(y - z\right) \cdot x}{t}\\
\mathbf{elif}\;z \leq 1.4 \cdot 10^{-28}:\\
\;\;\;\;\frac{y \cdot x}{t - z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -7.0000000000000004e60 or 1.3999999999999999e-28 < z Initial program 72.2%
Taylor expanded in t around 0
mul-1-negN/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
distribute-neg-fracN/A
lower-/.f64N/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
distribute-neg-inN/A
mul-1-negN/A
remove-double-negN/A
mul-1-negN/A
metadata-evalN/A
fp-cancel-sub-sign-invN/A
*-lft-identityN/A
lower--.f6484.7
Applied rewrites84.7%
if -7.0000000000000004e60 < z < -2.1000000000000002e-30Initial program 99.5%
Applied rewrites99.5%
Taylor expanded in t around inf
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f6471.7
Applied rewrites71.7%
if -2.1000000000000002e-30 < z < 1.3999999999999999e-28Initial program 94.8%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f6478.2
Applied rewrites78.2%
Final simplification80.6%
(FPCore (x y z t)
:precision binary64
(if (<= z -3.5e+87)
(* 1.0 x)
(if (<= z -1.12e-16)
(/ (* (- z) x) t)
(if (<= z 3.8e-15) (/ (* y x) t) (* 1.0 x)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -3.5e+87) {
tmp = 1.0 * x;
} else if (z <= -1.12e-16) {
tmp = (-z * x) / t;
} else if (z <= 3.8e-15) {
tmp = (y * x) / t;
} else {
tmp = 1.0 * 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 <= (-3.5d+87)) then
tmp = 1.0d0 * x
else if (z <= (-1.12d-16)) then
tmp = (-z * x) / t
else if (z <= 3.8d-15) then
tmp = (y * x) / t
else
tmp = 1.0d0 * x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -3.5e+87) {
tmp = 1.0 * x;
} else if (z <= -1.12e-16) {
tmp = (-z * x) / t;
} else if (z <= 3.8e-15) {
tmp = (y * x) / t;
} else {
tmp = 1.0 * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -3.5e+87: tmp = 1.0 * x elif z <= -1.12e-16: tmp = (-z * x) / t elif z <= 3.8e-15: tmp = (y * x) / t else: tmp = 1.0 * x return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -3.5e+87) tmp = Float64(1.0 * x); elseif (z <= -1.12e-16) tmp = Float64(Float64(Float64(-z) * x) / t); elseif (z <= 3.8e-15) tmp = Float64(Float64(y * x) / t); else tmp = Float64(1.0 * x); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -3.5e+87) tmp = 1.0 * x; elseif (z <= -1.12e-16) tmp = (-z * x) / t; elseif (z <= 3.8e-15) tmp = (y * x) / t; else tmp = 1.0 * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -3.5e+87], N[(1.0 * x), $MachinePrecision], If[LessEqual[z, -1.12e-16], N[(N[((-z) * x), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[z, 3.8e-15], N[(N[(y * x), $MachinePrecision] / t), $MachinePrecision], N[(1.0 * x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.5 \cdot 10^{+87}:\\
\;\;\;\;1 \cdot x\\
\mathbf{elif}\;z \leq -1.12 \cdot 10^{-16}:\\
\;\;\;\;\frac{\left(-z\right) \cdot x}{t}\\
\mathbf{elif}\;z \leq 3.8 \cdot 10^{-15}:\\
\;\;\;\;\frac{y \cdot x}{t}\\
\mathbf{else}:\\
\;\;\;\;1 \cdot x\\
\end{array}
\end{array}
if z < -3.49999999999999986e87 or 3.8000000000000002e-15 < z Initial program 71.1%
Taylor expanded in t around 0
mul-1-negN/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
distribute-neg-fracN/A
lower-/.f64N/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
distribute-neg-inN/A
mul-1-negN/A
remove-double-negN/A
mul-1-negN/A
metadata-evalN/A
fp-cancel-sub-sign-invN/A
*-lft-identityN/A
lower--.f6484.9
Applied rewrites84.9%
Taylor expanded in y around 0
Applied rewrites66.6%
if -3.49999999999999986e87 < z < -1.12e-16Initial program 92.8%
Applied rewrites99.6%
Taylor expanded in t around inf
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f6462.1
Applied rewrites62.1%
Taylor expanded in y around 0
Applied rewrites43.6%
if -1.12e-16 < z < 3.8000000000000002e-15Initial program 95.1%
Taylor expanded in z around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f6460.4
Applied rewrites60.4%
Final simplification61.2%
(FPCore (x y z t) :precision binary64 (if (<= z -2.9e+98) (- x (* (/ x z) (- y t))) (if (<= z 3.3e+151) (* (/ x (- t z)) (- y z)) (fma x (/ (- t y) z) x))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -2.9e+98) {
tmp = x - ((x / z) * (y - t));
} else if (z <= 3.3e+151) {
tmp = (x / (t - z)) * (y - z);
} else {
tmp = fma(x, ((t - y) / z), x);
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (z <= -2.9e+98) tmp = Float64(x - Float64(Float64(x / z) * Float64(y - t))); elseif (z <= 3.3e+151) tmp = Float64(Float64(x / Float64(t - z)) * Float64(y - z)); else tmp = fma(x, Float64(Float64(t - y) / z), x); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[z, -2.9e+98], N[(x - N[(N[(x / z), $MachinePrecision] * N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.3e+151], N[(N[(x / N[(t - z), $MachinePrecision]), $MachinePrecision] * N[(y - z), $MachinePrecision]), $MachinePrecision], N[(x * N[(N[(t - y), $MachinePrecision] / z), $MachinePrecision] + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.9 \cdot 10^{+98}:\\
\;\;\;\;x - \frac{x}{z} \cdot \left(y - t\right)\\
\mathbf{elif}\;z \leq 3.3 \cdot 10^{+151}:\\
\;\;\;\;\frac{x}{t - z} \cdot \left(y - z\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x, \frac{t - y}{z}, x\right)\\
\end{array}
\end{array}
if z < -2.9000000000000001e98Initial program 63.8%
Taylor expanded in z around inf
fp-cancel-sub-sign-invN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
metadata-evalN/A
*-lft-identityN/A
associate-+l-N/A
div-subN/A
lower--.f64N/A
div-subN/A
*-commutativeN/A
associate-/l*N/A
associate-/l*N/A
distribute-rgt-out--N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6494.1
Applied rewrites94.1%
if -2.9000000000000001e98 < z < 3.30000000000000025e151Initial program 94.5%
Applied rewrites93.7%
if 3.30000000000000025e151 < z Initial program 60.2%
Taylor expanded in t around 0
mul-1-negN/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
distribute-neg-fracN/A
lower-/.f64N/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
distribute-neg-inN/A
mul-1-negN/A
remove-double-negN/A
mul-1-negN/A
metadata-evalN/A
fp-cancel-sub-sign-invN/A
*-lft-identityN/A
lower--.f6493.4
Applied rewrites93.4%
Taylor expanded in y around 0
Applied rewrites69.3%
Taylor expanded in z around inf
Applied rewrites93.8%
Final simplification93.8%
(FPCore (x y z t) :precision binary64 (if (or (<= z -3.5e+87) (not (<= z 6.8e+143))) (* 1.0 x) (/ (* (- y z) x) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -3.5e+87) || !(z <= 6.8e+143)) {
tmp = 1.0 * x;
} else {
tmp = ((y - z) * x) / t;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t)
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 <= (-3.5d+87)) .or. (.not. (z <= 6.8d+143))) then
tmp = 1.0d0 * x
else
tmp = ((y - z) * x) / t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -3.5e+87) || !(z <= 6.8e+143)) {
tmp = 1.0 * x;
} else {
tmp = ((y - z) * x) / t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -3.5e+87) or not (z <= 6.8e+143): tmp = 1.0 * x else: tmp = ((y - z) * x) / t return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -3.5e+87) || !(z <= 6.8e+143)) tmp = Float64(1.0 * x); else tmp = Float64(Float64(Float64(y - z) * x) / t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -3.5e+87) || ~((z <= 6.8e+143))) tmp = 1.0 * x; else tmp = ((y - z) * x) / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -3.5e+87], N[Not[LessEqual[z, 6.8e+143]], $MachinePrecision]], N[(1.0 * x), $MachinePrecision], N[(N[(N[(y - z), $MachinePrecision] * x), $MachinePrecision] / t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.5 \cdot 10^{+87} \lor \neg \left(z \leq 6.8 \cdot 10^{+143}\right):\\
\;\;\;\;1 \cdot x\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(y - z\right) \cdot x}{t}\\
\end{array}
\end{array}
if z < -3.49999999999999986e87 or 6.79999999999999964e143 < z Initial program 63.1%
Taylor expanded in t around 0
mul-1-negN/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
distribute-neg-fracN/A
lower-/.f64N/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
distribute-neg-inN/A
mul-1-negN/A
remove-double-negN/A
mul-1-negN/A
metadata-evalN/A
fp-cancel-sub-sign-invN/A
*-lft-identityN/A
lower--.f6492.5
Applied rewrites92.5%
Taylor expanded in y around 0
Applied rewrites76.4%
if -3.49999999999999986e87 < z < 6.79999999999999964e143Initial program 94.9%
Applied rewrites95.9%
Taylor expanded in t around inf
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f6465.5
Applied rewrites65.5%
Final simplification69.0%
(FPCore (x y z t) :precision binary64 (if (or (<= z -6.4e-17) (not (<= z 3.8e-15))) (* 1.0 x) (/ (* y x) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -6.4e-17) || !(z <= 3.8e-15)) {
tmp = 1.0 * x;
} else {
tmp = (y * x) / t;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t)
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 <= (-6.4d-17)) .or. (.not. (z <= 3.8d-15))) then
tmp = 1.0d0 * x
else
tmp = (y * x) / t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -6.4e-17) || !(z <= 3.8e-15)) {
tmp = 1.0 * x;
} else {
tmp = (y * x) / t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -6.4e-17) or not (z <= 3.8e-15): tmp = 1.0 * x else: tmp = (y * x) / t return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -6.4e-17) || !(z <= 3.8e-15)) tmp = Float64(1.0 * x); else tmp = Float64(Float64(y * x) / t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -6.4e-17) || ~((z <= 3.8e-15))) tmp = 1.0 * x; else tmp = (y * x) / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -6.4e-17], N[Not[LessEqual[z, 3.8e-15]], $MachinePrecision]], N[(1.0 * x), $MachinePrecision], N[(N[(y * x), $MachinePrecision] / t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.4 \cdot 10^{-17} \lor \neg \left(z \leq 3.8 \cdot 10^{-15}\right):\\
\;\;\;\;1 \cdot x\\
\mathbf{else}:\\
\;\;\;\;\frac{y \cdot x}{t}\\
\end{array}
\end{array}
if z < -6.4000000000000005e-17 or 3.8000000000000002e-15 < z Initial program 75.6%
Taylor expanded in t around 0
mul-1-negN/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
distribute-neg-fracN/A
lower-/.f64N/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
distribute-neg-inN/A
mul-1-negN/A
remove-double-negN/A
mul-1-negN/A
metadata-evalN/A
fp-cancel-sub-sign-invN/A
*-lft-identityN/A
lower--.f6476.4
Applied rewrites76.4%
Taylor expanded in y around 0
Applied rewrites57.5%
if -6.4000000000000005e-17 < z < 3.8000000000000002e-15Initial program 95.1%
Taylor expanded in z around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f6460.9
Applied rewrites60.9%
Final simplification59.1%
(FPCore (x y z t) :precision binary64 (if (or (<= z -4.2e-52) (not (<= z 3.8e-15))) (* 1.0 x) (* (/ x t) y)))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -4.2e-52) || !(z <= 3.8e-15)) {
tmp = 1.0 * x;
} else {
tmp = (x / t) * y;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t)
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 <= (-4.2d-52)) .or. (.not. (z <= 3.8d-15))) then
tmp = 1.0d0 * x
else
tmp = (x / t) * y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -4.2e-52) || !(z <= 3.8e-15)) {
tmp = 1.0 * x;
} else {
tmp = (x / t) * y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -4.2e-52) or not (z <= 3.8e-15): tmp = 1.0 * x else: tmp = (x / t) * y return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -4.2e-52) || !(z <= 3.8e-15)) tmp = Float64(1.0 * x); else tmp = Float64(Float64(x / t) * y); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -4.2e-52) || ~((z <= 3.8e-15))) tmp = 1.0 * x; else tmp = (x / t) * y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -4.2e-52], N[Not[LessEqual[z, 3.8e-15]], $MachinePrecision]], N[(1.0 * x), $MachinePrecision], N[(N[(x / t), $MachinePrecision] * y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.2 \cdot 10^{-52} \lor \neg \left(z \leq 3.8 \cdot 10^{-15}\right):\\
\;\;\;\;1 \cdot x\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{t} \cdot y\\
\end{array}
\end{array}
if z < -4.1999999999999997e-52 or 3.8000000000000002e-15 < z Initial program 77.5%
Taylor expanded in t around 0
mul-1-negN/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
distribute-neg-fracN/A
lower-/.f64N/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
distribute-neg-inN/A
mul-1-negN/A
remove-double-negN/A
mul-1-negN/A
metadata-evalN/A
fp-cancel-sub-sign-invN/A
*-lft-identityN/A
lower--.f6474.3
Applied rewrites74.3%
Taylor expanded in y around 0
Applied rewrites54.5%
if -4.1999999999999997e-52 < z < 3.8000000000000002e-15Initial program 94.6%
Taylor expanded in z around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f6463.7
Applied rewrites63.7%
Applied rewrites60.0%
Final simplification56.8%
(FPCore (x y z t) :precision binary64 (* 1.0 x))
double code(double x, double y, double z, double t) {
return 1.0 * 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 = 1.0d0 * x
end function
public static double code(double x, double y, double z, double t) {
return 1.0 * x;
}
def code(x, y, z, t): return 1.0 * x
function code(x, y, z, t) return Float64(1.0 * x) end
function tmp = code(x, y, z, t) tmp = 1.0 * x; end
code[x_, y_, z_, t_] := N[(1.0 * x), $MachinePrecision]
\begin{array}{l}
\\
1 \cdot x
\end{array}
Initial program 84.7%
Taylor expanded in t around 0
mul-1-negN/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
distribute-neg-fracN/A
lower-/.f64N/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
distribute-neg-inN/A
mul-1-negN/A
remove-double-negN/A
mul-1-negN/A
metadata-evalN/A
fp-cancel-sub-sign-invN/A
*-lft-identityN/A
lower--.f6455.4
Applied rewrites55.4%
Taylor expanded in y around 0
Applied rewrites35.2%
Final simplification35.2%
(FPCore (x y z t) :precision binary64 (/ x (/ (- t z) (- y z))))
double code(double x, double y, double z, double t) {
return x / ((t - z) / (y - z));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t)
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 / ((t - z) / (y - z))
end function
public static double code(double x, double y, double z, double t) {
return x / ((t - z) / (y - z));
}
def code(x, y, z, t): return x / ((t - z) / (y - z))
function code(x, y, z, t) return Float64(x / Float64(Float64(t - z) / Float64(y - z))) end
function tmp = code(x, y, z, t) tmp = x / ((t - z) / (y - z)); end
code[x_, y_, z_, t_] := N[(x / N[(N[(t - z), $MachinePrecision] / N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{\frac{t - z}{y - z}}
\end{array}
herbie shell --seed 2025017
(FPCore (x y z t)
:name "Graphics.Rendering.Chart.Plot.AreaSpots:renderAreaSpots4D from Chart-1.5.3"
:precision binary64
:alt
(! :herbie-platform default (/ x (/ (- t z) (- y z))))
(/ (* x (- y z)) (- t z)))