
(FPCore (z0 z3 z4 z1 z2) :precision binary64 (/ (- (log (- 1.0 z0))) (+ (/ z3 (* z4 z4)) (/ z1 (* z2 z2)))))
double code(double z0, double z3, double z4, double z1, double z2) {
return -log((1.0 - z0)) / ((z3 / (z4 * z4)) + (z1 / (z2 * z2)));
}
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(z0, z3, z4, z1, z2)
use fmin_fmax_functions
real(8), intent (in) :: z0
real(8), intent (in) :: z3
real(8), intent (in) :: z4
real(8), intent (in) :: z1
real(8), intent (in) :: z2
code = -log((1.0d0 - z0)) / ((z3 / (z4 * z4)) + (z1 / (z2 * z2)))
end function
public static double code(double z0, double z3, double z4, double z1, double z2) {
return -Math.log((1.0 - z0)) / ((z3 / (z4 * z4)) + (z1 / (z2 * z2)));
}
def code(z0, z3, z4, z1, z2): return -math.log((1.0 - z0)) / ((z3 / (z4 * z4)) + (z1 / (z2 * z2)))
function code(z0, z3, z4, z1, z2) return Float64(Float64(-log(Float64(1.0 - z0))) / Float64(Float64(z3 / Float64(z4 * z4)) + Float64(z1 / Float64(z2 * z2)))) end
function tmp = code(z0, z3, z4, z1, z2) tmp = -log((1.0 - z0)) / ((z3 / (z4 * z4)) + (z1 / (z2 * z2))); end
code[z0_, z3_, z4_, z1_, z2_] := N[((-N[Log[N[(1.0 - z0), $MachinePrecision]], $MachinePrecision]) / N[(N[(z3 / N[(z4 * z4), $MachinePrecision]), $MachinePrecision] + N[(z1 / N[(z2 * z2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\frac{-\log \left(1 - z0\right)}{\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}}
Herbie found 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (z0 z3 z4 z1 z2) :precision binary64 (/ (- (log (- 1.0 z0))) (+ (/ z3 (* z4 z4)) (/ z1 (* z2 z2)))))
double code(double z0, double z3, double z4, double z1, double z2) {
return -log((1.0 - z0)) / ((z3 / (z4 * z4)) + (z1 / (z2 * z2)));
}
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(z0, z3, z4, z1, z2)
use fmin_fmax_functions
real(8), intent (in) :: z0
real(8), intent (in) :: z3
real(8), intent (in) :: z4
real(8), intent (in) :: z1
real(8), intent (in) :: z2
code = -log((1.0d0 - z0)) / ((z3 / (z4 * z4)) + (z1 / (z2 * z2)))
end function
public static double code(double z0, double z3, double z4, double z1, double z2) {
return -Math.log((1.0 - z0)) / ((z3 / (z4 * z4)) + (z1 / (z2 * z2)));
}
def code(z0, z3, z4, z1, z2): return -math.log((1.0 - z0)) / ((z3 / (z4 * z4)) + (z1 / (z2 * z2)))
function code(z0, z3, z4, z1, z2) return Float64(Float64(-log(Float64(1.0 - z0))) / Float64(Float64(z3 / Float64(z4 * z4)) + Float64(z1 / Float64(z2 * z2)))) end
function tmp = code(z0, z3, z4, z1, z2) tmp = -log((1.0 - z0)) / ((z3 / (z4 * z4)) + (z1 / (z2 * z2))); end
code[z0_, z3_, z4_, z1_, z2_] := N[((-N[Log[N[(1.0 - z0), $MachinePrecision]], $MachinePrecision]) / N[(N[(z3 / N[(z4 * z4), $MachinePrecision]), $MachinePrecision] + N[(z1 / N[(z2 * z2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\frac{-\log \left(1 - z0\right)}{\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}}
(FPCore (z0 z3 z4 z1 z2)
:precision binary64
(let* ((t_0 (/ z1 (fabs z2))) (t_1 (- (log (- 1.0 z0)))))
(if (<= z0 -5.3e+150)
(/ t_1 (+ (/ (/ z3 z4) z4) (/ z1 (* (fabs z2) (fabs z2)))))
(if (<= z0 -1.15e-7)
(/
t_1
(/ (+ (* (/ z3 z4) (fabs z2)) (* t_0 z4)) (* z4 (fabs z2))))
(/
(- (- z0))
(/ (+ (* (/ z3 (* z4 z4)) (fabs z2)) t_0) (fabs z2)))))))double code(double z0, double z3, double z4, double z1, double z2) {
double t_0 = z1 / fabs(z2);
double t_1 = -log((1.0 - z0));
double tmp;
if (z0 <= -5.3e+150) {
tmp = t_1 / (((z3 / z4) / z4) + (z1 / (fabs(z2) * fabs(z2))));
} else if (z0 <= -1.15e-7) {
tmp = t_1 / ((((z3 / z4) * fabs(z2)) + (t_0 * z4)) / (z4 * fabs(z2)));
} else {
tmp = -(-z0) / ((((z3 / (z4 * z4)) * fabs(z2)) + t_0) / fabs(z2));
}
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(z0, z3, z4, z1, z2)
use fmin_fmax_functions
real(8), intent (in) :: z0
real(8), intent (in) :: z3
real(8), intent (in) :: z4
real(8), intent (in) :: z1
real(8), intent (in) :: z2
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = z1 / abs(z2)
t_1 = -log((1.0d0 - z0))
if (z0 <= (-5.3d+150)) then
tmp = t_1 / (((z3 / z4) / z4) + (z1 / (abs(z2) * abs(z2))))
else if (z0 <= (-1.15d-7)) then
tmp = t_1 / ((((z3 / z4) * abs(z2)) + (t_0 * z4)) / (z4 * abs(z2)))
else
tmp = -(-z0) / ((((z3 / (z4 * z4)) * abs(z2)) + t_0) / abs(z2))
end if
code = tmp
end function
public static double code(double z0, double z3, double z4, double z1, double z2) {
double t_0 = z1 / Math.abs(z2);
double t_1 = -Math.log((1.0 - z0));
double tmp;
if (z0 <= -5.3e+150) {
tmp = t_1 / (((z3 / z4) / z4) + (z1 / (Math.abs(z2) * Math.abs(z2))));
} else if (z0 <= -1.15e-7) {
tmp = t_1 / ((((z3 / z4) * Math.abs(z2)) + (t_0 * z4)) / (z4 * Math.abs(z2)));
} else {
tmp = -(-z0) / ((((z3 / (z4 * z4)) * Math.abs(z2)) + t_0) / Math.abs(z2));
}
return tmp;
}
def code(z0, z3, z4, z1, z2): t_0 = z1 / math.fabs(z2) t_1 = -math.log((1.0 - z0)) tmp = 0 if z0 <= -5.3e+150: tmp = t_1 / (((z3 / z4) / z4) + (z1 / (math.fabs(z2) * math.fabs(z2)))) elif z0 <= -1.15e-7: tmp = t_1 / ((((z3 / z4) * math.fabs(z2)) + (t_0 * z4)) / (z4 * math.fabs(z2))) else: tmp = -(-z0) / ((((z3 / (z4 * z4)) * math.fabs(z2)) + t_0) / math.fabs(z2)) return tmp
function code(z0, z3, z4, z1, z2) t_0 = Float64(z1 / abs(z2)) t_1 = Float64(-log(Float64(1.0 - z0))) tmp = 0.0 if (z0 <= -5.3e+150) tmp = Float64(t_1 / Float64(Float64(Float64(z3 / z4) / z4) + Float64(z1 / Float64(abs(z2) * abs(z2))))); elseif (z0 <= -1.15e-7) tmp = Float64(t_1 / Float64(Float64(Float64(Float64(z3 / z4) * abs(z2)) + Float64(t_0 * z4)) / Float64(z4 * abs(z2)))); else tmp = Float64(Float64(-Float64(-z0)) / Float64(Float64(Float64(Float64(z3 / Float64(z4 * z4)) * abs(z2)) + t_0) / abs(z2))); end return tmp end
function tmp_2 = code(z0, z3, z4, z1, z2) t_0 = z1 / abs(z2); t_1 = -log((1.0 - z0)); tmp = 0.0; if (z0 <= -5.3e+150) tmp = t_1 / (((z3 / z4) / z4) + (z1 / (abs(z2) * abs(z2)))); elseif (z0 <= -1.15e-7) tmp = t_1 / ((((z3 / z4) * abs(z2)) + (t_0 * z4)) / (z4 * abs(z2))); else tmp = -(-z0) / ((((z3 / (z4 * z4)) * abs(z2)) + t_0) / abs(z2)); end tmp_2 = tmp; end
code[z0_, z3_, z4_, z1_, z2_] := Block[{t$95$0 = N[(z1 / N[Abs[z2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = (-N[Log[N[(1.0 - z0), $MachinePrecision]], $MachinePrecision])}, If[LessEqual[z0, -5.3e+150], N[(t$95$1 / N[(N[(N[(z3 / z4), $MachinePrecision] / z4), $MachinePrecision] + N[(z1 / N[(N[Abs[z2], $MachinePrecision] * N[Abs[z2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z0, -1.15e-7], N[(t$95$1 / N[(N[(N[(N[(z3 / z4), $MachinePrecision] * N[Abs[z2], $MachinePrecision]), $MachinePrecision] + N[(t$95$0 * z4), $MachinePrecision]), $MachinePrecision] / N[(z4 * N[Abs[z2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[((-(-z0)) / N[(N[(N[(N[(z3 / N[(z4 * z4), $MachinePrecision]), $MachinePrecision] * N[Abs[z2], $MachinePrecision]), $MachinePrecision] + t$95$0), $MachinePrecision] / N[Abs[z2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
t_0 := \frac{z1}{\left|z2\right|}\\
t_1 := -\log \left(1 - z0\right)\\
\mathbf{if}\;z0 \leq -5.3 \cdot 10^{+150}:\\
\;\;\;\;\frac{t\_1}{\frac{\frac{z3}{z4}}{z4} + \frac{z1}{\left|z2\right| \cdot \left|z2\right|}}\\
\mathbf{elif}\;z0 \leq -1.15 \cdot 10^{-7}:\\
\;\;\;\;\frac{t\_1}{\frac{\frac{z3}{z4} \cdot \left|z2\right| + t\_0 \cdot z4}{z4 \cdot \left|z2\right|}}\\
\mathbf{else}:\\
\;\;\;\;\frac{-\left(-z0\right)}{\frac{\frac{z3}{z4 \cdot z4} \cdot \left|z2\right| + t\_0}{\left|z2\right|}}\\
\end{array}
if z0 < -5.3000000000000001e150Initial program 65.5%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6468.3%
Applied rewrites68.3%
if -5.3000000000000001e150 < z0 < -1.15e-7Initial program 65.5%
lift-+.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
common-denominatorN/A
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6468.9%
Applied rewrites68.9%
if -1.15e-7 < z0 Initial program 65.5%
Taylor expanded in z0 around 0
lower-*.f6471.8%
Applied rewrites71.8%
lift-+.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
add-to-fractionN/A
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f6475.6%
Applied rewrites75.6%
lift-*.f64N/A
mul-1-negN/A
lift-neg.f6475.6%
Applied rewrites75.6%
(FPCore (z0 z3 z4 z1 z2)
:precision binary64
(let* ((t_0 (- (log (- 1.0 z0))))
(t_1 (/ z3 (* z4 z4)))
(t_2 (/ t_0 (+ t_1 (/ z1 (* z2 z2))))))
(if (<= t_2 -2e-253)
t_2
(if (<= t_2 5e-283)
(/ (- z0) (- (/ 1.0 (/ z2 (/ (- z1) z2))) t_1))
(if (<= t_2 2e+302)
(/ t_0 (+ t_1 (/ (/ z1 z2) z2)))
(/
(- (- z0))
(/ (/ 1.0 (/ z2 (+ (* (* z2 t_1) z2) z1))) z2)))))))double code(double z0, double z3, double z4, double z1, double z2) {
double t_0 = -log((1.0 - z0));
double t_1 = z3 / (z4 * z4);
double t_2 = t_0 / (t_1 + (z1 / (z2 * z2)));
double tmp;
if (t_2 <= -2e-253) {
tmp = t_2;
} else if (t_2 <= 5e-283) {
tmp = -z0 / ((1.0 / (z2 / (-z1 / z2))) - t_1);
} else if (t_2 <= 2e+302) {
tmp = t_0 / (t_1 + ((z1 / z2) / z2));
} else {
tmp = -(-z0) / ((1.0 / (z2 / (((z2 * t_1) * z2) + z1))) / z2);
}
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(z0, z3, z4, z1, z2)
use fmin_fmax_functions
real(8), intent (in) :: z0
real(8), intent (in) :: z3
real(8), intent (in) :: z4
real(8), intent (in) :: z1
real(8), intent (in) :: z2
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = -log((1.0d0 - z0))
t_1 = z3 / (z4 * z4)
t_2 = t_0 / (t_1 + (z1 / (z2 * z2)))
if (t_2 <= (-2d-253)) then
tmp = t_2
else if (t_2 <= 5d-283) then
tmp = -z0 / ((1.0d0 / (z2 / (-z1 / z2))) - t_1)
else if (t_2 <= 2d+302) then
tmp = t_0 / (t_1 + ((z1 / z2) / z2))
else
tmp = -(-z0) / ((1.0d0 / (z2 / (((z2 * t_1) * z2) + z1))) / z2)
end if
code = tmp
end function
public static double code(double z0, double z3, double z4, double z1, double z2) {
double t_0 = -Math.log((1.0 - z0));
double t_1 = z3 / (z4 * z4);
double t_2 = t_0 / (t_1 + (z1 / (z2 * z2)));
double tmp;
if (t_2 <= -2e-253) {
tmp = t_2;
} else if (t_2 <= 5e-283) {
tmp = -z0 / ((1.0 / (z2 / (-z1 / z2))) - t_1);
} else if (t_2 <= 2e+302) {
tmp = t_0 / (t_1 + ((z1 / z2) / z2));
} else {
tmp = -(-z0) / ((1.0 / (z2 / (((z2 * t_1) * z2) + z1))) / z2);
}
return tmp;
}
def code(z0, z3, z4, z1, z2): t_0 = -math.log((1.0 - z0)) t_1 = z3 / (z4 * z4) t_2 = t_0 / (t_1 + (z1 / (z2 * z2))) tmp = 0 if t_2 <= -2e-253: tmp = t_2 elif t_2 <= 5e-283: tmp = -z0 / ((1.0 / (z2 / (-z1 / z2))) - t_1) elif t_2 <= 2e+302: tmp = t_0 / (t_1 + ((z1 / z2) / z2)) else: tmp = -(-z0) / ((1.0 / (z2 / (((z2 * t_1) * z2) + z1))) / z2) return tmp
function code(z0, z3, z4, z1, z2) t_0 = Float64(-log(Float64(1.0 - z0))) t_1 = Float64(z3 / Float64(z4 * z4)) t_2 = Float64(t_0 / Float64(t_1 + Float64(z1 / Float64(z2 * z2)))) tmp = 0.0 if (t_2 <= -2e-253) tmp = t_2; elseif (t_2 <= 5e-283) tmp = Float64(Float64(-z0) / Float64(Float64(1.0 / Float64(z2 / Float64(Float64(-z1) / z2))) - t_1)); elseif (t_2 <= 2e+302) tmp = Float64(t_0 / Float64(t_1 + Float64(Float64(z1 / z2) / z2))); else tmp = Float64(Float64(-Float64(-z0)) / Float64(Float64(1.0 / Float64(z2 / Float64(Float64(Float64(z2 * t_1) * z2) + z1))) / z2)); end return tmp end
function tmp_2 = code(z0, z3, z4, z1, z2) t_0 = -log((1.0 - z0)); t_1 = z3 / (z4 * z4); t_2 = t_0 / (t_1 + (z1 / (z2 * z2))); tmp = 0.0; if (t_2 <= -2e-253) tmp = t_2; elseif (t_2 <= 5e-283) tmp = -z0 / ((1.0 / (z2 / (-z1 / z2))) - t_1); elseif (t_2 <= 2e+302) tmp = t_0 / (t_1 + ((z1 / z2) / z2)); else tmp = -(-z0) / ((1.0 / (z2 / (((z2 * t_1) * z2) + z1))) / z2); end tmp_2 = tmp; end
code[z0_, z3_, z4_, z1_, z2_] := Block[{t$95$0 = (-N[Log[N[(1.0 - z0), $MachinePrecision]], $MachinePrecision])}, Block[{t$95$1 = N[(z3 / N[(z4 * z4), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$0 / N[(t$95$1 + N[(z1 / N[(z2 * z2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -2e-253], t$95$2, If[LessEqual[t$95$2, 5e-283], N[((-z0) / N[(N[(1.0 / N[(z2 / N[((-z1) / z2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 2e+302], N[(t$95$0 / N[(t$95$1 + N[(N[(z1 / z2), $MachinePrecision] / z2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[((-(-z0)) / N[(N[(1.0 / N[(z2 / N[(N[(N[(z2 * t$95$1), $MachinePrecision] * z2), $MachinePrecision] + z1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z2), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
t_0 := -\log \left(1 - z0\right)\\
t_1 := \frac{z3}{z4 \cdot z4}\\
t_2 := \frac{t\_0}{t\_1 + \frac{z1}{z2 \cdot z2}}\\
\mathbf{if}\;t\_2 \leq -2 \cdot 10^{-253}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{-283}:\\
\;\;\;\;\frac{-z0}{\frac{1}{\frac{z2}{\frac{-z1}{z2}}} - t\_1}\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+302}:\\
\;\;\;\;\frac{t\_0}{t\_1 + \frac{\frac{z1}{z2}}{z2}}\\
\mathbf{else}:\\
\;\;\;\;\frac{-\left(-z0\right)}{\frac{\frac{1}{\frac{z2}{\left(z2 \cdot t\_1\right) \cdot z2 + z1}}}{z2}}\\
\end{array}
if (/.f64 (neg.f64 (log.f64 (-.f64 #s(literal 1 binary64) z0))) (+.f64 (/.f64 z3 (*.f64 z4 z4)) (/.f64 z1 (*.f64 z2 z2)))) < -2.0000000000000001e-253Initial program 65.5%
if -2.0000000000000001e-253 < (/.f64 (neg.f64 (log.f64 (-.f64 #s(literal 1 binary64) z0))) (+.f64 (/.f64 z3 (*.f64 z4 z4)) (/.f64 z1 (*.f64 z2 z2)))) < 5.0000000000000001e-283Initial program 65.5%
Taylor expanded in z0 around 0
lower-*.f6471.8%
Applied rewrites71.8%
lift-/.f64N/A
lift-neg.f64N/A
distribute-frac-negN/A
distribute-neg-frac2N/A
lower-/.f64N/A
lift-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-neg.f64N/A
lower-neg.f64N/A
lower-neg.f64N/A
lower-neg.f64N/A
Applied rewrites71.9%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f64N/A
lift-neg.f64N/A
distribute-neg-frac2N/A
distribute-neg-fracN/A
lower-/.f64N/A
lower-neg.f6474.7%
Applied rewrites74.7%
if 5.0000000000000001e-283 < (/.f64 (neg.f64 (log.f64 (-.f64 #s(literal 1 binary64) z0))) (+.f64 (/.f64 z3 (*.f64 z4 z4)) (/.f64 z1 (*.f64 z2 z2)))) < 2.0000000000000002e302Initial program 65.5%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6468.6%
Applied rewrites68.6%
if 2.0000000000000002e302 < (/.f64 (neg.f64 (log.f64 (-.f64 #s(literal 1 binary64) z0))) (+.f64 (/.f64 z3 (*.f64 z4 z4)) (/.f64 z1 (*.f64 z2 z2)))) Initial program 65.5%
Taylor expanded in z0 around 0
lower-*.f6471.8%
Applied rewrites71.8%
lift-+.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
add-to-fractionN/A
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f6475.6%
Applied rewrites75.6%
lift-*.f64N/A
mul-1-negN/A
lift-neg.f6475.6%
Applied rewrites75.6%
lift-+.f64N/A
lift-/.f64N/A
add-to-fractionN/A
div-flipN/A
lower-unsound-/.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
lower-unsound-/.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
lower-+.f64N/A
lower-*.f6474.4%
lift-*.f64N/A
*-commutativeN/A
lift-*.f6474.4%
Applied rewrites74.4%
(FPCore (z0 z3 z4 z1 z2)
:precision binary64
(let* ((t_0 (/ z3 (* z4 z4)))
(t_1 (/ (- (log (- 1.0 z0))) (+ t_0 (/ z1 (* z2 z2))))))
(if (<= t_1 -2e-253)
t_1
(if (<= t_1 5e-283)
(/ (- z0) (- (/ 1.0 (/ z2 (/ (- z1) z2))) t_0))
(if (<= t_1 2e+302)
t_1
(/
(- (- z0))
(/ (/ 1.0 (/ z2 (+ (* (* z2 t_0) z2) z1))) z2)))))))double code(double z0, double z3, double z4, double z1, double z2) {
double t_0 = z3 / (z4 * z4);
double t_1 = -log((1.0 - z0)) / (t_0 + (z1 / (z2 * z2)));
double tmp;
if (t_1 <= -2e-253) {
tmp = t_1;
} else if (t_1 <= 5e-283) {
tmp = -z0 / ((1.0 / (z2 / (-z1 / z2))) - t_0);
} else if (t_1 <= 2e+302) {
tmp = t_1;
} else {
tmp = -(-z0) / ((1.0 / (z2 / (((z2 * t_0) * z2) + z1))) / z2);
}
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(z0, z3, z4, z1, z2)
use fmin_fmax_functions
real(8), intent (in) :: z0
real(8), intent (in) :: z3
real(8), intent (in) :: z4
real(8), intent (in) :: z1
real(8), intent (in) :: z2
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = z3 / (z4 * z4)
t_1 = -log((1.0d0 - z0)) / (t_0 + (z1 / (z2 * z2)))
if (t_1 <= (-2d-253)) then
tmp = t_1
else if (t_1 <= 5d-283) then
tmp = -z0 / ((1.0d0 / (z2 / (-z1 / z2))) - t_0)
else if (t_1 <= 2d+302) then
tmp = t_1
else
tmp = -(-z0) / ((1.0d0 / (z2 / (((z2 * t_0) * z2) + z1))) / z2)
end if
code = tmp
end function
public static double code(double z0, double z3, double z4, double z1, double z2) {
double t_0 = z3 / (z4 * z4);
double t_1 = -Math.log((1.0 - z0)) / (t_0 + (z1 / (z2 * z2)));
double tmp;
if (t_1 <= -2e-253) {
tmp = t_1;
} else if (t_1 <= 5e-283) {
tmp = -z0 / ((1.0 / (z2 / (-z1 / z2))) - t_0);
} else if (t_1 <= 2e+302) {
tmp = t_1;
} else {
tmp = -(-z0) / ((1.0 / (z2 / (((z2 * t_0) * z2) + z1))) / z2);
}
return tmp;
}
def code(z0, z3, z4, z1, z2): t_0 = z3 / (z4 * z4) t_1 = -math.log((1.0 - z0)) / (t_0 + (z1 / (z2 * z2))) tmp = 0 if t_1 <= -2e-253: tmp = t_1 elif t_1 <= 5e-283: tmp = -z0 / ((1.0 / (z2 / (-z1 / z2))) - t_0) elif t_1 <= 2e+302: tmp = t_1 else: tmp = -(-z0) / ((1.0 / (z2 / (((z2 * t_0) * z2) + z1))) / z2) return tmp
function code(z0, z3, z4, z1, z2) t_0 = Float64(z3 / Float64(z4 * z4)) t_1 = Float64(Float64(-log(Float64(1.0 - z0))) / Float64(t_0 + Float64(z1 / Float64(z2 * z2)))) tmp = 0.0 if (t_1 <= -2e-253) tmp = t_1; elseif (t_1 <= 5e-283) tmp = Float64(Float64(-z0) / Float64(Float64(1.0 / Float64(z2 / Float64(Float64(-z1) / z2))) - t_0)); elseif (t_1 <= 2e+302) tmp = t_1; else tmp = Float64(Float64(-Float64(-z0)) / Float64(Float64(1.0 / Float64(z2 / Float64(Float64(Float64(z2 * t_0) * z2) + z1))) / z2)); end return tmp end
function tmp_2 = code(z0, z3, z4, z1, z2) t_0 = z3 / (z4 * z4); t_1 = -log((1.0 - z0)) / (t_0 + (z1 / (z2 * z2))); tmp = 0.0; if (t_1 <= -2e-253) tmp = t_1; elseif (t_1 <= 5e-283) tmp = -z0 / ((1.0 / (z2 / (-z1 / z2))) - t_0); elseif (t_1 <= 2e+302) tmp = t_1; else tmp = -(-z0) / ((1.0 / (z2 / (((z2 * t_0) * z2) + z1))) / z2); end tmp_2 = tmp; end
code[z0_, z3_, z4_, z1_, z2_] := Block[{t$95$0 = N[(z3 / N[(z4 * z4), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[((-N[Log[N[(1.0 - z0), $MachinePrecision]], $MachinePrecision]) / N[(t$95$0 + N[(z1 / N[(z2 * z2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -2e-253], t$95$1, If[LessEqual[t$95$1, 5e-283], N[((-z0) / N[(N[(1.0 / N[(z2 / N[((-z1) / z2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e+302], t$95$1, N[((-(-z0)) / N[(N[(1.0 / N[(z2 / N[(N[(N[(z2 * t$95$0), $MachinePrecision] * z2), $MachinePrecision] + z1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z2), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
t_0 := \frac{z3}{z4 \cdot z4}\\
t_1 := \frac{-\log \left(1 - z0\right)}{t\_0 + \frac{z1}{z2 \cdot z2}}\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{-253}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{-283}:\\
\;\;\;\;\frac{-z0}{\frac{1}{\frac{z2}{\frac{-z1}{z2}}} - t\_0}\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+302}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{-\left(-z0\right)}{\frac{\frac{1}{\frac{z2}{\left(z2 \cdot t\_0\right) \cdot z2 + z1}}}{z2}}\\
\end{array}
if (/.f64 (neg.f64 (log.f64 (-.f64 #s(literal 1 binary64) z0))) (+.f64 (/.f64 z3 (*.f64 z4 z4)) (/.f64 z1 (*.f64 z2 z2)))) < -2.0000000000000001e-253 or 5.0000000000000001e-283 < (/.f64 (neg.f64 (log.f64 (-.f64 #s(literal 1 binary64) z0))) (+.f64 (/.f64 z3 (*.f64 z4 z4)) (/.f64 z1 (*.f64 z2 z2)))) < 2.0000000000000002e302Initial program 65.5%
if -2.0000000000000001e-253 < (/.f64 (neg.f64 (log.f64 (-.f64 #s(literal 1 binary64) z0))) (+.f64 (/.f64 z3 (*.f64 z4 z4)) (/.f64 z1 (*.f64 z2 z2)))) < 5.0000000000000001e-283Initial program 65.5%
Taylor expanded in z0 around 0
lower-*.f6471.8%
Applied rewrites71.8%
lift-/.f64N/A
lift-neg.f64N/A
distribute-frac-negN/A
distribute-neg-frac2N/A
lower-/.f64N/A
lift-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-neg.f64N/A
lower-neg.f64N/A
lower-neg.f64N/A
lower-neg.f64N/A
Applied rewrites71.9%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f64N/A
lift-neg.f64N/A
distribute-neg-frac2N/A
distribute-neg-fracN/A
lower-/.f64N/A
lower-neg.f6474.7%
Applied rewrites74.7%
if 2.0000000000000002e302 < (/.f64 (neg.f64 (log.f64 (-.f64 #s(literal 1 binary64) z0))) (+.f64 (/.f64 z3 (*.f64 z4 z4)) (/.f64 z1 (*.f64 z2 z2)))) Initial program 65.5%
Taylor expanded in z0 around 0
lower-*.f6471.8%
Applied rewrites71.8%
lift-+.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
add-to-fractionN/A
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f6475.6%
Applied rewrites75.6%
lift-*.f64N/A
mul-1-negN/A
lift-neg.f6475.6%
Applied rewrites75.6%
lift-+.f64N/A
lift-/.f64N/A
add-to-fractionN/A
div-flipN/A
lower-unsound-/.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
lower-unsound-/.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
lower-+.f64N/A
lower-*.f6474.4%
lift-*.f64N/A
*-commutativeN/A
lift-*.f6474.4%
Applied rewrites74.4%
(FPCore (z0 z3 z4 z1 z2) :precision binary64 (if (<= z0 -4.2e+50) (/ (- (log (- 1.0 z0))) (+ (/ (/ z3 z4) z4) (/ z1 (* z2 z2)))) (/ (- z0) (- (/ 1.0 (/ z2 (/ (- z1) z2))) (/ z3 (* z4 z4))))))
double code(double z0, double z3, double z4, double z1, double z2) {
double tmp;
if (z0 <= -4.2e+50) {
tmp = -log((1.0 - z0)) / (((z3 / z4) / z4) + (z1 / (z2 * z2)));
} else {
tmp = -z0 / ((1.0 / (z2 / (-z1 / z2))) - (z3 / (z4 * z4)));
}
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(z0, z3, z4, z1, z2)
use fmin_fmax_functions
real(8), intent (in) :: z0
real(8), intent (in) :: z3
real(8), intent (in) :: z4
real(8), intent (in) :: z1
real(8), intent (in) :: z2
real(8) :: tmp
if (z0 <= (-4.2d+50)) then
tmp = -log((1.0d0 - z0)) / (((z3 / z4) / z4) + (z1 / (z2 * z2)))
else
tmp = -z0 / ((1.0d0 / (z2 / (-z1 / z2))) - (z3 / (z4 * z4)))
end if
code = tmp
end function
public static double code(double z0, double z3, double z4, double z1, double z2) {
double tmp;
if (z0 <= -4.2e+50) {
tmp = -Math.log((1.0 - z0)) / (((z3 / z4) / z4) + (z1 / (z2 * z2)));
} else {
tmp = -z0 / ((1.0 / (z2 / (-z1 / z2))) - (z3 / (z4 * z4)));
}
return tmp;
}
def code(z0, z3, z4, z1, z2): tmp = 0 if z0 <= -4.2e+50: tmp = -math.log((1.0 - z0)) / (((z3 / z4) / z4) + (z1 / (z2 * z2))) else: tmp = -z0 / ((1.0 / (z2 / (-z1 / z2))) - (z3 / (z4 * z4))) return tmp
function code(z0, z3, z4, z1, z2) tmp = 0.0 if (z0 <= -4.2e+50) tmp = Float64(Float64(-log(Float64(1.0 - z0))) / Float64(Float64(Float64(z3 / z4) / z4) + Float64(z1 / Float64(z2 * z2)))); else tmp = Float64(Float64(-z0) / Float64(Float64(1.0 / Float64(z2 / Float64(Float64(-z1) / z2))) - Float64(z3 / Float64(z4 * z4)))); end return tmp end
function tmp_2 = code(z0, z3, z4, z1, z2) tmp = 0.0; if (z0 <= -4.2e+50) tmp = -log((1.0 - z0)) / (((z3 / z4) / z4) + (z1 / (z2 * z2))); else tmp = -z0 / ((1.0 / (z2 / (-z1 / z2))) - (z3 / (z4 * z4))); end tmp_2 = tmp; end
code[z0_, z3_, z4_, z1_, z2_] := If[LessEqual[z0, -4.2e+50], N[((-N[Log[N[(1.0 - z0), $MachinePrecision]], $MachinePrecision]) / N[(N[(N[(z3 / z4), $MachinePrecision] / z4), $MachinePrecision] + N[(z1 / N[(z2 * z2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[((-z0) / N[(N[(1.0 / N[(z2 / N[((-z1) / z2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(z3 / N[(z4 * z4), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;z0 \leq -4.2 \cdot 10^{+50}:\\
\;\;\;\;\frac{-\log \left(1 - z0\right)}{\frac{\frac{z3}{z4}}{z4} + \frac{z1}{z2 \cdot z2}}\\
\mathbf{else}:\\
\;\;\;\;\frac{-z0}{\frac{1}{\frac{z2}{\frac{-z1}{z2}}} - \frac{z3}{z4 \cdot z4}}\\
\end{array}
if z0 < -4.1999999999999999e50Initial program 65.5%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6468.3%
Applied rewrites68.3%
if -4.1999999999999999e50 < z0 Initial program 65.5%
Taylor expanded in z0 around 0
lower-*.f6471.8%
Applied rewrites71.8%
lift-/.f64N/A
lift-neg.f64N/A
distribute-frac-negN/A
distribute-neg-frac2N/A
lower-/.f64N/A
lift-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-neg.f64N/A
lower-neg.f64N/A
lower-neg.f64N/A
lower-neg.f64N/A
Applied rewrites71.9%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f64N/A
lift-neg.f64N/A
distribute-neg-frac2N/A
distribute-neg-fracN/A
lower-/.f64N/A
lower-neg.f6474.7%
Applied rewrites74.7%
(FPCore (z0 z3 z4 z1 z2)
:precision binary64
(let* ((t_0 (/ z3 (* z4 z4))))
(if (<= z0 -1.55e+50)
(/ (- (log (- z0))) (+ t_0 (/ z1 (* z2 z2))))
(/ (- z0) (- (/ 1.0 (/ z2 (/ (- z1) z2))) t_0)))))double code(double z0, double z3, double z4, double z1, double z2) {
double t_0 = z3 / (z4 * z4);
double tmp;
if (z0 <= -1.55e+50) {
tmp = -log(-z0) / (t_0 + (z1 / (z2 * z2)));
} else {
tmp = -z0 / ((1.0 / (z2 / (-z1 / z2))) - t_0);
}
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(z0, z3, z4, z1, z2)
use fmin_fmax_functions
real(8), intent (in) :: z0
real(8), intent (in) :: z3
real(8), intent (in) :: z4
real(8), intent (in) :: z1
real(8), intent (in) :: z2
real(8) :: t_0
real(8) :: tmp
t_0 = z3 / (z4 * z4)
if (z0 <= (-1.55d+50)) then
tmp = -log(-z0) / (t_0 + (z1 / (z2 * z2)))
else
tmp = -z0 / ((1.0d0 / (z2 / (-z1 / z2))) - t_0)
end if
code = tmp
end function
public static double code(double z0, double z3, double z4, double z1, double z2) {
double t_0 = z3 / (z4 * z4);
double tmp;
if (z0 <= -1.55e+50) {
tmp = -Math.log(-z0) / (t_0 + (z1 / (z2 * z2)));
} else {
tmp = -z0 / ((1.0 / (z2 / (-z1 / z2))) - t_0);
}
return tmp;
}
def code(z0, z3, z4, z1, z2): t_0 = z3 / (z4 * z4) tmp = 0 if z0 <= -1.55e+50: tmp = -math.log(-z0) / (t_0 + (z1 / (z2 * z2))) else: tmp = -z0 / ((1.0 / (z2 / (-z1 / z2))) - t_0) return tmp
function code(z0, z3, z4, z1, z2) t_0 = Float64(z3 / Float64(z4 * z4)) tmp = 0.0 if (z0 <= -1.55e+50) tmp = Float64(Float64(-log(Float64(-z0))) / Float64(t_0 + Float64(z1 / Float64(z2 * z2)))); else tmp = Float64(Float64(-z0) / Float64(Float64(1.0 / Float64(z2 / Float64(Float64(-z1) / z2))) - t_0)); end return tmp end
function tmp_2 = code(z0, z3, z4, z1, z2) t_0 = z3 / (z4 * z4); tmp = 0.0; if (z0 <= -1.55e+50) tmp = -log(-z0) / (t_0 + (z1 / (z2 * z2))); else tmp = -z0 / ((1.0 / (z2 / (-z1 / z2))) - t_0); end tmp_2 = tmp; end
code[z0_, z3_, z4_, z1_, z2_] := Block[{t$95$0 = N[(z3 / N[(z4 * z4), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z0, -1.55e+50], N[((-N[Log[(-z0)], $MachinePrecision]) / N[(t$95$0 + N[(z1 / N[(z2 * z2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[((-z0) / N[(N[(1.0 / N[(z2 / N[((-z1) / z2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
t_0 := \frac{z3}{z4 \cdot z4}\\
\mathbf{if}\;z0 \leq -1.55 \cdot 10^{+50}:\\
\;\;\;\;\frac{-\log \left(-z0\right)}{t\_0 + \frac{z1}{z2 \cdot z2}}\\
\mathbf{else}:\\
\;\;\;\;\frac{-z0}{\frac{1}{\frac{z2}{\frac{-z1}{z2}}} - t\_0}\\
\end{array}
if z0 < -1.55e50Initial program 65.5%
Taylor expanded in z0 around -inf
lower-log.f64N/A
lower-/.f6442.3%
Applied rewrites42.3%
lift-log.f64N/A
lift-/.f64N/A
frac-2negN/A
metadata-evalN/A
log-recN/A
lower-log.f64N/A
lower-unsound-log.f64N/A
lower-neg.f64N/A
lower-unsound-log.f64N/A
lower-neg.f6442.3%
Applied rewrites42.3%
if -1.55e50 < z0 Initial program 65.5%
Taylor expanded in z0 around 0
lower-*.f6471.8%
Applied rewrites71.8%
lift-/.f64N/A
lift-neg.f64N/A
distribute-frac-negN/A
distribute-neg-frac2N/A
lower-/.f64N/A
lift-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-neg.f64N/A
lower-neg.f64N/A
lower-neg.f64N/A
lower-neg.f64N/A
Applied rewrites71.9%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f64N/A
lift-neg.f64N/A
distribute-neg-frac2N/A
distribute-neg-fracN/A
lower-/.f64N/A
lower-neg.f6474.7%
Applied rewrites74.7%
(FPCore (z0 z3 z4 z1 z2)
:precision binary64
(let* ((t_0 (log (- 1.0 z0)))
(t_1 (/ z3 (* z4 z4)))
(t_2 (/ (- t_0) (+ t_1 (/ z1 (* z2 z2)))))
(t_3 (* (/ (* z2 t_0) z1) (- z2))))
(if (<= t_2 -1e-78)
t_3
(if (<= t_2 5e-283)
(/ (- z0) (- (/ 1.0 (/ z2 (/ (- z1) z2))) t_1))
(if (<= t_2 4e+92)
t_3
(/
(- (- z0))
(/ (/ 1.0 (/ z2 (+ (* (* z2 t_1) z2) z1))) z2)))))))double code(double z0, double z3, double z4, double z1, double z2) {
double t_0 = log((1.0 - z0));
double t_1 = z3 / (z4 * z4);
double t_2 = -t_0 / (t_1 + (z1 / (z2 * z2)));
double t_3 = ((z2 * t_0) / z1) * -z2;
double tmp;
if (t_2 <= -1e-78) {
tmp = t_3;
} else if (t_2 <= 5e-283) {
tmp = -z0 / ((1.0 / (z2 / (-z1 / z2))) - t_1);
} else if (t_2 <= 4e+92) {
tmp = t_3;
} else {
tmp = -(-z0) / ((1.0 / (z2 / (((z2 * t_1) * z2) + z1))) / z2);
}
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(z0, z3, z4, z1, z2)
use fmin_fmax_functions
real(8), intent (in) :: z0
real(8), intent (in) :: z3
real(8), intent (in) :: z4
real(8), intent (in) :: z1
real(8), intent (in) :: z2
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_0 = log((1.0d0 - z0))
t_1 = z3 / (z4 * z4)
t_2 = -t_0 / (t_1 + (z1 / (z2 * z2)))
t_3 = ((z2 * t_0) / z1) * -z2
if (t_2 <= (-1d-78)) then
tmp = t_3
else if (t_2 <= 5d-283) then
tmp = -z0 / ((1.0d0 / (z2 / (-z1 / z2))) - t_1)
else if (t_2 <= 4d+92) then
tmp = t_3
else
tmp = -(-z0) / ((1.0d0 / (z2 / (((z2 * t_1) * z2) + z1))) / z2)
end if
code = tmp
end function
public static double code(double z0, double z3, double z4, double z1, double z2) {
double t_0 = Math.log((1.0 - z0));
double t_1 = z3 / (z4 * z4);
double t_2 = -t_0 / (t_1 + (z1 / (z2 * z2)));
double t_3 = ((z2 * t_0) / z1) * -z2;
double tmp;
if (t_2 <= -1e-78) {
tmp = t_3;
} else if (t_2 <= 5e-283) {
tmp = -z0 / ((1.0 / (z2 / (-z1 / z2))) - t_1);
} else if (t_2 <= 4e+92) {
tmp = t_3;
} else {
tmp = -(-z0) / ((1.0 / (z2 / (((z2 * t_1) * z2) + z1))) / z2);
}
return tmp;
}
def code(z0, z3, z4, z1, z2): t_0 = math.log((1.0 - z0)) t_1 = z3 / (z4 * z4) t_2 = -t_0 / (t_1 + (z1 / (z2 * z2))) t_3 = ((z2 * t_0) / z1) * -z2 tmp = 0 if t_2 <= -1e-78: tmp = t_3 elif t_2 <= 5e-283: tmp = -z0 / ((1.0 / (z2 / (-z1 / z2))) - t_1) elif t_2 <= 4e+92: tmp = t_3 else: tmp = -(-z0) / ((1.0 / (z2 / (((z2 * t_1) * z2) + z1))) / z2) return tmp
function code(z0, z3, z4, z1, z2) t_0 = log(Float64(1.0 - z0)) t_1 = Float64(z3 / Float64(z4 * z4)) t_2 = Float64(Float64(-t_0) / Float64(t_1 + Float64(z1 / Float64(z2 * z2)))) t_3 = Float64(Float64(Float64(z2 * t_0) / z1) * Float64(-z2)) tmp = 0.0 if (t_2 <= -1e-78) tmp = t_3; elseif (t_2 <= 5e-283) tmp = Float64(Float64(-z0) / Float64(Float64(1.0 / Float64(z2 / Float64(Float64(-z1) / z2))) - t_1)); elseif (t_2 <= 4e+92) tmp = t_3; else tmp = Float64(Float64(-Float64(-z0)) / Float64(Float64(1.0 / Float64(z2 / Float64(Float64(Float64(z2 * t_1) * z2) + z1))) / z2)); end return tmp end
function tmp_2 = code(z0, z3, z4, z1, z2) t_0 = log((1.0 - z0)); t_1 = z3 / (z4 * z4); t_2 = -t_0 / (t_1 + (z1 / (z2 * z2))); t_3 = ((z2 * t_0) / z1) * -z2; tmp = 0.0; if (t_2 <= -1e-78) tmp = t_3; elseif (t_2 <= 5e-283) tmp = -z0 / ((1.0 / (z2 / (-z1 / z2))) - t_1); elseif (t_2 <= 4e+92) tmp = t_3; else tmp = -(-z0) / ((1.0 / (z2 / (((z2 * t_1) * z2) + z1))) / z2); end tmp_2 = tmp; end
code[z0_, z3_, z4_, z1_, z2_] := Block[{t$95$0 = N[Log[N[(1.0 - z0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(z3 / N[(z4 * z4), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[((-t$95$0) / N[(t$95$1 + N[(z1 / N[(z2 * z2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(N[(z2 * t$95$0), $MachinePrecision] / z1), $MachinePrecision] * (-z2)), $MachinePrecision]}, If[LessEqual[t$95$2, -1e-78], t$95$3, If[LessEqual[t$95$2, 5e-283], N[((-z0) / N[(N[(1.0 / N[(z2 / N[((-z1) / z2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 4e+92], t$95$3, N[((-(-z0)) / N[(N[(1.0 / N[(z2 / N[(N[(N[(z2 * t$95$1), $MachinePrecision] * z2), $MachinePrecision] + z1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z2), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
t_0 := \log \left(1 - z0\right)\\
t_1 := \frac{z3}{z4 \cdot z4}\\
t_2 := \frac{-t\_0}{t\_1 + \frac{z1}{z2 \cdot z2}}\\
t_3 := \frac{z2 \cdot t\_0}{z1} \cdot \left(-z2\right)\\
\mathbf{if}\;t\_2 \leq -1 \cdot 10^{-78}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{-283}:\\
\;\;\;\;\frac{-z0}{\frac{1}{\frac{z2}{\frac{-z1}{z2}}} - t\_1}\\
\mathbf{elif}\;t\_2 \leq 4 \cdot 10^{+92}:\\
\;\;\;\;t\_3\\
\mathbf{else}:\\
\;\;\;\;\frac{-\left(-z0\right)}{\frac{\frac{1}{\frac{z2}{\left(z2 \cdot t\_1\right) \cdot z2 + z1}}}{z2}}\\
\end{array}
if (/.f64 (neg.f64 (log.f64 (-.f64 #s(literal 1 binary64) z0))) (+.f64 (/.f64 z3 (*.f64 z4 z4)) (/.f64 z1 (*.f64 z2 z2)))) < -1e-78 or 5.0000000000000001e-283 < (/.f64 (neg.f64 (log.f64 (-.f64 #s(literal 1 binary64) z0))) (+.f64 (/.f64 z3 (*.f64 z4 z4)) (/.f64 z1 (*.f64 z2 z2)))) < 4.0000000000000002e92Initial program 65.5%
Taylor expanded in z0 around 0
lower-*.f6471.8%
Applied rewrites71.8%
lift-+.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
add-to-fractionN/A
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f6475.6%
Applied rewrites75.6%
lift-/.f64N/A
lift-/.f64N/A
frac-2negN/A
lift-neg.f64N/A
associate-/r/N/A
lower-*.f64N/A
Applied rewrites72.0%
Taylor expanded in z3 around 0
lower-/.f64N/A
lower-*.f64N/A
lower-log.f64N/A
lower--.f6458.8%
Applied rewrites58.8%
if -1e-78 < (/.f64 (neg.f64 (log.f64 (-.f64 #s(literal 1 binary64) z0))) (+.f64 (/.f64 z3 (*.f64 z4 z4)) (/.f64 z1 (*.f64 z2 z2)))) < 5.0000000000000001e-283Initial program 65.5%
Taylor expanded in z0 around 0
lower-*.f6471.8%
Applied rewrites71.8%
lift-/.f64N/A
lift-neg.f64N/A
distribute-frac-negN/A
distribute-neg-frac2N/A
lower-/.f64N/A
lift-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-neg.f64N/A
lower-neg.f64N/A
lower-neg.f64N/A
lower-neg.f64N/A
Applied rewrites71.9%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f64N/A
lift-neg.f64N/A
distribute-neg-frac2N/A
distribute-neg-fracN/A
lower-/.f64N/A
lower-neg.f6474.7%
Applied rewrites74.7%
if 4.0000000000000002e92 < (/.f64 (neg.f64 (log.f64 (-.f64 #s(literal 1 binary64) z0))) (+.f64 (/.f64 z3 (*.f64 z4 z4)) (/.f64 z1 (*.f64 z2 z2)))) Initial program 65.5%
Taylor expanded in z0 around 0
lower-*.f6471.8%
Applied rewrites71.8%
lift-+.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
add-to-fractionN/A
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f6475.6%
Applied rewrites75.6%
lift-*.f64N/A
mul-1-negN/A
lift-neg.f6475.6%
Applied rewrites75.6%
lift-+.f64N/A
lift-/.f64N/A
add-to-fractionN/A
div-flipN/A
lower-unsound-/.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
lower-unsound-/.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
lower-+.f64N/A
lower-*.f6474.4%
lift-*.f64N/A
*-commutativeN/A
lift-*.f6474.4%
Applied rewrites74.4%
(FPCore (z0 z3 z4 z1 z2)
:precision binary64
(if (<= (fabs z2) 3.95e+208)
(/
(- (- z0))
(/
(/
1.0
(/
(fabs z2)
(+ (* (* (fabs z2) (/ z3 (* z4 z4))) (fabs z2)) z1)))
(fabs z2)))
(/
(- z0)
(- (/ z1 (* (- (fabs z2)) (fabs z2))) (* (/ z3 z4) (/ 1.0 z4))))))double code(double z0, double z3, double z4, double z1, double z2) {
double tmp;
if (fabs(z2) <= 3.95e+208) {
tmp = -(-z0) / ((1.0 / (fabs(z2) / (((fabs(z2) * (z3 / (z4 * z4))) * fabs(z2)) + z1))) / fabs(z2));
} else {
tmp = -z0 / ((z1 / (-fabs(z2) * fabs(z2))) - ((z3 / z4) * (1.0 / z4)));
}
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(z0, z3, z4, z1, z2)
use fmin_fmax_functions
real(8), intent (in) :: z0
real(8), intent (in) :: z3
real(8), intent (in) :: z4
real(8), intent (in) :: z1
real(8), intent (in) :: z2
real(8) :: tmp
if (abs(z2) <= 3.95d+208) then
tmp = -(-z0) / ((1.0d0 / (abs(z2) / (((abs(z2) * (z3 / (z4 * z4))) * abs(z2)) + z1))) / abs(z2))
else
tmp = -z0 / ((z1 / (-abs(z2) * abs(z2))) - ((z3 / z4) * (1.0d0 / z4)))
end if
code = tmp
end function
public static double code(double z0, double z3, double z4, double z1, double z2) {
double tmp;
if (Math.abs(z2) <= 3.95e+208) {
tmp = -(-z0) / ((1.0 / (Math.abs(z2) / (((Math.abs(z2) * (z3 / (z4 * z4))) * Math.abs(z2)) + z1))) / Math.abs(z2));
} else {
tmp = -z0 / ((z1 / (-Math.abs(z2) * Math.abs(z2))) - ((z3 / z4) * (1.0 / z4)));
}
return tmp;
}
def code(z0, z3, z4, z1, z2): tmp = 0 if math.fabs(z2) <= 3.95e+208: tmp = -(-z0) / ((1.0 / (math.fabs(z2) / (((math.fabs(z2) * (z3 / (z4 * z4))) * math.fabs(z2)) + z1))) / math.fabs(z2)) else: tmp = -z0 / ((z1 / (-math.fabs(z2) * math.fabs(z2))) - ((z3 / z4) * (1.0 / z4))) return tmp
function code(z0, z3, z4, z1, z2) tmp = 0.0 if (abs(z2) <= 3.95e+208) tmp = Float64(Float64(-Float64(-z0)) / Float64(Float64(1.0 / Float64(abs(z2) / Float64(Float64(Float64(abs(z2) * Float64(z3 / Float64(z4 * z4))) * abs(z2)) + z1))) / abs(z2))); else tmp = Float64(Float64(-z0) / Float64(Float64(z1 / Float64(Float64(-abs(z2)) * abs(z2))) - Float64(Float64(z3 / z4) * Float64(1.0 / z4)))); end return tmp end
function tmp_2 = code(z0, z3, z4, z1, z2) tmp = 0.0; if (abs(z2) <= 3.95e+208) tmp = -(-z0) / ((1.0 / (abs(z2) / (((abs(z2) * (z3 / (z4 * z4))) * abs(z2)) + z1))) / abs(z2)); else tmp = -z0 / ((z1 / (-abs(z2) * abs(z2))) - ((z3 / z4) * (1.0 / z4))); end tmp_2 = tmp; end
code[z0_, z3_, z4_, z1_, z2_] := If[LessEqual[N[Abs[z2], $MachinePrecision], 3.95e+208], N[((-(-z0)) / N[(N[(1.0 / N[(N[Abs[z2], $MachinePrecision] / N[(N[(N[(N[Abs[z2], $MachinePrecision] * N[(z3 / N[(z4 * z4), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Abs[z2], $MachinePrecision]), $MachinePrecision] + z1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Abs[z2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[((-z0) / N[(N[(z1 / N[((-N[Abs[z2], $MachinePrecision]) * N[Abs[z2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(z3 / z4), $MachinePrecision] * N[(1.0 / z4), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;\left|z2\right| \leq 3.95 \cdot 10^{+208}:\\
\;\;\;\;\frac{-\left(-z0\right)}{\frac{\frac{1}{\frac{\left|z2\right|}{\left(\left|z2\right| \cdot \frac{z3}{z4 \cdot z4}\right) \cdot \left|z2\right| + z1}}}{\left|z2\right|}}\\
\mathbf{else}:\\
\;\;\;\;\frac{-z0}{\frac{z1}{\left(-\left|z2\right|\right) \cdot \left|z2\right|} - \frac{z3}{z4} \cdot \frac{1}{z4}}\\
\end{array}
if z2 < 3.95e208Initial program 65.5%
Taylor expanded in z0 around 0
lower-*.f6471.8%
Applied rewrites71.8%
lift-+.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
add-to-fractionN/A
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f6475.6%
Applied rewrites75.6%
lift-*.f64N/A
mul-1-negN/A
lift-neg.f6475.6%
Applied rewrites75.6%
lift-+.f64N/A
lift-/.f64N/A
add-to-fractionN/A
div-flipN/A
lower-unsound-/.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
lower-unsound-/.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
lower-+.f64N/A
lower-*.f6474.4%
lift-*.f64N/A
*-commutativeN/A
lift-*.f6474.4%
Applied rewrites74.4%
if 3.95e208 < z2 Initial program 65.5%
Taylor expanded in z0 around 0
lower-*.f6471.8%
Applied rewrites71.8%
lift-/.f64N/A
lift-neg.f64N/A
distribute-frac-negN/A
distribute-neg-frac2N/A
lower-/.f64N/A
lift-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-neg.f64N/A
lower-neg.f64N/A
lower-neg.f64N/A
lower-neg.f64N/A
Applied rewrites71.9%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lift-/.f64N/A
mult-flipN/A
lower-*.f64N/A
lower-/.f6475.0%
Applied rewrites75.0%
(FPCore (z0 z3 z4 z1 z2)
:precision binary64
(let* ((t_0 (/ z3 (* z4 z4))))
(if (<= (+ t_0 (/ z1 (* z2 z2))) INFINITY)
(/ (- (* -1.0 z0)) (+ t_0 (/ (/ z1 z2) z2)))
(* (* (/ (- (- z0)) (+ (* (* z2 t_0) z2) z1)) z2) z2))))double code(double z0, double z3, double z4, double z1, double z2) {
double t_0 = z3 / (z4 * z4);
double tmp;
if ((t_0 + (z1 / (z2 * z2))) <= ((double) INFINITY)) {
tmp = -(-1.0 * z0) / (t_0 + ((z1 / z2) / z2));
} else {
tmp = ((-(-z0) / (((z2 * t_0) * z2) + z1)) * z2) * z2;
}
return tmp;
}
public static double code(double z0, double z3, double z4, double z1, double z2) {
double t_0 = z3 / (z4 * z4);
double tmp;
if ((t_0 + (z1 / (z2 * z2))) <= Double.POSITIVE_INFINITY) {
tmp = -(-1.0 * z0) / (t_0 + ((z1 / z2) / z2));
} else {
tmp = ((-(-z0) / (((z2 * t_0) * z2) + z1)) * z2) * z2;
}
return tmp;
}
def code(z0, z3, z4, z1, z2): t_0 = z3 / (z4 * z4) tmp = 0 if (t_0 + (z1 / (z2 * z2))) <= math.inf: tmp = -(-1.0 * z0) / (t_0 + ((z1 / z2) / z2)) else: tmp = ((-(-z0) / (((z2 * t_0) * z2) + z1)) * z2) * z2 return tmp
function code(z0, z3, z4, z1, z2) t_0 = Float64(z3 / Float64(z4 * z4)) tmp = 0.0 if (Float64(t_0 + Float64(z1 / Float64(z2 * z2))) <= Inf) tmp = Float64(Float64(-Float64(-1.0 * z0)) / Float64(t_0 + Float64(Float64(z1 / z2) / z2))); else tmp = Float64(Float64(Float64(Float64(-Float64(-z0)) / Float64(Float64(Float64(z2 * t_0) * z2) + z1)) * z2) * z2); end return tmp end
function tmp_2 = code(z0, z3, z4, z1, z2) t_0 = z3 / (z4 * z4); tmp = 0.0; if ((t_0 + (z1 / (z2 * z2))) <= Inf) tmp = -(-1.0 * z0) / (t_0 + ((z1 / z2) / z2)); else tmp = ((-(-z0) / (((z2 * t_0) * z2) + z1)) * z2) * z2; end tmp_2 = tmp; end
code[z0_, z3_, z4_, z1_, z2_] := Block[{t$95$0 = N[(z3 / N[(z4 * z4), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(t$95$0 + N[(z1 / N[(z2 * z2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], Infinity], N[((-N[(-1.0 * z0), $MachinePrecision]) / N[(t$95$0 + N[(N[(z1 / z2), $MachinePrecision] / z2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[((-(-z0)) / N[(N[(N[(z2 * t$95$0), $MachinePrecision] * z2), $MachinePrecision] + z1), $MachinePrecision]), $MachinePrecision] * z2), $MachinePrecision] * z2), $MachinePrecision]]]
\begin{array}{l}
t_0 := \frac{z3}{z4 \cdot z4}\\
\mathbf{if}\;t\_0 + \frac{z1}{z2 \cdot z2} \leq \infty:\\
\;\;\;\;\frac{--1 \cdot z0}{t\_0 + \frac{\frac{z1}{z2}}{z2}}\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{-\left(-z0\right)}{\left(z2 \cdot t\_0\right) \cdot z2 + z1} \cdot z2\right) \cdot z2\\
\end{array}
if (+.f64 (/.f64 z3 (*.f64 z4 z4)) (/.f64 z1 (*.f64 z2 z2))) < +inf.0Initial program 65.5%
Taylor expanded in z0 around 0
lower-*.f6471.8%
Applied rewrites71.8%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6474.8%
Applied rewrites74.8%
if +inf.0 < (+.f64 (/.f64 z3 (*.f64 z4 z4)) (/.f64 z1 (*.f64 z2 z2))) Initial program 65.5%
Taylor expanded in z0 around 0
lower-*.f6471.8%
Applied rewrites71.8%
lift-+.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
add-to-fractionN/A
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f6475.6%
Applied rewrites75.6%
Applied rewrites69.1%
(FPCore (z0 z3 z4 z1 z2)
:precision binary64
(if (<= (fabs z2) 3.6e-118)
(*
(*
(/ (- (- z0)) (+ (* (* (fabs z2) (/ z3 (* z4 z4))) (fabs z2)) z1))
(fabs z2))
(fabs z2))
(/ (- z0) (- (/ z1 (* (- (fabs z2)) (fabs z2))) (/ (/ z3 z4) z4)))))double code(double z0, double z3, double z4, double z1, double z2) {
double tmp;
if (fabs(z2) <= 3.6e-118) {
tmp = ((-(-z0) / (((fabs(z2) * (z3 / (z4 * z4))) * fabs(z2)) + z1)) * fabs(z2)) * fabs(z2);
} else {
tmp = -z0 / ((z1 / (-fabs(z2) * fabs(z2))) - ((z3 / z4) / z4));
}
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(z0, z3, z4, z1, z2)
use fmin_fmax_functions
real(8), intent (in) :: z0
real(8), intent (in) :: z3
real(8), intent (in) :: z4
real(8), intent (in) :: z1
real(8), intent (in) :: z2
real(8) :: tmp
if (abs(z2) <= 3.6d-118) then
tmp = ((-(-z0) / (((abs(z2) * (z3 / (z4 * z4))) * abs(z2)) + z1)) * abs(z2)) * abs(z2)
else
tmp = -z0 / ((z1 / (-abs(z2) * abs(z2))) - ((z3 / z4) / z4))
end if
code = tmp
end function
public static double code(double z0, double z3, double z4, double z1, double z2) {
double tmp;
if (Math.abs(z2) <= 3.6e-118) {
tmp = ((-(-z0) / (((Math.abs(z2) * (z3 / (z4 * z4))) * Math.abs(z2)) + z1)) * Math.abs(z2)) * Math.abs(z2);
} else {
tmp = -z0 / ((z1 / (-Math.abs(z2) * Math.abs(z2))) - ((z3 / z4) / z4));
}
return tmp;
}
def code(z0, z3, z4, z1, z2): tmp = 0 if math.fabs(z2) <= 3.6e-118: tmp = ((-(-z0) / (((math.fabs(z2) * (z3 / (z4 * z4))) * math.fabs(z2)) + z1)) * math.fabs(z2)) * math.fabs(z2) else: tmp = -z0 / ((z1 / (-math.fabs(z2) * math.fabs(z2))) - ((z3 / z4) / z4)) return tmp
function code(z0, z3, z4, z1, z2) tmp = 0.0 if (abs(z2) <= 3.6e-118) tmp = Float64(Float64(Float64(Float64(-Float64(-z0)) / Float64(Float64(Float64(abs(z2) * Float64(z3 / Float64(z4 * z4))) * abs(z2)) + z1)) * abs(z2)) * abs(z2)); else tmp = Float64(Float64(-z0) / Float64(Float64(z1 / Float64(Float64(-abs(z2)) * abs(z2))) - Float64(Float64(z3 / z4) / z4))); end return tmp end
function tmp_2 = code(z0, z3, z4, z1, z2) tmp = 0.0; if (abs(z2) <= 3.6e-118) tmp = ((-(-z0) / (((abs(z2) * (z3 / (z4 * z4))) * abs(z2)) + z1)) * abs(z2)) * abs(z2); else tmp = -z0 / ((z1 / (-abs(z2) * abs(z2))) - ((z3 / z4) / z4)); end tmp_2 = tmp; end
code[z0_, z3_, z4_, z1_, z2_] := If[LessEqual[N[Abs[z2], $MachinePrecision], 3.6e-118], N[(N[(N[((-(-z0)) / N[(N[(N[(N[Abs[z2], $MachinePrecision] * N[(z3 / N[(z4 * z4), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Abs[z2], $MachinePrecision]), $MachinePrecision] + z1), $MachinePrecision]), $MachinePrecision] * N[Abs[z2], $MachinePrecision]), $MachinePrecision] * N[Abs[z2], $MachinePrecision]), $MachinePrecision], N[((-z0) / N[(N[(z1 / N[((-N[Abs[z2], $MachinePrecision]) * N[Abs[z2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(z3 / z4), $MachinePrecision] / z4), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;\left|z2\right| \leq 3.6 \cdot 10^{-118}:\\
\;\;\;\;\left(\frac{-\left(-z0\right)}{\left(\left|z2\right| \cdot \frac{z3}{z4 \cdot z4}\right) \cdot \left|z2\right| + z1} \cdot \left|z2\right|\right) \cdot \left|z2\right|\\
\mathbf{else}:\\
\;\;\;\;\frac{-z0}{\frac{z1}{\left(-\left|z2\right|\right) \cdot \left|z2\right|} - \frac{\frac{z3}{z4}}{z4}}\\
\end{array}
if z2 < 3.6000000000000002e-118Initial program 65.5%
Taylor expanded in z0 around 0
lower-*.f6471.8%
Applied rewrites71.8%
lift-+.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
add-to-fractionN/A
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f6475.6%
Applied rewrites75.6%
Applied rewrites69.1%
if 3.6000000000000002e-118 < z2 Initial program 65.5%
Taylor expanded in z0 around 0
lower-*.f6471.8%
Applied rewrites71.8%
lift-/.f64N/A
lift-neg.f64N/A
distribute-frac-negN/A
distribute-neg-frac2N/A
lower-/.f64N/A
lift-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-neg.f64N/A
lower-neg.f64N/A
lower-neg.f64N/A
lower-neg.f64N/A
Applied rewrites71.9%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lift-/.f64N/A
lower-/.f6475.1%
Applied rewrites75.1%
(FPCore (z0 z3 z4 z1 z2)
:precision binary64
(let* ((t_0 (/ z3 (* z4 z4))))
(if (<= (fabs z2) 4e-118)
(*
(*
(/ (- (- z0)) (+ (* (* (fabs z2) t_0) (fabs z2)) z1))
(fabs z2))
(fabs z2))
(/ (- z0) (- (/ z1 (* (- (fabs z2)) (fabs z2))) t_0)))))double code(double z0, double z3, double z4, double z1, double z2) {
double t_0 = z3 / (z4 * z4);
double tmp;
if (fabs(z2) <= 4e-118) {
tmp = ((-(-z0) / (((fabs(z2) * t_0) * fabs(z2)) + z1)) * fabs(z2)) * fabs(z2);
} else {
tmp = -z0 / ((z1 / (-fabs(z2) * fabs(z2))) - t_0);
}
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(z0, z3, z4, z1, z2)
use fmin_fmax_functions
real(8), intent (in) :: z0
real(8), intent (in) :: z3
real(8), intent (in) :: z4
real(8), intent (in) :: z1
real(8), intent (in) :: z2
real(8) :: t_0
real(8) :: tmp
t_0 = z3 / (z4 * z4)
if (abs(z2) <= 4d-118) then
tmp = ((-(-z0) / (((abs(z2) * t_0) * abs(z2)) + z1)) * abs(z2)) * abs(z2)
else
tmp = -z0 / ((z1 / (-abs(z2) * abs(z2))) - t_0)
end if
code = tmp
end function
public static double code(double z0, double z3, double z4, double z1, double z2) {
double t_0 = z3 / (z4 * z4);
double tmp;
if (Math.abs(z2) <= 4e-118) {
tmp = ((-(-z0) / (((Math.abs(z2) * t_0) * Math.abs(z2)) + z1)) * Math.abs(z2)) * Math.abs(z2);
} else {
tmp = -z0 / ((z1 / (-Math.abs(z2) * Math.abs(z2))) - t_0);
}
return tmp;
}
def code(z0, z3, z4, z1, z2): t_0 = z3 / (z4 * z4) tmp = 0 if math.fabs(z2) <= 4e-118: tmp = ((-(-z0) / (((math.fabs(z2) * t_0) * math.fabs(z2)) + z1)) * math.fabs(z2)) * math.fabs(z2) else: tmp = -z0 / ((z1 / (-math.fabs(z2) * math.fabs(z2))) - t_0) return tmp
function code(z0, z3, z4, z1, z2) t_0 = Float64(z3 / Float64(z4 * z4)) tmp = 0.0 if (abs(z2) <= 4e-118) tmp = Float64(Float64(Float64(Float64(-Float64(-z0)) / Float64(Float64(Float64(abs(z2) * t_0) * abs(z2)) + z1)) * abs(z2)) * abs(z2)); else tmp = Float64(Float64(-z0) / Float64(Float64(z1 / Float64(Float64(-abs(z2)) * abs(z2))) - t_0)); end return tmp end
function tmp_2 = code(z0, z3, z4, z1, z2) t_0 = z3 / (z4 * z4); tmp = 0.0; if (abs(z2) <= 4e-118) tmp = ((-(-z0) / (((abs(z2) * t_0) * abs(z2)) + z1)) * abs(z2)) * abs(z2); else tmp = -z0 / ((z1 / (-abs(z2) * abs(z2))) - t_0); end tmp_2 = tmp; end
code[z0_, z3_, z4_, z1_, z2_] := Block[{t$95$0 = N[(z3 / N[(z4 * z4), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Abs[z2], $MachinePrecision], 4e-118], N[(N[(N[((-(-z0)) / N[(N[(N[(N[Abs[z2], $MachinePrecision] * t$95$0), $MachinePrecision] * N[Abs[z2], $MachinePrecision]), $MachinePrecision] + z1), $MachinePrecision]), $MachinePrecision] * N[Abs[z2], $MachinePrecision]), $MachinePrecision] * N[Abs[z2], $MachinePrecision]), $MachinePrecision], N[((-z0) / N[(N[(z1 / N[((-N[Abs[z2], $MachinePrecision]) * N[Abs[z2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
t_0 := \frac{z3}{z4 \cdot z4}\\
\mathbf{if}\;\left|z2\right| \leq 4 \cdot 10^{-118}:\\
\;\;\;\;\left(\frac{-\left(-z0\right)}{\left(\left|z2\right| \cdot t\_0\right) \cdot \left|z2\right| + z1} \cdot \left|z2\right|\right) \cdot \left|z2\right|\\
\mathbf{else}:\\
\;\;\;\;\frac{-z0}{\frac{z1}{\left(-\left|z2\right|\right) \cdot \left|z2\right|} - t\_0}\\
\end{array}
if z2 < 3.9999999999999999e-118Initial program 65.5%
Taylor expanded in z0 around 0
lower-*.f6471.8%
Applied rewrites71.8%
lift-+.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
add-to-fractionN/A
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f6475.6%
Applied rewrites75.6%
Applied rewrites69.1%
if 3.9999999999999999e-118 < z2 Initial program 65.5%
Taylor expanded in z0 around 0
lower-*.f6471.8%
Applied rewrites71.8%
lift-/.f64N/A
lift-neg.f64N/A
distribute-frac-negN/A
distribute-neg-frac2N/A
lower-/.f64N/A
lift-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-neg.f64N/A
lower-neg.f64N/A
lower-neg.f64N/A
lower-neg.f64N/A
Applied rewrites71.9%
(FPCore (z0 z3 z4 z1 z2) :precision binary64 (if (<= (fabs z2) 4.1e-118) (* (- z0) (/ -1.0 (/ (/ z1 (fabs z2)) (fabs z2)))) (/ (- z0) (- (/ z1 (* (- (fabs z2)) (fabs z2))) (/ z3 (* z4 z4))))))
double code(double z0, double z3, double z4, double z1, double z2) {
double tmp;
if (fabs(z2) <= 4.1e-118) {
tmp = -z0 * (-1.0 / ((z1 / fabs(z2)) / fabs(z2)));
} else {
tmp = -z0 / ((z1 / (-fabs(z2) * fabs(z2))) - (z3 / (z4 * z4)));
}
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(z0, z3, z4, z1, z2)
use fmin_fmax_functions
real(8), intent (in) :: z0
real(8), intent (in) :: z3
real(8), intent (in) :: z4
real(8), intent (in) :: z1
real(8), intent (in) :: z2
real(8) :: tmp
if (abs(z2) <= 4.1d-118) then
tmp = -z0 * ((-1.0d0) / ((z1 / abs(z2)) / abs(z2)))
else
tmp = -z0 / ((z1 / (-abs(z2) * abs(z2))) - (z3 / (z4 * z4)))
end if
code = tmp
end function
public static double code(double z0, double z3, double z4, double z1, double z2) {
double tmp;
if (Math.abs(z2) <= 4.1e-118) {
tmp = -z0 * (-1.0 / ((z1 / Math.abs(z2)) / Math.abs(z2)));
} else {
tmp = -z0 / ((z1 / (-Math.abs(z2) * Math.abs(z2))) - (z3 / (z4 * z4)));
}
return tmp;
}
def code(z0, z3, z4, z1, z2): tmp = 0 if math.fabs(z2) <= 4.1e-118: tmp = -z0 * (-1.0 / ((z1 / math.fabs(z2)) / math.fabs(z2))) else: tmp = -z0 / ((z1 / (-math.fabs(z2) * math.fabs(z2))) - (z3 / (z4 * z4))) return tmp
function code(z0, z3, z4, z1, z2) tmp = 0.0 if (abs(z2) <= 4.1e-118) tmp = Float64(Float64(-z0) * Float64(-1.0 / Float64(Float64(z1 / abs(z2)) / abs(z2)))); else tmp = Float64(Float64(-z0) / Float64(Float64(z1 / Float64(Float64(-abs(z2)) * abs(z2))) - Float64(z3 / Float64(z4 * z4)))); end return tmp end
function tmp_2 = code(z0, z3, z4, z1, z2) tmp = 0.0; if (abs(z2) <= 4.1e-118) tmp = -z0 * (-1.0 / ((z1 / abs(z2)) / abs(z2))); else tmp = -z0 / ((z1 / (-abs(z2) * abs(z2))) - (z3 / (z4 * z4))); end tmp_2 = tmp; end
code[z0_, z3_, z4_, z1_, z2_] := If[LessEqual[N[Abs[z2], $MachinePrecision], 4.1e-118], N[((-z0) * N[(-1.0 / N[(N[(z1 / N[Abs[z2], $MachinePrecision]), $MachinePrecision] / N[Abs[z2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[((-z0) / N[(N[(z1 / N[((-N[Abs[z2], $MachinePrecision]) * N[Abs[z2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(z3 / N[(z4 * z4), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;\left|z2\right| \leq 4.1 \cdot 10^{-118}:\\
\;\;\;\;\left(-z0\right) \cdot \frac{-1}{\frac{\frac{z1}{\left|z2\right|}}{\left|z2\right|}}\\
\mathbf{else}:\\
\;\;\;\;\frac{-z0}{\frac{z1}{\left(-\left|z2\right|\right) \cdot \left|z2\right|} - \frac{z3}{z4 \cdot z4}}\\
\end{array}
if z2 < 4.1000000000000003e-118Initial program 65.5%
Taylor expanded in z0 around 0
lower-*.f6471.8%
Applied rewrites71.8%
lift-+.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
add-to-fractionN/A
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f6475.6%
Applied rewrites75.6%
Taylor expanded in z3 around 0
lower-/.f6447.7%
Applied rewrites47.7%
lift-/.f64N/A
frac-2negN/A
lift-neg.f64N/A
lift-*.f64N/A
mul-1-negN/A
lift-neg.f64N/A
lift-neg.f64N/A
mult-flipN/A
lift-neg.f64N/A
remove-double-negN/A
lower-*.f64N/A
Applied rewrites47.5%
if 4.1000000000000003e-118 < z2 Initial program 65.5%
Taylor expanded in z0 around 0
lower-*.f6471.8%
Applied rewrites71.8%
lift-/.f64N/A
lift-neg.f64N/A
distribute-frac-negN/A
distribute-neg-frac2N/A
lower-/.f64N/A
lift-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-neg.f64N/A
lower-neg.f64N/A
lower-neg.f64N/A
lower-neg.f64N/A
Applied rewrites71.9%
(FPCore (z0 z3 z4 z1 z2) :precision binary64 (/ (- (- z0)) (/ (/ z1 z2) z2)))
double code(double z0, double z3, double z4, double z1, double z2) {
return -(-z0) / ((z1 / z2) / z2);
}
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(z0, z3, z4, z1, z2)
use fmin_fmax_functions
real(8), intent (in) :: z0
real(8), intent (in) :: z3
real(8), intent (in) :: z4
real(8), intent (in) :: z1
real(8), intent (in) :: z2
code = -(-z0) / ((z1 / z2) / z2)
end function
public static double code(double z0, double z3, double z4, double z1, double z2) {
return -(-z0) / ((z1 / z2) / z2);
}
def code(z0, z3, z4, z1, z2): return -(-z0) / ((z1 / z2) / z2)
function code(z0, z3, z4, z1, z2) return Float64(Float64(-Float64(-z0)) / Float64(Float64(z1 / z2) / z2)) end
function tmp = code(z0, z3, z4, z1, z2) tmp = -(-z0) / ((z1 / z2) / z2); end
code[z0_, z3_, z4_, z1_, z2_] := N[((-(-z0)) / N[(N[(z1 / z2), $MachinePrecision] / z2), $MachinePrecision]), $MachinePrecision]
\frac{-\left(-z0\right)}{\frac{\frac{z1}{z2}}{z2}}
Initial program 65.5%
Taylor expanded in z0 around 0
lower-*.f6471.8%
Applied rewrites71.8%
lift-+.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
add-to-fractionN/A
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f6475.6%
Applied rewrites75.6%
Taylor expanded in z3 around 0
lower-/.f6447.7%
Applied rewrites47.7%
lift-neg.f64N/A
lift-*.f64N/A
mul-1-negN/A
lift-neg.f64N/A
lift-neg.f6447.7%
Applied rewrites47.7%
(FPCore (z0 z3 z4 z1 z2) :precision binary64 (* (/ z2 (/ z1 z2)) (- (- z0))))
double code(double z0, double z3, double z4, double z1, double z2) {
return (z2 / (z1 / z2)) * -(-z0);
}
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(z0, z3, z4, z1, z2)
use fmin_fmax_functions
real(8), intent (in) :: z0
real(8), intent (in) :: z3
real(8), intent (in) :: z4
real(8), intent (in) :: z1
real(8), intent (in) :: z2
code = (z2 / (z1 / z2)) * -(-z0)
end function
public static double code(double z0, double z3, double z4, double z1, double z2) {
return (z2 / (z1 / z2)) * -(-z0);
}
def code(z0, z3, z4, z1, z2): return (z2 / (z1 / z2)) * -(-z0)
function code(z0, z3, z4, z1, z2) return Float64(Float64(z2 / Float64(z1 / z2)) * Float64(-Float64(-z0))) end
function tmp = code(z0, z3, z4, z1, z2) tmp = (z2 / (z1 / z2)) * -(-z0); end
code[z0_, z3_, z4_, z1_, z2_] := N[(N[(z2 / N[(z1 / z2), $MachinePrecision]), $MachinePrecision] * (-(-z0))), $MachinePrecision]
\frac{z2}{\frac{z1}{z2}} \cdot \left(-\left(-z0\right)\right)
Initial program 65.5%
Taylor expanded in z0 around 0
lower-*.f6471.8%
Applied rewrites71.8%
lift-+.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
add-to-fractionN/A
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f6475.6%
Applied rewrites75.6%
Taylor expanded in z3 around 0
lower-/.f6447.7%
Applied rewrites47.7%
lift-/.f64N/A
mult-flipN/A
lift-neg.f64N/A
lift-*.f64N/A
mul-1-negN/A
lift-neg.f64N/A
lift-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-/.f64N/A
div-flip-revN/A
lower-/.f6447.3%
Applied rewrites47.3%
herbie shell --seed 2025250
(FPCore (z0 z3 z4 z1 z2)
:name "(/ (- (log (- 1 z0))) (+ (/ z3 (* z4 z4)) (/ z1 (* z2 z2))))"
:precision binary64
(/ (- (log (- 1.0 z0))) (+ (/ z3 (* z4 z4)) (/ z1 (* z2 z2)))))