
(FPCore (x y z t) :precision binary64 (- 1.0 (/ x (* (- y z) (- y t)))))
double code(double x, double y, double z, double t) {
return 1.0 - (x / ((y - z) * (y - t)));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t)
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 / ((y - z) * (y - t)))
end function
public static double code(double x, double y, double z, double t) {
return 1.0 - (x / ((y - z) * (y - t)));
}
def code(x, y, z, t): return 1.0 - (x / ((y - z) * (y - t)))
function code(x, y, z, t) return Float64(1.0 - Float64(x / Float64(Float64(y - z) * Float64(y - t)))) end
function tmp = code(x, y, z, t) tmp = 1.0 - (x / ((y - z) * (y - t))); end
code[x_, y_, z_, t_] := N[(1.0 - N[(x / N[(N[(y - z), $MachinePrecision] * N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
1 - \frac{x}{\left(y - z\right) \cdot \left(y - t\right)}
Herbie found 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (- 1.0 (/ x (* (- y z) (- y t)))))
double code(double x, double y, double z, double t) {
return 1.0 - (x / ((y - z) * (y - t)));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t)
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 / ((y - z) * (y - t)))
end function
public static double code(double x, double y, double z, double t) {
return 1.0 - (x / ((y - z) * (y - t)));
}
def code(x, y, z, t): return 1.0 - (x / ((y - z) * (y - t)))
function code(x, y, z, t) return Float64(1.0 - Float64(x / Float64(Float64(y - z) * Float64(y - t)))) end
function tmp = code(x, y, z, t) tmp = 1.0 - (x / ((y - z) * (y - t))); end
code[x_, y_, z_, t_] := N[(1.0 - N[(x / N[(N[(y - z), $MachinePrecision] * N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
1 - \frac{x}{\left(y - z\right) \cdot \left(y - t\right)}
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- y (fmax z t))) (t_2 (- y (fmin z t))))
(if (<= (fmin z t) -5e-95)
(- 1.0 (/ x (* t_2 t_1)))
(- 1.0 (/ (/ x t_1) t_2)))))double code(double x, double y, double z, double t) {
double t_1 = y - fmax(z, t);
double t_2 = y - fmin(z, t);
double tmp;
if (fmin(z, t) <= -5e-95) {
tmp = 1.0 - (x / (t_2 * t_1));
} else {
tmp = 1.0 - ((x / t_1) / 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 = y - fmax(z, t)
t_2 = y - fmin(z, t)
if (fmin(z, t) <= (-5d-95)) then
tmp = 1.0d0 - (x / (t_2 * t_1))
else
tmp = 1.0d0 - ((x / t_1) / t_2)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = y - fmax(z, t);
double t_2 = y - fmin(z, t);
double tmp;
if (fmin(z, t) <= -5e-95) {
tmp = 1.0 - (x / (t_2 * t_1));
} else {
tmp = 1.0 - ((x / t_1) / t_2);
}
return tmp;
}
def code(x, y, z, t): t_1 = y - fmax(z, t) t_2 = y - fmin(z, t) tmp = 0 if fmin(z, t) <= -5e-95: tmp = 1.0 - (x / (t_2 * t_1)) else: tmp = 1.0 - ((x / t_1) / t_2) return tmp
function code(x, y, z, t) t_1 = Float64(y - fmax(z, t)) t_2 = Float64(y - fmin(z, t)) tmp = 0.0 if (fmin(z, t) <= -5e-95) tmp = Float64(1.0 - Float64(x / Float64(t_2 * t_1))); else tmp = Float64(1.0 - Float64(Float64(x / t_1) / t_2)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = y - max(z, t); t_2 = y - min(z, t); tmp = 0.0; if (min(z, t) <= -5e-95) tmp = 1.0 - (x / (t_2 * t_1)); else tmp = 1.0 - ((x / t_1) / t_2); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y - N[Max[z, t], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(y - N[Min[z, t], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Min[z, t], $MachinePrecision], -5e-95], N[(1.0 - N[(x / N[(t$95$2 * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(N[(x / t$95$1), $MachinePrecision] / t$95$2), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
t_1 := y - \mathsf{max}\left(z, t\right)\\
t_2 := y - \mathsf{min}\left(z, t\right)\\
\mathbf{if}\;\mathsf{min}\left(z, t\right) \leq -5 \cdot 10^{-95}:\\
\;\;\;\;1 - \frac{x}{t\_2 \cdot t\_1}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{\frac{x}{t\_1}}{t\_2}\\
\end{array}
if z < -4.9999999999999998e-95Initial program 99.2%
if -4.9999999999999998e-95 < z Initial program 99.2%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6498.5
Applied rewrites98.5%
(FPCore (x y z t) :precision binary64 (- 1.0 (/ (/ x (- (fmin z t) y)) (- (fmax z t) y))))
double code(double x, double y, double z, double t) {
return 1.0 - ((x / (fmin(z, t) - y)) / (fmax(z, t) - y));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t)
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 / (fmin(z, t) - y)) / (fmax(z, t) - y))
end function
public static double code(double x, double y, double z, double t) {
return 1.0 - ((x / (fmin(z, t) - y)) / (fmax(z, t) - y));
}
def code(x, y, z, t): return 1.0 - ((x / (fmin(z, t) - y)) / (fmax(z, t) - y))
function code(x, y, z, t) return Float64(1.0 - Float64(Float64(x / Float64(fmin(z, t) - y)) / Float64(fmax(z, t) - y))) end
function tmp = code(x, y, z, t) tmp = 1.0 - ((x / (min(z, t) - y)) / (max(z, t) - y)); end
code[x_, y_, z_, t_] := N[(1.0 - N[(N[(x / N[(N[Min[z, t], $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision] / N[(N[Max[z, t], $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
1 - \frac{\frac{x}{\mathsf{min}\left(z, t\right) - y}}{\mathsf{max}\left(z, t\right) - y}
Initial program 99.2%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
frac-2negN/A
lift--.f64N/A
sub-negate-revN/A
lower-/.f64N/A
distribute-neg-frac2N/A
lift--.f64N/A
sub-negate-revN/A
lower-/.f64N/A
lower--.f64N/A
lower--.f6498.5
Applied rewrites98.5%
(FPCore (x y z t) :precision binary64 (- 1.0 (/ x (* (- y z) (- y t)))))
double code(double x, double y, double z, double t) {
return 1.0 - (x / ((y - z) * (y - t)));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t)
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 / ((y - z) * (y - t)))
end function
public static double code(double x, double y, double z, double t) {
return 1.0 - (x / ((y - z) * (y - t)));
}
def code(x, y, z, t): return 1.0 - (x / ((y - z) * (y - t)))
function code(x, y, z, t) return Float64(1.0 - Float64(x / Float64(Float64(y - z) * Float64(y - t)))) end
function tmp = code(x, y, z, t) tmp = 1.0 - (x / ((y - z) * (y - t))); end
code[x_, y_, z_, t_] := N[(1.0 - N[(x / N[(N[(y - z), $MachinePrecision] * N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
1 - \frac{x}{\left(y - z\right) \cdot \left(y - t\right)}
Initial program 99.2%
(FPCore (x y z t)
:precision binary64
(if (<= (fmin z t) -1.14e-126)
(- 1.0 (/ x (* (fmin z t) (- (fmax z t) y))))
(if (<= (fmin z t) 6.5e-206)
(fma (/ -1.0 (* (- y (fmax z t)) y)) x 1.0)
(- 1.0 (/ (/ x (fmax z t)) (- (fmin z t) y))))))double code(double x, double y, double z, double t) {
double tmp;
if (fmin(z, t) <= -1.14e-126) {
tmp = 1.0 - (x / (fmin(z, t) * (fmax(z, t) - y)));
} else if (fmin(z, t) <= 6.5e-206) {
tmp = fma((-1.0 / ((y - fmax(z, t)) * y)), x, 1.0);
} else {
tmp = 1.0 - ((x / fmax(z, t)) / (fmin(z, t) - y));
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (fmin(z, t) <= -1.14e-126) tmp = Float64(1.0 - Float64(x / Float64(fmin(z, t) * Float64(fmax(z, t) - y)))); elseif (fmin(z, t) <= 6.5e-206) tmp = fma(Float64(-1.0 / Float64(Float64(y - fmax(z, t)) * y)), x, 1.0); else tmp = Float64(1.0 - Float64(Float64(x / fmax(z, t)) / Float64(fmin(z, t) - y))); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[N[Min[z, t], $MachinePrecision], -1.14e-126], N[(1.0 - N[(x / N[(N[Min[z, t], $MachinePrecision] * N[(N[Max[z, t], $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Min[z, t], $MachinePrecision], 6.5e-206], N[(N[(-1.0 / N[(N[(y - N[Max[z, t], $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision] * x + 1.0), $MachinePrecision], N[(1.0 - N[(N[(x / N[Max[z, t], $MachinePrecision]), $MachinePrecision] / N[(N[Min[z, t], $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;\mathsf{min}\left(z, t\right) \leq -1.14 \cdot 10^{-126}:\\
\;\;\;\;1 - \frac{x}{\mathsf{min}\left(z, t\right) \cdot \left(\mathsf{max}\left(z, t\right) - y\right)}\\
\mathbf{elif}\;\mathsf{min}\left(z, t\right) \leq 6.5 \cdot 10^{-206}:\\
\;\;\;\;\mathsf{fma}\left(\frac{-1}{\left(y - \mathsf{max}\left(z, t\right)\right) \cdot y}, x, 1\right)\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{\frac{x}{\mathsf{max}\left(z, t\right)}}{\mathsf{min}\left(z, t\right) - y}\\
\end{array}
if z < -1.13999999999999993e-126Initial program 99.2%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
frac-2negN/A
lift--.f64N/A
sub-negate-revN/A
lower-/.f64N/A
distribute-neg-frac2N/A
lift--.f64N/A
sub-negate-revN/A
lower-/.f64N/A
lower--.f64N/A
lower--.f6498.5
Applied rewrites98.5%
Taylor expanded in z around inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f6479.0
Applied rewrites79.0%
if -1.13999999999999993e-126 < z < 6.4999999999999996e-206Initial program 99.2%
Taylor expanded in z around 0
lower-*.f64N/A
lower--.f6473.2
Applied rewrites73.2%
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
distribute-lft-neg-inN/A
distribute-neg-frac2N/A
lower-fma.f64N/A
Applied rewrites73.2%
if 6.4999999999999996e-206 < z Initial program 99.2%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
frac-2negN/A
lift--.f64N/A
sub-negate-revN/A
lower-/.f64N/A
distribute-neg-frac2N/A
lift--.f64N/A
sub-negate-revN/A
lower-/.f64N/A
lower--.f64N/A
lower--.f6498.5
Applied rewrites98.5%
Taylor expanded in y around 0
Applied rewrites78.0%
lift-/.f64N/A
mult-flipN/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
mult-flip-revN/A
lower-/.f6478.8
Applied rewrites78.8%
(FPCore (x y z t)
:precision binary64
(if (<= (fmin z t) -1.14e-126)
(- 1.0 (/ x (* (fmin z t) (- (fmax z t) y))))
(if (<= (fmin z t) 6.5e-206)
(- 1.0 (/ x (* y (- y (fmax z t)))))
(- 1.0 (/ (/ x (fmax z t)) (- (fmin z t) y))))))double code(double x, double y, double z, double t) {
double tmp;
if (fmin(z, t) <= -1.14e-126) {
tmp = 1.0 - (x / (fmin(z, t) * (fmax(z, t) - y)));
} else if (fmin(z, t) <= 6.5e-206) {
tmp = 1.0 - (x / (y * (y - fmax(z, t))));
} else {
tmp = 1.0 - ((x / fmax(z, t)) / (fmin(z, 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 (fmin(z, t) <= (-1.14d-126)) then
tmp = 1.0d0 - (x / (fmin(z, t) * (fmax(z, t) - y)))
else if (fmin(z, t) <= 6.5d-206) then
tmp = 1.0d0 - (x / (y * (y - fmax(z, t))))
else
tmp = 1.0d0 - ((x / fmax(z, t)) / (fmin(z, t) - y))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (fmin(z, t) <= -1.14e-126) {
tmp = 1.0 - (x / (fmin(z, t) * (fmax(z, t) - y)));
} else if (fmin(z, t) <= 6.5e-206) {
tmp = 1.0 - (x / (y * (y - fmax(z, t))));
} else {
tmp = 1.0 - ((x / fmax(z, t)) / (fmin(z, t) - y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if fmin(z, t) <= -1.14e-126: tmp = 1.0 - (x / (fmin(z, t) * (fmax(z, t) - y))) elif fmin(z, t) <= 6.5e-206: tmp = 1.0 - (x / (y * (y - fmax(z, t)))) else: tmp = 1.0 - ((x / fmax(z, t)) / (fmin(z, t) - y)) return tmp
function code(x, y, z, t) tmp = 0.0 if (fmin(z, t) <= -1.14e-126) tmp = Float64(1.0 - Float64(x / Float64(fmin(z, t) * Float64(fmax(z, t) - y)))); elseif (fmin(z, t) <= 6.5e-206) tmp = Float64(1.0 - Float64(x / Float64(y * Float64(y - fmax(z, t))))); else tmp = Float64(1.0 - Float64(Float64(x / fmax(z, t)) / Float64(fmin(z, t) - y))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (min(z, t) <= -1.14e-126) tmp = 1.0 - (x / (min(z, t) * (max(z, t) - y))); elseif (min(z, t) <= 6.5e-206) tmp = 1.0 - (x / (y * (y - max(z, t)))); else tmp = 1.0 - ((x / max(z, t)) / (min(z, t) - y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[Min[z, t], $MachinePrecision], -1.14e-126], N[(1.0 - N[(x / N[(N[Min[z, t], $MachinePrecision] * N[(N[Max[z, t], $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Min[z, t], $MachinePrecision], 6.5e-206], N[(1.0 - N[(x / N[(y * N[(y - N[Max[z, t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(N[(x / N[Max[z, t], $MachinePrecision]), $MachinePrecision] / N[(N[Min[z, t], $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;\mathsf{min}\left(z, t\right) \leq -1.14 \cdot 10^{-126}:\\
\;\;\;\;1 - \frac{x}{\mathsf{min}\left(z, t\right) \cdot \left(\mathsf{max}\left(z, t\right) - y\right)}\\
\mathbf{elif}\;\mathsf{min}\left(z, t\right) \leq 6.5 \cdot 10^{-206}:\\
\;\;\;\;1 - \frac{x}{y \cdot \left(y - \mathsf{max}\left(z, t\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{\frac{x}{\mathsf{max}\left(z, t\right)}}{\mathsf{min}\left(z, t\right) - y}\\
\end{array}
if z < -1.13999999999999993e-126Initial program 99.2%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
frac-2negN/A
lift--.f64N/A
sub-negate-revN/A
lower-/.f64N/A
distribute-neg-frac2N/A
lift--.f64N/A
sub-negate-revN/A
lower-/.f64N/A
lower--.f64N/A
lower--.f6498.5
Applied rewrites98.5%
Taylor expanded in z around inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f6479.0
Applied rewrites79.0%
if -1.13999999999999993e-126 < z < 6.4999999999999996e-206Initial program 99.2%
Taylor expanded in z around 0
lower-*.f64N/A
lower--.f6473.2
Applied rewrites73.2%
if 6.4999999999999996e-206 < z Initial program 99.2%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
frac-2negN/A
lift--.f64N/A
sub-negate-revN/A
lower-/.f64N/A
distribute-neg-frac2N/A
lift--.f64N/A
sub-negate-revN/A
lower-/.f64N/A
lower--.f64N/A
lower--.f6498.5
Applied rewrites98.5%
Taylor expanded in y around 0
Applied rewrites78.0%
lift-/.f64N/A
mult-flipN/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
mult-flip-revN/A
lower-/.f6478.8
Applied rewrites78.8%
(FPCore (x y z t)
:precision binary64
(if (<= (fmin z t) -1.14e-126)
(- 1.0 (/ x (* (fmin z t) (- (fmax z t) y))))
(if (<= (fmin z t) 6.5e-206)
(- 1.0 (/ x (* y (- y (fmax z t)))))
(- 1.0 (/ x (* (fmax z t) (- (fmin z t) y)))))))double code(double x, double y, double z, double t) {
double tmp;
if (fmin(z, t) <= -1.14e-126) {
tmp = 1.0 - (x / (fmin(z, t) * (fmax(z, t) - y)));
} else if (fmin(z, t) <= 6.5e-206) {
tmp = 1.0 - (x / (y * (y - fmax(z, t))));
} else {
tmp = 1.0 - (x / (fmax(z, t) * (fmin(z, 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 (fmin(z, t) <= (-1.14d-126)) then
tmp = 1.0d0 - (x / (fmin(z, t) * (fmax(z, t) - y)))
else if (fmin(z, t) <= 6.5d-206) then
tmp = 1.0d0 - (x / (y * (y - fmax(z, t))))
else
tmp = 1.0d0 - (x / (fmax(z, t) * (fmin(z, t) - y)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (fmin(z, t) <= -1.14e-126) {
tmp = 1.0 - (x / (fmin(z, t) * (fmax(z, t) - y)));
} else if (fmin(z, t) <= 6.5e-206) {
tmp = 1.0 - (x / (y * (y - fmax(z, t))));
} else {
tmp = 1.0 - (x / (fmax(z, t) * (fmin(z, t) - y)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if fmin(z, t) <= -1.14e-126: tmp = 1.0 - (x / (fmin(z, t) * (fmax(z, t) - y))) elif fmin(z, t) <= 6.5e-206: tmp = 1.0 - (x / (y * (y - fmax(z, t)))) else: tmp = 1.0 - (x / (fmax(z, t) * (fmin(z, t) - y))) return tmp
function code(x, y, z, t) tmp = 0.0 if (fmin(z, t) <= -1.14e-126) tmp = Float64(1.0 - Float64(x / Float64(fmin(z, t) * Float64(fmax(z, t) - y)))); elseif (fmin(z, t) <= 6.5e-206) tmp = Float64(1.0 - Float64(x / Float64(y * Float64(y - fmax(z, t))))); else tmp = Float64(1.0 - Float64(x / Float64(fmax(z, t) * Float64(fmin(z, t) - y)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (min(z, t) <= -1.14e-126) tmp = 1.0 - (x / (min(z, t) * (max(z, t) - y))); elseif (min(z, t) <= 6.5e-206) tmp = 1.0 - (x / (y * (y - max(z, t)))); else tmp = 1.0 - (x / (max(z, t) * (min(z, t) - y))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[Min[z, t], $MachinePrecision], -1.14e-126], N[(1.0 - N[(x / N[(N[Min[z, t], $MachinePrecision] * N[(N[Max[z, t], $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Min[z, t], $MachinePrecision], 6.5e-206], N[(1.0 - N[(x / N[(y * N[(y - N[Max[z, t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(x / N[(N[Max[z, t], $MachinePrecision] * N[(N[Min[z, t], $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;\mathsf{min}\left(z, t\right) \leq -1.14 \cdot 10^{-126}:\\
\;\;\;\;1 - \frac{x}{\mathsf{min}\left(z, t\right) \cdot \left(\mathsf{max}\left(z, t\right) - y\right)}\\
\mathbf{elif}\;\mathsf{min}\left(z, t\right) \leq 6.5 \cdot 10^{-206}:\\
\;\;\;\;1 - \frac{x}{y \cdot \left(y - \mathsf{max}\left(z, t\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{x}{\mathsf{max}\left(z, t\right) \cdot \left(\mathsf{min}\left(z, t\right) - y\right)}\\
\end{array}
if z < -1.13999999999999993e-126Initial program 99.2%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
frac-2negN/A
lift--.f64N/A
sub-negate-revN/A
lower-/.f64N/A
distribute-neg-frac2N/A
lift--.f64N/A
sub-negate-revN/A
lower-/.f64N/A
lower--.f64N/A
lower--.f6498.5
Applied rewrites98.5%
Taylor expanded in z around inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f6479.0
Applied rewrites79.0%
if -1.13999999999999993e-126 < z < 6.4999999999999996e-206Initial program 99.2%
Taylor expanded in z around 0
lower-*.f64N/A
lower--.f6473.2
Applied rewrites73.2%
if 6.4999999999999996e-206 < z Initial program 99.2%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
frac-2negN/A
lift--.f64N/A
sub-negate-revN/A
lower-/.f64N/A
distribute-neg-frac2N/A
lift--.f64N/A
sub-negate-revN/A
lower-/.f64N/A
lower--.f64N/A
lower--.f6498.5
Applied rewrites98.5%
Taylor expanded in t around inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f6478.9
Applied rewrites78.9%
(FPCore (x y z t) :precision binary64 (if (<= (fmin z t) -1.1e-127) (- 1.0 (/ x (* (fmin z t) (- (fmax z t) y)))) (- 1.0 (/ x (* (fmax z t) (- (fmin z t) y))))))
double code(double x, double y, double z, double t) {
double tmp;
if (fmin(z, t) <= -1.1e-127) {
tmp = 1.0 - (x / (fmin(z, t) * (fmax(z, t) - y)));
} else {
tmp = 1.0 - (x / (fmax(z, t) * (fmin(z, 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 (fmin(z, t) <= (-1.1d-127)) then
tmp = 1.0d0 - (x / (fmin(z, t) * (fmax(z, t) - y)))
else
tmp = 1.0d0 - (x / (fmax(z, t) * (fmin(z, t) - y)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (fmin(z, t) <= -1.1e-127) {
tmp = 1.0 - (x / (fmin(z, t) * (fmax(z, t) - y)));
} else {
tmp = 1.0 - (x / (fmax(z, t) * (fmin(z, t) - y)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if fmin(z, t) <= -1.1e-127: tmp = 1.0 - (x / (fmin(z, t) * (fmax(z, t) - y))) else: tmp = 1.0 - (x / (fmax(z, t) * (fmin(z, t) - y))) return tmp
function code(x, y, z, t) tmp = 0.0 if (fmin(z, t) <= -1.1e-127) tmp = Float64(1.0 - Float64(x / Float64(fmin(z, t) * Float64(fmax(z, t) - y)))); else tmp = Float64(1.0 - Float64(x / Float64(fmax(z, t) * Float64(fmin(z, t) - y)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (min(z, t) <= -1.1e-127) tmp = 1.0 - (x / (min(z, t) * (max(z, t) - y))); else tmp = 1.0 - (x / (max(z, t) * (min(z, t) - y))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[Min[z, t], $MachinePrecision], -1.1e-127], N[(1.0 - N[(x / N[(N[Min[z, t], $MachinePrecision] * N[(N[Max[z, t], $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(x / N[(N[Max[z, t], $MachinePrecision] * N[(N[Min[z, t], $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;\mathsf{min}\left(z, t\right) \leq -1.1 \cdot 10^{-127}:\\
\;\;\;\;1 - \frac{x}{\mathsf{min}\left(z, t\right) \cdot \left(\mathsf{max}\left(z, t\right) - y\right)}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{x}{\mathsf{max}\left(z, t\right) \cdot \left(\mathsf{min}\left(z, t\right) - y\right)}\\
\end{array}
if z < -1.1000000000000001e-127Initial program 99.2%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
frac-2negN/A
lift--.f64N/A
sub-negate-revN/A
lower-/.f64N/A
distribute-neg-frac2N/A
lift--.f64N/A
sub-negate-revN/A
lower-/.f64N/A
lower--.f64N/A
lower--.f6498.5
Applied rewrites98.5%
Taylor expanded in z around inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f6479.0
Applied rewrites79.0%
if -1.1000000000000001e-127 < z Initial program 99.2%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
frac-2negN/A
lift--.f64N/A
sub-negate-revN/A
lower-/.f64N/A
distribute-neg-frac2N/A
lift--.f64N/A
sub-negate-revN/A
lower-/.f64N/A
lower--.f64N/A
lower--.f6498.5
Applied rewrites98.5%
Taylor expanded in t around inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f6478.9
Applied rewrites78.9%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- 1.0 (/ x (* (- y z) (- y t))))))
(if (<= t_1 0.9999999999999957)
(- 1.0 (/ x (* t (- z y))))
(if (<= t_1 1e+33) 1.0 (- 1.0 (/ (/ x t) z))))))double code(double x, double y, double z, double t) {
double t_1 = 1.0 - (x / ((y - z) * (y - t)));
double tmp;
if (t_1 <= 0.9999999999999957) {
tmp = 1.0 - (x / (t * (z - y)));
} else if (t_1 <= 1e+33) {
tmp = 1.0;
} else {
tmp = 1.0 - ((x / t) / z);
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t)
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 - (x / ((y - z) * (y - t)))
if (t_1 <= 0.9999999999999957d0) then
tmp = 1.0d0 - (x / (t * (z - y)))
else if (t_1 <= 1d+33) then
tmp = 1.0d0
else
tmp = 1.0d0 - ((x / t) / z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = 1.0 - (x / ((y - z) * (y - t)));
double tmp;
if (t_1 <= 0.9999999999999957) {
tmp = 1.0 - (x / (t * (z - y)));
} else if (t_1 <= 1e+33) {
tmp = 1.0;
} else {
tmp = 1.0 - ((x / t) / z);
}
return tmp;
}
def code(x, y, z, t): t_1 = 1.0 - (x / ((y - z) * (y - t))) tmp = 0 if t_1 <= 0.9999999999999957: tmp = 1.0 - (x / (t * (z - y))) elif t_1 <= 1e+33: tmp = 1.0 else: tmp = 1.0 - ((x / t) / z) return tmp
function code(x, y, z, t) t_1 = Float64(1.0 - Float64(x / Float64(Float64(y - z) * Float64(y - t)))) tmp = 0.0 if (t_1 <= 0.9999999999999957) tmp = Float64(1.0 - Float64(x / Float64(t * Float64(z - y)))); elseif (t_1 <= 1e+33) tmp = 1.0; else tmp = Float64(1.0 - Float64(Float64(x / t) / z)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = 1.0 - (x / ((y - z) * (y - t))); tmp = 0.0; if (t_1 <= 0.9999999999999957) tmp = 1.0 - (x / (t * (z - y))); elseif (t_1 <= 1e+33) tmp = 1.0; else tmp = 1.0 - ((x / t) / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(1.0 - N[(x / N[(N[(y - z), $MachinePrecision] * N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 0.9999999999999957], N[(1.0 - N[(x / N[(t * N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e+33], 1.0, N[(1.0 - N[(N[(x / t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
t_1 := 1 - \frac{x}{\left(y - z\right) \cdot \left(y - t\right)}\\
\mathbf{if}\;t\_1 \leq 0.9999999999999957:\\
\;\;\;\;1 - \frac{x}{t \cdot \left(z - y\right)}\\
\mathbf{elif}\;t\_1 \leq 10^{+33}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{\frac{x}{t}}{z}\\
\end{array}
if (-.f64 #s(literal 1 binary64) (/.f64 x (*.f64 (-.f64 y z) (-.f64 y t)))) < 0.99999999999999567Initial program 99.2%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
frac-2negN/A
lift--.f64N/A
sub-negate-revN/A
lower-/.f64N/A
distribute-neg-frac2N/A
lift--.f64N/A
sub-negate-revN/A
lower-/.f64N/A
lower--.f64N/A
lower--.f6498.5
Applied rewrites98.5%
Taylor expanded in t around inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f6478.9
Applied rewrites78.9%
if 0.99999999999999567 < (-.f64 #s(literal 1 binary64) (/.f64 x (*.f64 (-.f64 y z) (-.f64 y t)))) < 9.9999999999999995e32Initial program 99.2%
Taylor expanded in x around 0
Applied rewrites75.6%
if 9.9999999999999995e32 < (-.f64 #s(literal 1 binary64) (/.f64 x (*.f64 (-.f64 y z) (-.f64 y t)))) Initial program 99.2%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
frac-2negN/A
lift--.f64N/A
sub-negate-revN/A
lower-/.f64N/A
distribute-neg-frac2N/A
lift--.f64N/A
sub-negate-revN/A
lower-/.f64N/A
lower--.f64N/A
lower--.f6498.5
Applied rewrites98.5%
Taylor expanded in y around 0
Applied rewrites78.0%
Taylor expanded in y around 0
Applied rewrites61.1%
lift-/.f64N/A
mult-flipN/A
lift-/.f64N/A
associate-*l/N/A
mult-flipN/A
lift-/.f64N/A
lower-/.f6461.2
Applied rewrites61.2%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- 1.0 (/ x (* (- y (fmin z t)) (- y (fmax z t)))))))
(if (<= t_1 0.9999999999999957)
(- 1.0 (/ (/ x (fmin z t)) (fmax z t)))
(if (<= t_1 1e+33) 1.0 (- 1.0 (/ (/ x (fmax z t)) (fmin z t)))))))double code(double x, double y, double z, double t) {
double t_1 = 1.0 - (x / ((y - fmin(z, t)) * (y - fmax(z, t))));
double tmp;
if (t_1 <= 0.9999999999999957) {
tmp = 1.0 - ((x / fmin(z, t)) / fmax(z, t));
} else if (t_1 <= 1e+33) {
tmp = 1.0;
} else {
tmp = 1.0 - ((x / fmax(z, t)) / fmin(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) :: t_1
real(8) :: tmp
t_1 = 1.0d0 - (x / ((y - fmin(z, t)) * (y - fmax(z, t))))
if (t_1 <= 0.9999999999999957d0) then
tmp = 1.0d0 - ((x / fmin(z, t)) / fmax(z, t))
else if (t_1 <= 1d+33) then
tmp = 1.0d0
else
tmp = 1.0d0 - ((x / fmax(z, t)) / fmin(z, t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = 1.0 - (x / ((y - fmin(z, t)) * (y - fmax(z, t))));
double tmp;
if (t_1 <= 0.9999999999999957) {
tmp = 1.0 - ((x / fmin(z, t)) / fmax(z, t));
} else if (t_1 <= 1e+33) {
tmp = 1.0;
} else {
tmp = 1.0 - ((x / fmax(z, t)) / fmin(z, t));
}
return tmp;
}
def code(x, y, z, t): t_1 = 1.0 - (x / ((y - fmin(z, t)) * (y - fmax(z, t)))) tmp = 0 if t_1 <= 0.9999999999999957: tmp = 1.0 - ((x / fmin(z, t)) / fmax(z, t)) elif t_1 <= 1e+33: tmp = 1.0 else: tmp = 1.0 - ((x / fmax(z, t)) / fmin(z, t)) return tmp
function code(x, y, z, t) t_1 = Float64(1.0 - Float64(x / Float64(Float64(y - fmin(z, t)) * Float64(y - fmax(z, t))))) tmp = 0.0 if (t_1 <= 0.9999999999999957) tmp = Float64(1.0 - Float64(Float64(x / fmin(z, t)) / fmax(z, t))); elseif (t_1 <= 1e+33) tmp = 1.0; else tmp = Float64(1.0 - Float64(Float64(x / fmax(z, t)) / fmin(z, t))); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = 1.0 - (x / ((y - min(z, t)) * (y - max(z, t)))); tmp = 0.0; if (t_1 <= 0.9999999999999957) tmp = 1.0 - ((x / min(z, t)) / max(z, t)); elseif (t_1 <= 1e+33) tmp = 1.0; else tmp = 1.0 - ((x / max(z, t)) / min(z, t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(1.0 - N[(x / N[(N[(y - N[Min[z, t], $MachinePrecision]), $MachinePrecision] * N[(y - N[Max[z, t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 0.9999999999999957], N[(1.0 - N[(N[(x / N[Min[z, t], $MachinePrecision]), $MachinePrecision] / N[Max[z, t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e+33], 1.0, N[(1.0 - N[(N[(x / N[Max[z, t], $MachinePrecision]), $MachinePrecision] / N[Min[z, t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
t_1 := 1 - \frac{x}{\left(y - \mathsf{min}\left(z, t\right)\right) \cdot \left(y - \mathsf{max}\left(z, t\right)\right)}\\
\mathbf{if}\;t\_1 \leq 0.9999999999999957:\\
\;\;\;\;1 - \frac{\frac{x}{\mathsf{min}\left(z, t\right)}}{\mathsf{max}\left(z, t\right)}\\
\mathbf{elif}\;t\_1 \leq 10^{+33}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{\frac{x}{\mathsf{max}\left(z, t\right)}}{\mathsf{min}\left(z, t\right)}\\
\end{array}
if (-.f64 #s(literal 1 binary64) (/.f64 x (*.f64 (-.f64 y z) (-.f64 y t)))) < 0.99999999999999567Initial program 99.2%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
frac-2negN/A
lift--.f64N/A
sub-negate-revN/A
lower-/.f64N/A
distribute-neg-frac2N/A
lift--.f64N/A
sub-negate-revN/A
lower-/.f64N/A
lower--.f64N/A
lower--.f6498.5
Applied rewrites98.5%
Taylor expanded in y around 0
Applied rewrites78.0%
Taylor expanded in y around 0
Applied rewrites61.1%
if 0.99999999999999567 < (-.f64 #s(literal 1 binary64) (/.f64 x (*.f64 (-.f64 y z) (-.f64 y t)))) < 9.9999999999999995e32Initial program 99.2%
Taylor expanded in x around 0
Applied rewrites75.6%
if 9.9999999999999995e32 < (-.f64 #s(literal 1 binary64) (/.f64 x (*.f64 (-.f64 y z) (-.f64 y t)))) Initial program 99.2%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
frac-2negN/A
lift--.f64N/A
sub-negate-revN/A
lower-/.f64N/A
distribute-neg-frac2N/A
lift--.f64N/A
sub-negate-revN/A
lower-/.f64N/A
lower--.f64N/A
lower--.f6498.5
Applied rewrites98.5%
Taylor expanded in y around 0
Applied rewrites78.0%
Taylor expanded in y around 0
Applied rewrites61.1%
lift-/.f64N/A
mult-flipN/A
lift-/.f64N/A
associate-*l/N/A
mult-flipN/A
lift-/.f64N/A
lower-/.f6461.2
Applied rewrites61.2%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- 1.0 (/ x (* (- y z) (- y t))))))
(if (<= t_1 0.9999999999999957)
(- 1.0 (/ x (* t z)))
(if (<= t_1 1e+33) 1.0 (- 1.0 (/ (/ x t) z))))))double code(double x, double y, double z, double t) {
double t_1 = 1.0 - (x / ((y - z) * (y - t)));
double tmp;
if (t_1 <= 0.9999999999999957) {
tmp = 1.0 - (x / (t * z));
} else if (t_1 <= 1e+33) {
tmp = 1.0;
} else {
tmp = 1.0 - ((x / t) / z);
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t)
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 - (x / ((y - z) * (y - t)))
if (t_1 <= 0.9999999999999957d0) then
tmp = 1.0d0 - (x / (t * z))
else if (t_1 <= 1d+33) then
tmp = 1.0d0
else
tmp = 1.0d0 - ((x / t) / z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = 1.0 - (x / ((y - z) * (y - t)));
double tmp;
if (t_1 <= 0.9999999999999957) {
tmp = 1.0 - (x / (t * z));
} else if (t_1 <= 1e+33) {
tmp = 1.0;
} else {
tmp = 1.0 - ((x / t) / z);
}
return tmp;
}
def code(x, y, z, t): t_1 = 1.0 - (x / ((y - z) * (y - t))) tmp = 0 if t_1 <= 0.9999999999999957: tmp = 1.0 - (x / (t * z)) elif t_1 <= 1e+33: tmp = 1.0 else: tmp = 1.0 - ((x / t) / z) return tmp
function code(x, y, z, t) t_1 = Float64(1.0 - Float64(x / Float64(Float64(y - z) * Float64(y - t)))) tmp = 0.0 if (t_1 <= 0.9999999999999957) tmp = Float64(1.0 - Float64(x / Float64(t * z))); elseif (t_1 <= 1e+33) tmp = 1.0; else tmp = Float64(1.0 - Float64(Float64(x / t) / z)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = 1.0 - (x / ((y - z) * (y - t))); tmp = 0.0; if (t_1 <= 0.9999999999999957) tmp = 1.0 - (x / (t * z)); elseif (t_1 <= 1e+33) tmp = 1.0; else tmp = 1.0 - ((x / t) / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(1.0 - N[(x / N[(N[(y - z), $MachinePrecision] * N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 0.9999999999999957], N[(1.0 - N[(x / N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e+33], 1.0, N[(1.0 - N[(N[(x / t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
t_1 := 1 - \frac{x}{\left(y - z\right) \cdot \left(y - t\right)}\\
\mathbf{if}\;t\_1 \leq 0.9999999999999957:\\
\;\;\;\;1 - \frac{x}{t \cdot z}\\
\mathbf{elif}\;t\_1 \leq 10^{+33}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{\frac{x}{t}}{z}\\
\end{array}
if (-.f64 #s(literal 1 binary64) (/.f64 x (*.f64 (-.f64 y z) (-.f64 y t)))) < 0.99999999999999567Initial program 99.2%
Taylor expanded in y around 0
lower-*.f6461.5
Applied rewrites61.5%
if 0.99999999999999567 < (-.f64 #s(literal 1 binary64) (/.f64 x (*.f64 (-.f64 y z) (-.f64 y t)))) < 9.9999999999999995e32Initial program 99.2%
Taylor expanded in x around 0
Applied rewrites75.6%
if 9.9999999999999995e32 < (-.f64 #s(literal 1 binary64) (/.f64 x (*.f64 (-.f64 y z) (-.f64 y t)))) Initial program 99.2%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
frac-2negN/A
lift--.f64N/A
sub-negate-revN/A
lower-/.f64N/A
distribute-neg-frac2N/A
lift--.f64N/A
sub-negate-revN/A
lower-/.f64N/A
lower--.f64N/A
lower--.f6498.5
Applied rewrites98.5%
Taylor expanded in y around 0
Applied rewrites78.0%
Taylor expanded in y around 0
Applied rewrites61.1%
lift-/.f64N/A
mult-flipN/A
lift-/.f64N/A
associate-*l/N/A
mult-flipN/A
lift-/.f64N/A
lower-/.f6461.2
Applied rewrites61.2%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (- 1.0 (/ x (* t z)))) (t_2 (- 1.0 (/ x (* (- y z) (- y t)))))) (if (<= t_2 0.9999999999999957) t_1 (if (<= t_2 1e+33) 1.0 t_1))))
double code(double x, double y, double z, double t) {
double t_1 = 1.0 - (x / (t * z));
double t_2 = 1.0 - (x / ((y - z) * (y - t)));
double tmp;
if (t_2 <= 0.9999999999999957) {
tmp = t_1;
} else if (t_2 <= 1e+33) {
tmp = 1.0;
} 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 = 1.0d0 - (x / (t * z))
t_2 = 1.0d0 - (x / ((y - z) * (y - t)))
if (t_2 <= 0.9999999999999957d0) then
tmp = t_1
else if (t_2 <= 1d+33) then
tmp = 1.0d0
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 - (x / (t * z));
double t_2 = 1.0 - (x / ((y - z) * (y - t)));
double tmp;
if (t_2 <= 0.9999999999999957) {
tmp = t_1;
} else if (t_2 <= 1e+33) {
tmp = 1.0;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = 1.0 - (x / (t * z)) t_2 = 1.0 - (x / ((y - z) * (y - t))) tmp = 0 if t_2 <= 0.9999999999999957: tmp = t_1 elif t_2 <= 1e+33: tmp = 1.0 else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(1.0 - Float64(x / Float64(t * z))) t_2 = Float64(1.0 - Float64(x / Float64(Float64(y - z) * Float64(y - t)))) tmp = 0.0 if (t_2 <= 0.9999999999999957) tmp = t_1; elseif (t_2 <= 1e+33) tmp = 1.0; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = 1.0 - (x / (t * z)); t_2 = 1.0 - (x / ((y - z) * (y - t))); tmp = 0.0; if (t_2 <= 0.9999999999999957) tmp = t_1; elseif (t_2 <= 1e+33) tmp = 1.0; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(1.0 - N[(x / N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(1.0 - N[(x / N[(N[(y - z), $MachinePrecision] * N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, 0.9999999999999957], t$95$1, If[LessEqual[t$95$2, 1e+33], 1.0, t$95$1]]]]
\begin{array}{l}
t_1 := 1 - \frac{x}{t \cdot z}\\
t_2 := 1 - \frac{x}{\left(y - z\right) \cdot \left(y - t\right)}\\
\mathbf{if}\;t\_2 \leq 0.9999999999999957:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 10^{+33}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if (-.f64 #s(literal 1 binary64) (/.f64 x (*.f64 (-.f64 y z) (-.f64 y t)))) < 0.99999999999999567 or 9.9999999999999995e32 < (-.f64 #s(literal 1 binary64) (/.f64 x (*.f64 (-.f64 y z) (-.f64 y t)))) Initial program 99.2%
Taylor expanded in y around 0
lower-*.f6461.5
Applied rewrites61.5%
if 0.99999999999999567 < (-.f64 #s(literal 1 binary64) (/.f64 x (*.f64 (-.f64 y z) (-.f64 y t)))) < 9.9999999999999995e32Initial program 99.2%
Taylor expanded in x around 0
Applied rewrites75.6%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (/ x (* y (fmax z t))) -1.0))
(t_2 (/ x (* (- y (fmin z t)) (- y (fmax z t))))))
(if (<= t_2 -4e+110) t_1 (if (<= t_2 5e-15) 1.0 t_1))))double code(double x, double y, double z, double t) {
double t_1 = (x / (y * fmax(z, t))) - -1.0;
double t_2 = x / ((y - fmin(z, t)) * (y - fmax(z, t)));
double tmp;
if (t_2 <= -4e+110) {
tmp = t_1;
} else if (t_2 <= 5e-15) {
tmp = 1.0;
} 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 / (y * fmax(z, t))) - (-1.0d0)
t_2 = x / ((y - fmin(z, t)) * (y - fmax(z, t)))
if (t_2 <= (-4d+110)) then
tmp = t_1
else if (t_2 <= 5d-15) then
tmp = 1.0d0
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 / (y * fmax(z, t))) - -1.0;
double t_2 = x / ((y - fmin(z, t)) * (y - fmax(z, t)));
double tmp;
if (t_2 <= -4e+110) {
tmp = t_1;
} else if (t_2 <= 5e-15) {
tmp = 1.0;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x / (y * fmax(z, t))) - -1.0 t_2 = x / ((y - fmin(z, t)) * (y - fmax(z, t))) tmp = 0 if t_2 <= -4e+110: tmp = t_1 elif t_2 <= 5e-15: tmp = 1.0 else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x / Float64(y * fmax(z, t))) - -1.0) t_2 = Float64(x / Float64(Float64(y - fmin(z, t)) * Float64(y - fmax(z, t)))) tmp = 0.0 if (t_2 <= -4e+110) tmp = t_1; elseif (t_2 <= 5e-15) tmp = 1.0; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x / (y * max(z, t))) - -1.0; t_2 = x / ((y - min(z, t)) * (y - max(z, t))); tmp = 0.0; if (t_2 <= -4e+110) tmp = t_1; elseif (t_2 <= 5e-15) tmp = 1.0; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x / N[(y * N[Max[z, t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - -1.0), $MachinePrecision]}, Block[{t$95$2 = N[(x / N[(N[(y - N[Min[z, t], $MachinePrecision]), $MachinePrecision] * N[(y - N[Max[z, t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -4e+110], t$95$1, If[LessEqual[t$95$2, 5e-15], 1.0, t$95$1]]]]
\begin{array}{l}
t_1 := \frac{x}{y \cdot \mathsf{max}\left(z, t\right)} - -1\\
t_2 := \frac{x}{\left(y - \mathsf{min}\left(z, t\right)\right) \cdot \left(y - \mathsf{max}\left(z, t\right)\right)}\\
\mathbf{if}\;t\_2 \leq -4 \cdot 10^{+110}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{-15}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if (/.f64 x (*.f64 (-.f64 y z) (-.f64 y t))) < -4.0000000000000001e110 or 4.99999999999999999e-15 < (/.f64 x (*.f64 (-.f64 y z) (-.f64 y t))) Initial program 99.2%
Taylor expanded in t around inf
lower-+.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower--.f6478.9
Applied rewrites78.9%
Taylor expanded in y around inf
lower-*.f6457.3
Applied rewrites57.3%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6457.3
lift-*.f64N/A
*-commutativeN/A
lower-*.f6457.3
Applied rewrites57.3%
if -4.0000000000000001e110 < (/.f64 x (*.f64 (-.f64 y z) (-.f64 y t))) < 4.99999999999999999e-15Initial program 99.2%
Taylor expanded in x around 0
Applied rewrites75.6%
(FPCore (x y z t) :precision binary64 1.0)
double code(double x, double y, double z, double t) {
return 1.0;
}
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
end function
public static double code(double x, double y, double z, double t) {
return 1.0;
}
def code(x, y, z, t): return 1.0
function code(x, y, z, t) return 1.0 end
function tmp = code(x, y, z, t) tmp = 1.0; end
code[x_, y_, z_, t_] := 1.0
1
Initial program 99.2%
Taylor expanded in x around 0
Applied rewrites75.6%
herbie shell --seed 2025170
(FPCore (x y z t)
:name "Data.Random.Distribution.Triangular:triangularCDF from random-fu-0.2.6.2, A"
:precision binary64
(- 1.0 (/ x (* (- y z) (- y t)))))