
(FPCore (x y z t) :precision binary64 (* x (- (/ y z) (/ t (- 1 z)))))
double code(double x, double y, double z, double t) {
return x * ((y / z) - (t / (1.0 - 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 / (1.0d0 - z)))
end function
public static double code(double x, double y, double z, double t) {
return x * ((y / z) - (t / (1.0 - z)));
}
def code(x, y, z, t): return x * ((y / z) - (t / (1.0 - z)))
function code(x, y, z, t) return Float64(x * Float64(Float64(y / z) - Float64(t / Float64(1.0 - z)))) end
function tmp = code(x, y, z, t) tmp = x * ((y / z) - (t / (1.0 - z))); end
code[x_, y_, z_, t_] := N[(x * N[(N[(y / z), $MachinePrecision] - N[(t / N[(1 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (* x (- (/ y z) (/ t (- 1 z)))))
double code(double x, double y, double z, double t) {
return x * ((y / z) - (t / (1.0 - 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 / (1.0d0 - z)))
end function
public static double code(double x, double y, double z, double t) {
return x * ((y / z) - (t / (1.0 - z)));
}
def code(x, y, z, t): return x * ((y / z) - (t / (1.0 - z)))
function code(x, y, z, t) return Float64(x * Float64(Float64(y / z) - Float64(t / Float64(1.0 - z)))) end
function tmp = code(x, y, z, t) tmp = x * ((y / z) - (t / (1.0 - z))); end
code[x_, y_, z_, t_] := N[(x * N[(N[(y / z), $MachinePrecision] - N[(t / N[(1 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)
(FPCore (x y z t) :precision binary64 (134-z0z1z2z3z4 x (/ 1 z) y (/ -1 (- z 1)) t))
\mathsf{134\_z0z1z2z3z4}\left(x, \left(\frac{1}{z}\right), y, \left(\frac{-1}{z - 1}\right), t\right)
Initial program 94.6%
Applied rewrites99.7%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (134-z0z1z2z3z4 (/ 1 z) y x (- x) t)))
(if (<= z -100000000000)
t_1
(if (<=
z
1225996432692711/12259964326927110866866776217202473468949912977468817408)
(134-z0z1z2z3z4 x (/ 1 z) y 1 t)
t_1))))\begin{array}{l}
t_1 := \mathsf{134\_z0z1z2z3z4}\left(\left(\frac{1}{z}\right), y, x, \left(-x\right), t\right)\\
\mathbf{if}\;z \leq -100000000000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq \frac{1225996432692711}{12259964326927110866866776217202473468949912977468817408}:\\
\;\;\;\;\mathsf{134\_z0z1z2z3z4}\left(x, \left(\frac{1}{z}\right), y, 1, t\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if z < -1e11 or 9.9999999999999993e-41 < z Initial program 94.6%
Taylor expanded in z around inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f6471.6%
Applied rewrites71.6%
lift-/.f64N/A
mult-flipN/A
lift-/.f64N/A
*-commutativeN/A
*-rgt-identityN/A
associate-*l*N/A
*-commutativeN/A
*-rgt-identityN/A
lift-*.f64N/A
lift--.f64N/A
sub-flipN/A
distribute-lft-inN/A
lift-*.f64N/A
lift-*.f64N/A
mul-1-negN/A
remove-double-negN/A
fp-cancel-sign-sub-invN/A
lift-*.f64N/A
*-commutativeN/A
lower-134-z0z1z2z3z4N/A
lower-neg.f6478.7%
Applied rewrites78.7%
if -1e11 < z < 9.9999999999999993e-41Initial program 94.6%
Applied rewrites99.7%
Taylor expanded in z around 0
Applied rewrites68.5%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (/ (- y (* -1 t)) z))))
(if (<= z -100000000000)
t_1
(if (<=
z
1225996432692711/12259964326927110866866776217202473468949912977468817408)
(134-z0z1z2z3z4 x (/ 1 z) y 1 t)
t_1))))\begin{array}{l}
t_1 := x \cdot \frac{y - -1 \cdot t}{z}\\
\mathbf{if}\;z \leq -100000000000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq \frac{1225996432692711}{12259964326927110866866776217202473468949912977468817408}:\\
\;\;\;\;\mathsf{134\_z0z1z2z3z4}\left(x, \left(\frac{1}{z}\right), y, 1, t\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if z < -1e11 or 9.9999999999999993e-41 < z Initial program 94.6%
Taylor expanded in z around inf
lower-/.f64N/A
lower--.f64N/A
lower-*.f6474.3%
Applied rewrites74.3%
if -1e11 < z < 9.9999999999999993e-41Initial program 94.6%
Applied rewrites99.7%
Taylor expanded in z around 0
Applied rewrites68.5%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (/ (- y (* -1 t)) z))))
(if (<= z -100000000000)
t_1
(if (<=
z
1225996432692711/12259964326927110866866776217202473468949912977468817408)
(* x (- (/ y z) t))
t_1))))double code(double x, double y, double z, double t) {
double t_1 = x * ((y - (-1.0 * t)) / z);
double tmp;
if (z <= -100000000000.0) {
tmp = t_1;
} else if (z <= 1e-40) {
tmp = x * ((y / z) - t);
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = x * ((y - ((-1.0d0) * t)) / z)
if (z <= (-100000000000.0d0)) then
tmp = t_1
else if (z <= 1d-40) then
tmp = x * ((y / z) - t)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x * ((y - (-1.0 * t)) / z);
double tmp;
if (z <= -100000000000.0) {
tmp = t_1;
} else if (z <= 1e-40) {
tmp = x * ((y / z) - t);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * ((y - (-1.0 * t)) / z) tmp = 0 if z <= -100000000000.0: tmp = t_1 elif z <= 1e-40: tmp = x * ((y / z) - t) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(Float64(y - Float64(-1.0 * t)) / z)) tmp = 0.0 if (z <= -100000000000.0) tmp = t_1; elseif (z <= 1e-40) tmp = Float64(x * Float64(Float64(y / z) - t)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * ((y - (-1.0 * t)) / z); tmp = 0.0; if (z <= -100000000000.0) tmp = t_1; elseif (z <= 1e-40) tmp = x * ((y / z) - t); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(N[(y - N[(-1 * t), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -100000000000], t$95$1, If[LessEqual[z, 1225996432692711/12259964326927110866866776217202473468949912977468817408], N[(x * N[(N[(y / z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := x \cdot \frac{y - -1 \cdot t}{z}\\
\mathbf{if}\;z \leq -100000000000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq \frac{1225996432692711}{12259964326927110866866776217202473468949912977468817408}:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - t\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if z < -1e11 or 9.9999999999999993e-41 < z Initial program 94.6%
Taylor expanded in z around inf
lower-/.f64N/A
lower--.f64N/A
lower-*.f6474.3%
Applied rewrites74.3%
if -1e11 < z < 9.9999999999999993e-41Initial program 94.6%
Taylor expanded in z around 0
Applied rewrites64.7%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (/ x z) (+ t y))))
(if (<= z -3910709743626425/36893488147419103232)
t_1
(if (<=
z
7355978596156267/6129982163463555433433388108601236734474956488734408704)
(* x (- (/ y z) t))
t_1))))double code(double x, double y, double z, double t) {
double t_1 = (x / z) * (t + y);
double tmp;
if (z <= -0.000106) {
tmp = t_1;
} else if (z <= 1.2e-39) {
tmp = x * ((y / z) - t);
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = (x / z) * (t + y)
if (z <= (-0.000106d0)) then
tmp = t_1
else if (z <= 1.2d-39) then
tmp = x * ((y / z) - t)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (x / z) * (t + y);
double tmp;
if (z <= -0.000106) {
tmp = t_1;
} else if (z <= 1.2e-39) {
tmp = x * ((y / z) - t);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x / z) * (t + y) tmp = 0 if z <= -0.000106: tmp = t_1 elif z <= 1.2e-39: tmp = x * ((y / z) - t) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x / z) * Float64(t + y)) tmp = 0.0 if (z <= -0.000106) tmp = t_1; elseif (z <= 1.2e-39) tmp = Float64(x * Float64(Float64(y / z) - t)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x / z) * (t + y); tmp = 0.0; if (z <= -0.000106) tmp = t_1; elseif (z <= 1.2e-39) tmp = x * ((y / z) - t); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x / z), $MachinePrecision] * N[(t + y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -3910709743626425/36893488147419103232], t$95$1, If[LessEqual[z, 7355978596156267/6129982163463555433433388108601236734474956488734408704], N[(x * N[(N[(y / z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := \frac{x}{z} \cdot \left(t + y\right)\\
\mathbf{if}\;z \leq \frac{-3910709743626425}{36893488147419103232}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq \frac{7355978596156267}{6129982163463555433433388108601236734474956488734408704}:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - t\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if z < -1.06e-4 or 1.2000000000000001e-39 < z Initial program 94.6%
Taylor expanded in z around inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f6471.6%
Applied rewrites71.6%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6472.4%
lift--.f64N/A
lift-*.f64N/A
mul-1-negN/A
add-flip-revN/A
+-commutativeN/A
lower-+.f6472.4%
Applied rewrites72.4%
if -1.06e-4 < z < 1.2000000000000001e-39Initial program 94.6%
Taylor expanded in z around 0
Applied rewrites64.7%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (/ t (- z 1)))))
(if (<=
t
-139999999999999994484757380203412886533674866908243268525100435151117803057990024745518547450433516102966295394729050062354052124776417134265785593289311581481248158539094444813432623661936613237079428885575691211886297088)
t_1
(if (<= t 109999999999999996710078893497713539430844727296)
(* (/ x z) (+ t y))
t_1))))double code(double x, double y, double z, double t) {
double t_1 = x * (t / (z - 1.0));
double tmp;
if (t <= -1.4e+221) {
tmp = t_1;
} else if (t <= 1.1e+47) {
tmp = (x / z) * (t + y);
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = x * (t / (z - 1.0d0))
if (t <= (-1.4d+221)) then
tmp = t_1
else if (t <= 1.1d+47) then
tmp = (x / z) * (t + y)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x * (t / (z - 1.0));
double tmp;
if (t <= -1.4e+221) {
tmp = t_1;
} else if (t <= 1.1e+47) {
tmp = (x / z) * (t + y);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (t / (z - 1.0)) tmp = 0 if t <= -1.4e+221: tmp = t_1 elif t <= 1.1e+47: tmp = (x / z) * (t + y) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(t / Float64(z - 1.0))) tmp = 0.0 if (t <= -1.4e+221) tmp = t_1; elseif (t <= 1.1e+47) tmp = Float64(Float64(x / z) * Float64(t + y)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (t / (z - 1.0)); tmp = 0.0; if (t <= -1.4e+221) tmp = t_1; elseif (t <= 1.1e+47) tmp = (x / z) * (t + y); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(t / N[(z - 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -139999999999999994484757380203412886533674866908243268525100435151117803057990024745518547450433516102966295394729050062354052124776417134265785593289311581481248158539094444813432623661936613237079428885575691211886297088], t$95$1, If[LessEqual[t, 109999999999999996710078893497713539430844727296], N[(N[(x / z), $MachinePrecision] * N[(t + y), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := x \cdot \frac{t}{z - 1}\\
\mathbf{if}\;t \leq -139999999999999994484757380203412886533674866908243268525100435151117803057990024745518547450433516102966295394729050062354052124776417134265785593289311581481248158539094444813432623661936613237079428885575691211886297088:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 109999999999999996710078893497713539430844727296:\\
\;\;\;\;\frac{x}{z} \cdot \left(t + y\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if t < -1.3999999999999999e221 or 1.1e47 < t Initial program 94.6%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lower-*.f64N/A
frac-2negN/A
metadata-evalN/A
lower-/.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6494.5%
Applied rewrites94.5%
Taylor expanded in y around 0
lower-/.f64N/A
lower--.f6445.3%
Applied rewrites45.3%
if -1.3999999999999999e221 < t < 1.1e47Initial program 94.6%
Taylor expanded in z around inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f6471.6%
Applied rewrites71.6%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6472.4%
lift--.f64N/A
lift-*.f64N/A
mul-1-negN/A
add-flip-revN/A
+-commutativeN/A
lower-+.f6472.4%
Applied rewrites72.4%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (/ x z) (+ t y))))
(if (<=
z
-3666615307735769/374144419156711147060143317175368453031918731001856)
t_1
(if (<=
z
3628949440770425/49039857307708443467467104868809893875799651909875269632)
(* (/ x z) y)
t_1))))double code(double x, double y, double z, double t) {
double t_1 = (x / z) * (t + y);
double tmp;
if (z <= -9.8e-36) {
tmp = t_1;
} else if (z <= 7.4e-41) {
tmp = (x / z) * y;
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t)
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 / z) * (t + y)
if (z <= (-9.8d-36)) then
tmp = t_1
else if (z <= 7.4d-41) then
tmp = (x / z) * y
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 / z) * (t + y);
double tmp;
if (z <= -9.8e-36) {
tmp = t_1;
} else if (z <= 7.4e-41) {
tmp = (x / z) * y;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x / z) * (t + y) tmp = 0 if z <= -9.8e-36: tmp = t_1 elif z <= 7.4e-41: tmp = (x / z) * y else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x / z) * Float64(t + y)) tmp = 0.0 if (z <= -9.8e-36) tmp = t_1; elseif (z <= 7.4e-41) tmp = Float64(Float64(x / z) * y); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x / z) * (t + y); tmp = 0.0; if (z <= -9.8e-36) tmp = t_1; elseif (z <= 7.4e-41) tmp = (x / z) * y; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x / z), $MachinePrecision] * N[(t + y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -3666615307735769/374144419156711147060143317175368453031918731001856], t$95$1, If[LessEqual[z, 3628949440770425/49039857307708443467467104868809893875799651909875269632], N[(N[(x / z), $MachinePrecision] * y), $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := \frac{x}{z} \cdot \left(t + y\right)\\
\mathbf{if}\;z \leq \frac{-3666615307735769}{374144419156711147060143317175368453031918731001856}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq \frac{3628949440770425}{49039857307708443467467104868809893875799651909875269632}:\\
\;\;\;\;\frac{x}{z} \cdot y\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if z < -9.7999999999999994e-36 or 7.4000000000000004e-41 < z Initial program 94.6%
Taylor expanded in z around inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f6471.6%
Applied rewrites71.6%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6472.4%
lift--.f64N/A
lift-*.f64N/A
mul-1-negN/A
add-flip-revN/A
+-commutativeN/A
lower-+.f6472.4%
Applied rewrites72.4%
if -9.7999999999999994e-36 < z < 7.4000000000000004e-41Initial program 94.6%
Taylor expanded in y around inf
lower-/.f64N/A
lower-*.f6460.8%
Applied rewrites60.8%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6461.4%
Applied rewrites61.4%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (/ t z))))
(if (<=
t
-11999999999999999189605007116252562135196237725801474694376286835368351609462679400797122382189310637093450010455244325420523079289538253555433619794534928243455430595292499542016)
t_1
(if (<= t 109999999999999996710078893497713539430844727296)
(* (/ x z) y)
t_1))))double code(double x, double y, double z, double t) {
double t_1 = x * (t / z);
double tmp;
if (t <= -1.2e+178) {
tmp = t_1;
} else if (t <= 1.1e+47) {
tmp = (x / z) * y;
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = x * (t / z)
if (t <= (-1.2d+178)) then
tmp = t_1
else if (t <= 1.1d+47) then
tmp = (x / z) * y
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x * (t / z);
double tmp;
if (t <= -1.2e+178) {
tmp = t_1;
} else if (t <= 1.1e+47) {
tmp = (x / z) * y;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (t / z) tmp = 0 if t <= -1.2e+178: tmp = t_1 elif t <= 1.1e+47: tmp = (x / z) * y else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(t / z)) tmp = 0.0 if (t <= -1.2e+178) tmp = t_1; elseif (t <= 1.1e+47) tmp = Float64(Float64(x / z) * y); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (t / z); tmp = 0.0; if (t <= -1.2e+178) tmp = t_1; elseif (t <= 1.1e+47) tmp = (x / z) * y; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -11999999999999999189605007116252562135196237725801474694376286835368351609462679400797122382189310637093450010455244325420523079289538253555433619794534928243455430595292499542016], t$95$1, If[LessEqual[t, 109999999999999996710078893497713539430844727296], N[(N[(x / z), $MachinePrecision] * y), $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := x \cdot \frac{t}{z}\\
\mathbf{if}\;t \leq -11999999999999999189605007116252562135196237725801474694376286835368351609462679400797122382189310637093450010455244325420523079289538253555433619794534928243455430595292499542016:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 109999999999999996710078893497713539430844727296:\\
\;\;\;\;\frac{x}{z} \cdot y\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if t < -1.1999999999999999e178 or 1.1e47 < t Initial program 94.6%
Taylor expanded in z around inf
lower-/.f64N/A
lower--.f64N/A
lower-*.f6474.3%
Applied rewrites74.3%
Taylor expanded in y around 0
Applied rewrites35.6%
if -1.1999999999999999e178 < t < 1.1e47Initial program 94.6%
Taylor expanded in y around inf
lower-/.f64N/A
lower-*.f6460.8%
Applied rewrites60.8%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6461.4%
Applied rewrites61.4%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (/ x z) t)))
(if (<=
t
-11999999999999999189605007116252562135196237725801474694376286835368351609462679400797122382189310637093450010455244325420523079289538253555433619794534928243455430595292499542016)
t_1
(if (<= t 109999999999999996710078893497713539430844727296)
(* (/ x z) y)
t_1))))double code(double x, double y, double z, double t) {
double t_1 = (x / z) * t;
double tmp;
if (t <= -1.2e+178) {
tmp = t_1;
} else if (t <= 1.1e+47) {
tmp = (x / z) * y;
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t)
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 / z) * t
if (t <= (-1.2d+178)) then
tmp = t_1
else if (t <= 1.1d+47) then
tmp = (x / z) * y
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 / z) * t;
double tmp;
if (t <= -1.2e+178) {
tmp = t_1;
} else if (t <= 1.1e+47) {
tmp = (x / z) * y;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x / z) * t tmp = 0 if t <= -1.2e+178: tmp = t_1 elif t <= 1.1e+47: tmp = (x / z) * y else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x / z) * t) tmp = 0.0 if (t <= -1.2e+178) tmp = t_1; elseif (t <= 1.1e+47) tmp = Float64(Float64(x / z) * y); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x / z) * t; tmp = 0.0; if (t <= -1.2e+178) tmp = t_1; elseif (t <= 1.1e+47) tmp = (x / z) * y; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x / z), $MachinePrecision] * t), $MachinePrecision]}, If[LessEqual[t, -11999999999999999189605007116252562135196237725801474694376286835368351609462679400797122382189310637093450010455244325420523079289538253555433619794534928243455430595292499542016], t$95$1, If[LessEqual[t, 109999999999999996710078893497713539430844727296], N[(N[(x / z), $MachinePrecision] * y), $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := \frac{x}{z} \cdot t\\
\mathbf{if}\;t \leq -11999999999999999189605007116252562135196237725801474694376286835368351609462679400797122382189310637093450010455244325420523079289538253555433619794534928243455430595292499542016:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 109999999999999996710078893497713539430844727296:\\
\;\;\;\;\frac{x}{z} \cdot y\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if t < -1.1999999999999999e178 or 1.1e47 < t Initial program 94.6%
Taylor expanded in z around inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f6471.6%
Applied rewrites71.6%
Taylor expanded in y around 0
Applied rewrites33.2%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f6434.7%
Applied rewrites34.7%
if -1.1999999999999999e178 < t < 1.1e47Initial program 94.6%
Taylor expanded in y around inf
lower-/.f64N/A
lower-*.f6460.8%
Applied rewrites60.8%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6461.4%
Applied rewrites61.4%
(FPCore (x y z t) :precision binary64 (* (/ x z) y))
double code(double x, double y, double z, double t) {
return (x / z) * 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 = (x / z) * y
end function
public static double code(double x, double y, double z, double t) {
return (x / z) * y;
}
def code(x, y, z, t): return (x / z) * y
function code(x, y, z, t) return Float64(Float64(x / z) * y) end
function tmp = code(x, y, z, t) tmp = (x / z) * y; end
code[x_, y_, z_, t_] := N[(N[(x / z), $MachinePrecision] * y), $MachinePrecision]
\frac{x}{z} \cdot y
Initial program 94.6%
Taylor expanded in y around inf
lower-/.f64N/A
lower-*.f6460.8%
Applied rewrites60.8%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6461.4%
Applied rewrites61.4%
herbie shell --seed 2025271 -o generate:evaluate
(FPCore (x y z t)
:name "Numeric.SpecFunctions:invIncompleteBetaWorker from math-functions-0.1.5.2, C"
:precision binary64
(* x (- (/ y z) (/ t (- 1 z)))))