
(FPCore (d1 d2 d3 d4) :precision binary64 (- (+ (- (* d1 d2) (* d1 d3)) (* d4 d1)) (* d1 d1)))
double code(double d1, double d2, double d3, double d4) {
return (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1);
}
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(d1, d2, d3, d4)
use fmin_fmax_functions
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
code = (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1)
end function
public static double code(double d1, double d2, double d3, double d4) {
return (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1);
}
def code(d1, d2, d3, d4): return (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1)
function code(d1, d2, d3, d4) return Float64(Float64(Float64(Float64(d1 * d2) - Float64(d1 * d3)) + Float64(d4 * d1)) - Float64(d1 * d1)) end
function tmp = code(d1, d2, d3, d4) tmp = (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1); end
code[d1_, d2_, d3_, d4_] := N[(N[(N[(N[(d1 * d2), $MachinePrecision] - N[(d1 * d3), $MachinePrecision]), $MachinePrecision] + N[(d4 * d1), $MachinePrecision]), $MachinePrecision] - N[(d1 * d1), $MachinePrecision]), $MachinePrecision]
\left(\left(d1 \cdot d2 - d1 \cdot d3\right) + d4 \cdot d1\right) - d1 \cdot d1
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (d1 d2 d3 d4) :precision binary64 (- (+ (- (* d1 d2) (* d1 d3)) (* d4 d1)) (* d1 d1)))
double code(double d1, double d2, double d3, double d4) {
return (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1);
}
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(d1, d2, d3, d4)
use fmin_fmax_functions
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
code = (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1)
end function
public static double code(double d1, double d2, double d3, double d4) {
return (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1);
}
def code(d1, d2, d3, d4): return (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1)
function code(d1, d2, d3, d4) return Float64(Float64(Float64(Float64(d1 * d2) - Float64(d1 * d3)) + Float64(d4 * d1)) - Float64(d1 * d1)) end
function tmp = code(d1, d2, d3, d4) tmp = (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1); end
code[d1_, d2_, d3_, d4_] := N[(N[(N[(N[(d1 * d2), $MachinePrecision] - N[(d1 * d3), $MachinePrecision]), $MachinePrecision] + N[(d4 * d1), $MachinePrecision]), $MachinePrecision] - N[(d1 * d1), $MachinePrecision]), $MachinePrecision]
\left(\left(d1 \cdot d2 - d1 \cdot d3\right) + d4 \cdot d1\right) - d1 \cdot d1
(FPCore (d1 d2 d3 d4) :precision binary64 (* d1 (- (- d4 (- d3 d2)) d1)))
double code(double d1, double d2, double d3, double d4) {
return d1 * ((d4 - (d3 - d2)) - d1);
}
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(d1, d2, d3, d4)
use fmin_fmax_functions
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
code = d1 * ((d4 - (d3 - d2)) - d1)
end function
public static double code(double d1, double d2, double d3, double d4) {
return d1 * ((d4 - (d3 - d2)) - d1);
}
def code(d1, d2, d3, d4): return d1 * ((d4 - (d3 - d2)) - d1)
function code(d1, d2, d3, d4) return Float64(d1 * Float64(Float64(d4 - Float64(d3 - d2)) - d1)) end
function tmp = code(d1, d2, d3, d4) tmp = d1 * ((d4 - (d3 - d2)) - d1); end
code[d1_, d2_, d3_, d4_] := N[(d1 * N[(N[(d4 - N[(d3 - d2), $MachinePrecision]), $MachinePrecision] - d1), $MachinePrecision]), $MachinePrecision]
d1 \cdot \left(\left(d4 - \left(d3 - d2\right)\right) - d1\right)
Initial program 87.6%
lift--.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
distribute-lft-out--N/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-outN/A
*-commutativeN/A
distribute-rgt-out--N/A
lower-*.f64N/A
lower--.f64N/A
+-commutativeN/A
sub-negate-revN/A
sub-flip-reverseN/A
lower--.f64N/A
lower--.f64100.0%
Applied rewrites100.0%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= (fmax d2 d4) 3.9e-56) (* d1 (- (- (fmin d2 d4) d3) d1)) (* d1 (- (+ (fmin d2 d4) (fmax d2 d4)) d3))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (fmax(d2, d4) <= 3.9e-56) {
tmp = d1 * ((fmin(d2, d4) - d3) - d1);
} else {
tmp = d1 * ((fmin(d2, d4) + fmax(d2, d4)) - d3);
}
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(d1, d2, d3, d4)
use fmin_fmax_functions
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: tmp
if (fmax(d2, d4) <= 3.9d-56) then
tmp = d1 * ((fmin(d2, d4) - d3) - d1)
else
tmp = d1 * ((fmin(d2, d4) + fmax(d2, d4)) - d3)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if (fmax(d2, d4) <= 3.9e-56) {
tmp = d1 * ((fmin(d2, d4) - d3) - d1);
} else {
tmp = d1 * ((fmin(d2, d4) + fmax(d2, d4)) - d3);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if fmax(d2, d4) <= 3.9e-56: tmp = d1 * ((fmin(d2, d4) - d3) - d1) else: tmp = d1 * ((fmin(d2, d4) + fmax(d2, d4)) - d3) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (fmax(d2, d4) <= 3.9e-56) tmp = Float64(d1 * Float64(Float64(fmin(d2, d4) - d3) - d1)); else tmp = Float64(d1 * Float64(Float64(fmin(d2, d4) + fmax(d2, d4)) - d3)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (max(d2, d4) <= 3.9e-56) tmp = d1 * ((min(d2, d4) - d3) - d1); else tmp = d1 * ((min(d2, d4) + max(d2, d4)) - d3); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[N[Max[d2, d4], $MachinePrecision], 3.9e-56], N[(d1 * N[(N[(N[Min[d2, d4], $MachinePrecision] - d3), $MachinePrecision] - d1), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(N[(N[Min[d2, d4], $MachinePrecision] + N[Max[d2, d4], $MachinePrecision]), $MachinePrecision] - d3), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;\mathsf{max}\left(d2, d4\right) \leq 3.9 \cdot 10^{-56}:\\
\;\;\;\;d1 \cdot \left(\left(\mathsf{min}\left(d2, d4\right) - d3\right) - d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(\left(\mathsf{min}\left(d2, d4\right) + \mathsf{max}\left(d2, d4\right)\right) - d3\right)\\
\end{array}
if d4 < 3.9000000000000002e-56Initial program 87.6%
lift--.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
distribute-lft-out--N/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-outN/A
*-commutativeN/A
distribute-rgt-out--N/A
lower-*.f64N/A
lower--.f64N/A
+-commutativeN/A
sub-negate-revN/A
sub-flip-reverseN/A
lower--.f64N/A
lower--.f64100.0%
Applied rewrites100.0%
Taylor expanded in d4 around 0
lower--.f6477.0%
Applied rewrites77.0%
if 3.9000000000000002e-56 < d4 Initial program 87.6%
lift--.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
distribute-lft-out--N/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-outN/A
*-commutativeN/A
distribute-rgt-out--N/A
lower-*.f64N/A
lower--.f64N/A
+-commutativeN/A
sub-negate-revN/A
sub-flip-reverseN/A
lower--.f64N/A
lower--.f64100.0%
Applied rewrites100.0%
Taylor expanded in d1 around 0
lower--.f64N/A
lower-+.f6480.8%
Applied rewrites80.8%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- (+ d2 d4) d3))))
(if (<= d3 -1.8e-13)
t_0
(if (<= d3 9e-27) (* d1 (- (+ d2 d4) d1)) t_0))))double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * ((d2 + d4) - d3);
double tmp;
if (d3 <= -1.8e-13) {
tmp = t_0;
} else if (d3 <= 9e-27) {
tmp = d1 * ((d2 + d4) - d1);
} else {
tmp = 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(d1, d2, d3, d4)
use fmin_fmax_functions
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: t_0
real(8) :: tmp
t_0 = d1 * ((d2 + d4) - d3)
if (d3 <= (-1.8d-13)) then
tmp = t_0
else if (d3 <= 9d-27) then
tmp = d1 * ((d2 + d4) - d1)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * ((d2 + d4) - d3);
double tmp;
if (d3 <= -1.8e-13) {
tmp = t_0;
} else if (d3 <= 9e-27) {
tmp = d1 * ((d2 + d4) - d1);
} else {
tmp = t_0;
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * ((d2 + d4) - d3) tmp = 0 if d3 <= -1.8e-13: tmp = t_0 elif d3 <= 9e-27: tmp = d1 * ((d2 + d4) - d1) else: tmp = t_0 return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(Float64(d2 + d4) - d3)) tmp = 0.0 if (d3 <= -1.8e-13) tmp = t_0; elseif (d3 <= 9e-27) tmp = Float64(d1 * Float64(Float64(d2 + d4) - d1)); else tmp = t_0; end return tmp end
function tmp_2 = code(d1, d2, d3, d4) t_0 = d1 * ((d2 + d4) - d3); tmp = 0.0; if (d3 <= -1.8e-13) tmp = t_0; elseif (d3 <= 9e-27) tmp = d1 * ((d2 + d4) - d1); else tmp = t_0; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := Block[{t$95$0 = N[(d1 * N[(N[(d2 + d4), $MachinePrecision] - d3), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d3, -1.8e-13], t$95$0, If[LessEqual[d3, 9e-27], N[(d1 * N[(N[(d2 + d4), $MachinePrecision] - d1), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
t_0 := d1 \cdot \left(\left(d2 + d4\right) - d3\right)\\
\mathbf{if}\;d3 \leq -1.8 \cdot 10^{-13}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d3 \leq 9 \cdot 10^{-27}:\\
\;\;\;\;d1 \cdot \left(\left(d2 + d4\right) - d1\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
if d3 < -1.7999999999999999e-13 or 9.0000000000000003e-27 < d3 Initial program 87.6%
lift--.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
distribute-lft-out--N/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-outN/A
*-commutativeN/A
distribute-rgt-out--N/A
lower-*.f64N/A
lower--.f64N/A
+-commutativeN/A
sub-negate-revN/A
sub-flip-reverseN/A
lower--.f64N/A
lower--.f64100.0%
Applied rewrites100.0%
Taylor expanded in d1 around 0
lower--.f64N/A
lower-+.f6480.8%
Applied rewrites80.8%
if -1.7999999999999999e-13 < d3 < 9.0000000000000003e-27Initial program 87.6%
lift--.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
distribute-lft-out--N/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-outN/A
*-commutativeN/A
distribute-rgt-out--N/A
lower-*.f64N/A
lower--.f64N/A
+-commutativeN/A
sub-negate-revN/A
sub-flip-reverseN/A
lower--.f64N/A
lower--.f64100.0%
Applied rewrites100.0%
Taylor expanded in d1 around inf
lower-*.f6432.3%
Applied rewrites32.3%
Taylor expanded in d3 around 0
lower--.f64N/A
lower-+.f6476.9%
Applied rewrites76.9%
(FPCore (d1 d2 d3 d4)
:precision binary64
(if (<= d3 -1.75e+116)
(* d1 (- (fmax d2 d4) d3))
(if (<= d3 3.3e+54)
(* d1 (- (+ (fmin d2 d4) (fmax d2 d4)) d1))
(* d1 (- (fmin d2 d4) d3)))))double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d3 <= -1.75e+116) {
tmp = d1 * (fmax(d2, d4) - d3);
} else if (d3 <= 3.3e+54) {
tmp = d1 * ((fmin(d2, d4) + fmax(d2, d4)) - d1);
} else {
tmp = d1 * (fmin(d2, d4) - d3);
}
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(d1, d2, d3, d4)
use fmin_fmax_functions
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: tmp
if (d3 <= (-1.75d+116)) then
tmp = d1 * (fmax(d2, d4) - d3)
else if (d3 <= 3.3d+54) then
tmp = d1 * ((fmin(d2, d4) + fmax(d2, d4)) - d1)
else
tmp = d1 * (fmin(d2, d4) - d3)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d3 <= -1.75e+116) {
tmp = d1 * (fmax(d2, d4) - d3);
} else if (d3 <= 3.3e+54) {
tmp = d1 * ((fmin(d2, d4) + fmax(d2, d4)) - d1);
} else {
tmp = d1 * (fmin(d2, d4) - d3);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d3 <= -1.75e+116: tmp = d1 * (fmax(d2, d4) - d3) elif d3 <= 3.3e+54: tmp = d1 * ((fmin(d2, d4) + fmax(d2, d4)) - d1) else: tmp = d1 * (fmin(d2, d4) - d3) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d3 <= -1.75e+116) tmp = Float64(d1 * Float64(fmax(d2, d4) - d3)); elseif (d3 <= 3.3e+54) tmp = Float64(d1 * Float64(Float64(fmin(d2, d4) + fmax(d2, d4)) - d1)); else tmp = Float64(d1 * Float64(fmin(d2, d4) - d3)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d3 <= -1.75e+116) tmp = d1 * (max(d2, d4) - d3); elseif (d3 <= 3.3e+54) tmp = d1 * ((min(d2, d4) + max(d2, d4)) - d1); else tmp = d1 * (min(d2, d4) - d3); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d3, -1.75e+116], N[(d1 * N[(N[Max[d2, d4], $MachinePrecision] - d3), $MachinePrecision]), $MachinePrecision], If[LessEqual[d3, 3.3e+54], N[(d1 * N[(N[(N[Min[d2, d4], $MachinePrecision] + N[Max[d2, d4], $MachinePrecision]), $MachinePrecision] - d1), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(N[Min[d2, d4], $MachinePrecision] - d3), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;d3 \leq -1.75 \cdot 10^{+116}:\\
\;\;\;\;d1 \cdot \left(\mathsf{max}\left(d2, d4\right) - d3\right)\\
\mathbf{elif}\;d3 \leq 3.3 \cdot 10^{+54}:\\
\;\;\;\;d1 \cdot \left(\left(\mathsf{min}\left(d2, d4\right) + \mathsf{max}\left(d2, d4\right)\right) - d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(\mathsf{min}\left(d2, d4\right) - d3\right)\\
\end{array}
if d3 < -1.75e116Initial program 87.6%
lift--.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
distribute-lft-out--N/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-outN/A
*-commutativeN/A
distribute-rgt-out--N/A
lower-*.f64N/A
lower--.f64N/A
+-commutativeN/A
sub-negate-revN/A
sub-flip-reverseN/A
lower--.f64N/A
lower--.f64100.0%
Applied rewrites100.0%
Taylor expanded in d1 around 0
lower--.f64N/A
lower-+.f6480.8%
Applied rewrites80.8%
Taylor expanded in d2 around 0
Applied rewrites56.3%
if -1.75e116 < d3 < 3.3e54Initial program 87.6%
lift--.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
distribute-lft-out--N/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-outN/A
*-commutativeN/A
distribute-rgt-out--N/A
lower-*.f64N/A
lower--.f64N/A
+-commutativeN/A
sub-negate-revN/A
sub-flip-reverseN/A
lower--.f64N/A
lower--.f64100.0%
Applied rewrites100.0%
Taylor expanded in d1 around inf
lower-*.f6432.3%
Applied rewrites32.3%
Taylor expanded in d3 around 0
lower--.f64N/A
lower-+.f6476.9%
Applied rewrites76.9%
if 3.3e54 < d3 Initial program 87.6%
lift--.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
distribute-lft-out--N/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-outN/A
*-commutativeN/A
distribute-rgt-out--N/A
lower-*.f64N/A
lower--.f64N/A
+-commutativeN/A
sub-negate-revN/A
sub-flip-reverseN/A
lower--.f64N/A
lower--.f64100.0%
Applied rewrites100.0%
Taylor expanded in d1 around 0
lower--.f64N/A
lower-+.f6480.8%
Applied rewrites80.8%
Taylor expanded in d4 around 0
lower--.f6456.4%
Applied rewrites56.4%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- (fmax d2 d4) d3))))
(if (<= (fmin d2 d4) -3.25e+94)
(* d1 (- (fmin d2 d4) d3))
(if (<= (fmin d2 d4) -4200000000.0)
(* d1 (- (fmin d2 d4) d1))
(if (<= (fmin d2 d4) -1.4e-129)
t_0
(if (<= (fmin d2 d4) -9.2e-177)
(* d1 (- (fmax d2 d4) d1))
t_0))))))double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (fmax(d2, d4) - d3);
double tmp;
if (fmin(d2, d4) <= -3.25e+94) {
tmp = d1 * (fmin(d2, d4) - d3);
} else if (fmin(d2, d4) <= -4200000000.0) {
tmp = d1 * (fmin(d2, d4) - d1);
} else if (fmin(d2, d4) <= -1.4e-129) {
tmp = t_0;
} else if (fmin(d2, d4) <= -9.2e-177) {
tmp = d1 * (fmax(d2, d4) - d1);
} else {
tmp = 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(d1, d2, d3, d4)
use fmin_fmax_functions
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: t_0
real(8) :: tmp
t_0 = d1 * (fmax(d2, d4) - d3)
if (fmin(d2, d4) <= (-3.25d+94)) then
tmp = d1 * (fmin(d2, d4) - d3)
else if (fmin(d2, d4) <= (-4200000000.0d0)) then
tmp = d1 * (fmin(d2, d4) - d1)
else if (fmin(d2, d4) <= (-1.4d-129)) then
tmp = t_0
else if (fmin(d2, d4) <= (-9.2d-177)) then
tmp = d1 * (fmax(d2, d4) - d1)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (fmax(d2, d4) - d3);
double tmp;
if (fmin(d2, d4) <= -3.25e+94) {
tmp = d1 * (fmin(d2, d4) - d3);
} else if (fmin(d2, d4) <= -4200000000.0) {
tmp = d1 * (fmin(d2, d4) - d1);
} else if (fmin(d2, d4) <= -1.4e-129) {
tmp = t_0;
} else if (fmin(d2, d4) <= -9.2e-177) {
tmp = d1 * (fmax(d2, d4) - d1);
} else {
tmp = t_0;
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * (fmax(d2, d4) - d3) tmp = 0 if fmin(d2, d4) <= -3.25e+94: tmp = d1 * (fmin(d2, d4) - d3) elif fmin(d2, d4) <= -4200000000.0: tmp = d1 * (fmin(d2, d4) - d1) elif fmin(d2, d4) <= -1.4e-129: tmp = t_0 elif fmin(d2, d4) <= -9.2e-177: tmp = d1 * (fmax(d2, d4) - d1) else: tmp = t_0 return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(fmax(d2, d4) - d3)) tmp = 0.0 if (fmin(d2, d4) <= -3.25e+94) tmp = Float64(d1 * Float64(fmin(d2, d4) - d3)); elseif (fmin(d2, d4) <= -4200000000.0) tmp = Float64(d1 * Float64(fmin(d2, d4) - d1)); elseif (fmin(d2, d4) <= -1.4e-129) tmp = t_0; elseif (fmin(d2, d4) <= -9.2e-177) tmp = Float64(d1 * Float64(fmax(d2, d4) - d1)); else tmp = t_0; end return tmp end
function tmp_2 = code(d1, d2, d3, d4) t_0 = d1 * (max(d2, d4) - d3); tmp = 0.0; if (min(d2, d4) <= -3.25e+94) tmp = d1 * (min(d2, d4) - d3); elseif (min(d2, d4) <= -4200000000.0) tmp = d1 * (min(d2, d4) - d1); elseif (min(d2, d4) <= -1.4e-129) tmp = t_0; elseif (min(d2, d4) <= -9.2e-177) tmp = d1 * (max(d2, d4) - d1); else tmp = t_0; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := Block[{t$95$0 = N[(d1 * N[(N[Max[d2, d4], $MachinePrecision] - d3), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Min[d2, d4], $MachinePrecision], -3.25e+94], N[(d1 * N[(N[Min[d2, d4], $MachinePrecision] - d3), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Min[d2, d4], $MachinePrecision], -4200000000.0], N[(d1 * N[(N[Min[d2, d4], $MachinePrecision] - d1), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Min[d2, d4], $MachinePrecision], -1.4e-129], t$95$0, If[LessEqual[N[Min[d2, d4], $MachinePrecision], -9.2e-177], N[(d1 * N[(N[Max[d2, d4], $MachinePrecision] - d1), $MachinePrecision]), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
t_0 := d1 \cdot \left(\mathsf{max}\left(d2, d4\right) - d3\right)\\
\mathbf{if}\;\mathsf{min}\left(d2, d4\right) \leq -3.25 \cdot 10^{+94}:\\
\;\;\;\;d1 \cdot \left(\mathsf{min}\left(d2, d4\right) - d3\right)\\
\mathbf{elif}\;\mathsf{min}\left(d2, d4\right) \leq -4200000000:\\
\;\;\;\;d1 \cdot \left(\mathsf{min}\left(d2, d4\right) - d1\right)\\
\mathbf{elif}\;\mathsf{min}\left(d2, d4\right) \leq -1.4 \cdot 10^{-129}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\mathsf{min}\left(d2, d4\right) \leq -9.2 \cdot 10^{-177}:\\
\;\;\;\;d1 \cdot \left(\mathsf{max}\left(d2, d4\right) - d1\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
if d2 < -3.2499999999999999e94Initial program 87.6%
lift--.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
distribute-lft-out--N/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-outN/A
*-commutativeN/A
distribute-rgt-out--N/A
lower-*.f64N/A
lower--.f64N/A
+-commutativeN/A
sub-negate-revN/A
sub-flip-reverseN/A
lower--.f64N/A
lower--.f64100.0%
Applied rewrites100.0%
Taylor expanded in d1 around 0
lower--.f64N/A
lower-+.f6480.8%
Applied rewrites80.8%
Taylor expanded in d4 around 0
lower--.f6456.4%
Applied rewrites56.4%
if -3.2499999999999999e94 < d2 < -4.2e9Initial program 87.6%
lift--.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
distribute-lft-out--N/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-outN/A
*-commutativeN/A
distribute-rgt-out--N/A
lower-*.f64N/A
lower--.f64N/A
+-commutativeN/A
sub-negate-revN/A
sub-flip-reverseN/A
lower--.f64N/A
lower--.f64100.0%
Applied rewrites100.0%
Taylor expanded in d1 around inf
lower-*.f6432.3%
Applied rewrites32.3%
Taylor expanded in d3 around 0
lower--.f64N/A
lower-+.f6476.9%
Applied rewrites76.9%
Taylor expanded in d4 around 0
lower--.f6454.3%
Applied rewrites54.3%
if -4.2e9 < d2 < -1.4e-129 or -9.2000000000000009e-177 < d2 Initial program 87.6%
lift--.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
distribute-lft-out--N/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-outN/A
*-commutativeN/A
distribute-rgt-out--N/A
lower-*.f64N/A
lower--.f64N/A
+-commutativeN/A
sub-negate-revN/A
sub-flip-reverseN/A
lower--.f64N/A
lower--.f64100.0%
Applied rewrites100.0%
Taylor expanded in d1 around 0
lower--.f64N/A
lower-+.f6480.8%
Applied rewrites80.8%
Taylor expanded in d2 around 0
Applied rewrites56.3%
if -1.4e-129 < d2 < -9.2000000000000009e-177Initial program 87.6%
lift--.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
distribute-lft-out--N/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-outN/A
*-commutativeN/A
distribute-rgt-out--N/A
lower-*.f64N/A
lower--.f64N/A
+-commutativeN/A
sub-negate-revN/A
sub-flip-reverseN/A
lower--.f64N/A
lower--.f64100.0%
Applied rewrites100.0%
Taylor expanded in d1 around inf
lower-*.f6432.3%
Applied rewrites32.3%
Taylor expanded in d3 around 0
lower--.f64N/A
lower-+.f6476.9%
Applied rewrites76.9%
Taylor expanded in d2 around 0
Applied rewrites54.6%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- (fmax d2 d4) d1)))
(t_1 (* d1 (- (fmin d2 d4) d3))))
(if (<= d3 -1.7e+58)
t_1
(if (<= d3 -1.45e-227)
t_0
(if (<= d3 3.8e-237)
(* d1 (+ (fmin d2 d4) (fmax d2 d4)))
(if (<= d3 3.7e-83) t_0 t_1))))))double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (fmax(d2, d4) - d1);
double t_1 = d1 * (fmin(d2, d4) - d3);
double tmp;
if (d3 <= -1.7e+58) {
tmp = t_1;
} else if (d3 <= -1.45e-227) {
tmp = t_0;
} else if (d3 <= 3.8e-237) {
tmp = d1 * (fmin(d2, d4) + fmax(d2, d4));
} else if (d3 <= 3.7e-83) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(d1, d2, d3, d4)
use fmin_fmax_functions
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = d1 * (fmax(d2, d4) - d1)
t_1 = d1 * (fmin(d2, d4) - d3)
if (d3 <= (-1.7d+58)) then
tmp = t_1
else if (d3 <= (-1.45d-227)) then
tmp = t_0
else if (d3 <= 3.8d-237) then
tmp = d1 * (fmin(d2, d4) + fmax(d2, d4))
else if (d3 <= 3.7d-83) then
tmp = t_0
else
tmp = t_1
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (fmax(d2, d4) - d1);
double t_1 = d1 * (fmin(d2, d4) - d3);
double tmp;
if (d3 <= -1.7e+58) {
tmp = t_1;
} else if (d3 <= -1.45e-227) {
tmp = t_0;
} else if (d3 <= 3.8e-237) {
tmp = d1 * (fmin(d2, d4) + fmax(d2, d4));
} else if (d3 <= 3.7e-83) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * (fmax(d2, d4) - d1) t_1 = d1 * (fmin(d2, d4) - d3) tmp = 0 if d3 <= -1.7e+58: tmp = t_1 elif d3 <= -1.45e-227: tmp = t_0 elif d3 <= 3.8e-237: tmp = d1 * (fmin(d2, d4) + fmax(d2, d4)) elif d3 <= 3.7e-83: tmp = t_0 else: tmp = t_1 return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(fmax(d2, d4) - d1)) t_1 = Float64(d1 * Float64(fmin(d2, d4) - d3)) tmp = 0.0 if (d3 <= -1.7e+58) tmp = t_1; elseif (d3 <= -1.45e-227) tmp = t_0; elseif (d3 <= 3.8e-237) tmp = Float64(d1 * Float64(fmin(d2, d4) + fmax(d2, d4))); elseif (d3 <= 3.7e-83) tmp = t_0; else tmp = t_1; end return tmp end
function tmp_2 = code(d1, d2, d3, d4) t_0 = d1 * (max(d2, d4) - d1); t_1 = d1 * (min(d2, d4) - d3); tmp = 0.0; if (d3 <= -1.7e+58) tmp = t_1; elseif (d3 <= -1.45e-227) tmp = t_0; elseif (d3 <= 3.8e-237) tmp = d1 * (min(d2, d4) + max(d2, d4)); elseif (d3 <= 3.7e-83) tmp = t_0; else tmp = t_1; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := Block[{t$95$0 = N[(d1 * N[(N[Max[d2, d4], $MachinePrecision] - d1), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(d1 * N[(N[Min[d2, d4], $MachinePrecision] - d3), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d3, -1.7e+58], t$95$1, If[LessEqual[d3, -1.45e-227], t$95$0, If[LessEqual[d3, 3.8e-237], N[(d1 * N[(N[Min[d2, d4], $MachinePrecision] + N[Max[d2, d4], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d3, 3.7e-83], t$95$0, t$95$1]]]]]]
\begin{array}{l}
t_0 := d1 \cdot \left(\mathsf{max}\left(d2, d4\right) - d1\right)\\
t_1 := d1 \cdot \left(\mathsf{min}\left(d2, d4\right) - d3\right)\\
\mathbf{if}\;d3 \leq -1.7 \cdot 10^{+58}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;d3 \leq -1.45 \cdot 10^{-227}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d3 \leq 3.8 \cdot 10^{-237}:\\
\;\;\;\;d1 \cdot \left(\mathsf{min}\left(d2, d4\right) + \mathsf{max}\left(d2, d4\right)\right)\\
\mathbf{elif}\;d3 \leq 3.7 \cdot 10^{-83}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if d3 < -1.7e58 or 3.6999999999999999e-83 < d3 Initial program 87.6%
lift--.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
distribute-lft-out--N/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-outN/A
*-commutativeN/A
distribute-rgt-out--N/A
lower-*.f64N/A
lower--.f64N/A
+-commutativeN/A
sub-negate-revN/A
sub-flip-reverseN/A
lower--.f64N/A
lower--.f64100.0%
Applied rewrites100.0%
Taylor expanded in d1 around 0
lower--.f64N/A
lower-+.f6480.8%
Applied rewrites80.8%
Taylor expanded in d4 around 0
lower--.f6456.4%
Applied rewrites56.4%
if -1.7e58 < d3 < -1.4500000000000001e-227 or 3.8000000000000002e-237 < d3 < 3.6999999999999999e-83Initial program 87.6%
lift--.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
distribute-lft-out--N/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-outN/A
*-commutativeN/A
distribute-rgt-out--N/A
lower-*.f64N/A
lower--.f64N/A
+-commutativeN/A
sub-negate-revN/A
sub-flip-reverseN/A
lower--.f64N/A
lower--.f64100.0%
Applied rewrites100.0%
Taylor expanded in d1 around inf
lower-*.f6432.3%
Applied rewrites32.3%
Taylor expanded in d3 around 0
lower--.f64N/A
lower-+.f6476.9%
Applied rewrites76.9%
Taylor expanded in d2 around 0
Applied rewrites54.6%
if -1.4500000000000001e-227 < d3 < 3.8000000000000002e-237Initial program 87.6%
lift--.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
distribute-lft-out--N/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-outN/A
*-commutativeN/A
distribute-rgt-out--N/A
lower-*.f64N/A
lower--.f64N/A
+-commutativeN/A
sub-negate-revN/A
sub-flip-reverseN/A
lower--.f64N/A
lower--.f64100.0%
Applied rewrites100.0%
Taylor expanded in d1 around inf
lower-*.f6432.3%
Applied rewrites32.3%
Taylor expanded in d3 around 0
lower--.f64N/A
lower-+.f6476.9%
Applied rewrites76.9%
Taylor expanded in d1 around 0
lower-+.f6456.2%
Applied rewrites56.2%
(FPCore (d1 d2 d3 d4)
:precision binary64
(if (<= (fmax d2 d4) -1.3e-235)
(* d1 (- (fmin d2 d4) d1))
(if (<= (fmax d2 d4) 1.6e+48)
(* d1 (- (fmin d2 d4) d3))
(* d1 (+ (fmin d2 d4) (fmax d2 d4))))))double code(double d1, double d2, double d3, double d4) {
double tmp;
if (fmax(d2, d4) <= -1.3e-235) {
tmp = d1 * (fmin(d2, d4) - d1);
} else if (fmax(d2, d4) <= 1.6e+48) {
tmp = d1 * (fmin(d2, d4) - d3);
} else {
tmp = d1 * (fmin(d2, d4) + fmax(d2, d4));
}
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(d1, d2, d3, d4)
use fmin_fmax_functions
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: tmp
if (fmax(d2, d4) <= (-1.3d-235)) then
tmp = d1 * (fmin(d2, d4) - d1)
else if (fmax(d2, d4) <= 1.6d+48) then
tmp = d1 * (fmin(d2, d4) - d3)
else
tmp = d1 * (fmin(d2, d4) + fmax(d2, d4))
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if (fmax(d2, d4) <= -1.3e-235) {
tmp = d1 * (fmin(d2, d4) - d1);
} else if (fmax(d2, d4) <= 1.6e+48) {
tmp = d1 * (fmin(d2, d4) - d3);
} else {
tmp = d1 * (fmin(d2, d4) + fmax(d2, d4));
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if fmax(d2, d4) <= -1.3e-235: tmp = d1 * (fmin(d2, d4) - d1) elif fmax(d2, d4) <= 1.6e+48: tmp = d1 * (fmin(d2, d4) - d3) else: tmp = d1 * (fmin(d2, d4) + fmax(d2, d4)) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (fmax(d2, d4) <= -1.3e-235) tmp = Float64(d1 * Float64(fmin(d2, d4) - d1)); elseif (fmax(d2, d4) <= 1.6e+48) tmp = Float64(d1 * Float64(fmin(d2, d4) - d3)); else tmp = Float64(d1 * Float64(fmin(d2, d4) + fmax(d2, d4))); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (max(d2, d4) <= -1.3e-235) tmp = d1 * (min(d2, d4) - d1); elseif (max(d2, d4) <= 1.6e+48) tmp = d1 * (min(d2, d4) - d3); else tmp = d1 * (min(d2, d4) + max(d2, d4)); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[N[Max[d2, d4], $MachinePrecision], -1.3e-235], N[(d1 * N[(N[Min[d2, d4], $MachinePrecision] - d1), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Max[d2, d4], $MachinePrecision], 1.6e+48], N[(d1 * N[(N[Min[d2, d4], $MachinePrecision] - d3), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(N[Min[d2, d4], $MachinePrecision] + N[Max[d2, d4], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;\mathsf{max}\left(d2, d4\right) \leq -1.3 \cdot 10^{-235}:\\
\;\;\;\;d1 \cdot \left(\mathsf{min}\left(d2, d4\right) - d1\right)\\
\mathbf{elif}\;\mathsf{max}\left(d2, d4\right) \leq 1.6 \cdot 10^{+48}:\\
\;\;\;\;d1 \cdot \left(\mathsf{min}\left(d2, d4\right) - d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(\mathsf{min}\left(d2, d4\right) + \mathsf{max}\left(d2, d4\right)\right)\\
\end{array}
if d4 < -1.3e-235Initial program 87.6%
lift--.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
distribute-lft-out--N/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-outN/A
*-commutativeN/A
distribute-rgt-out--N/A
lower-*.f64N/A
lower--.f64N/A
+-commutativeN/A
sub-negate-revN/A
sub-flip-reverseN/A
lower--.f64N/A
lower--.f64100.0%
Applied rewrites100.0%
Taylor expanded in d1 around inf
lower-*.f6432.3%
Applied rewrites32.3%
Taylor expanded in d3 around 0
lower--.f64N/A
lower-+.f6476.9%
Applied rewrites76.9%
Taylor expanded in d4 around 0
lower--.f6454.3%
Applied rewrites54.3%
if -1.3e-235 < d4 < 1.6000000000000001e48Initial program 87.6%
lift--.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
distribute-lft-out--N/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-outN/A
*-commutativeN/A
distribute-rgt-out--N/A
lower-*.f64N/A
lower--.f64N/A
+-commutativeN/A
sub-negate-revN/A
sub-flip-reverseN/A
lower--.f64N/A
lower--.f64100.0%
Applied rewrites100.0%
Taylor expanded in d1 around 0
lower--.f64N/A
lower-+.f6480.8%
Applied rewrites80.8%
Taylor expanded in d4 around 0
lower--.f6456.4%
Applied rewrites56.4%
if 1.6000000000000001e48 < d4 Initial program 87.6%
lift--.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
distribute-lft-out--N/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-outN/A
*-commutativeN/A
distribute-rgt-out--N/A
lower-*.f64N/A
lower--.f64N/A
+-commutativeN/A
sub-negate-revN/A
sub-flip-reverseN/A
lower--.f64N/A
lower--.f64100.0%
Applied rewrites100.0%
Taylor expanded in d1 around inf
lower-*.f6432.3%
Applied rewrites32.3%
Taylor expanded in d3 around 0
lower--.f64N/A
lower-+.f6476.9%
Applied rewrites76.9%
Taylor expanded in d1 around 0
lower-+.f6456.2%
Applied rewrites56.2%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= (fmax d2 d4) 3.9e-56) (* d1 (- (fmin d2 d4) d1)) (* d1 (+ (fmin d2 d4) (fmax d2 d4)))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (fmax(d2, d4) <= 3.9e-56) {
tmp = d1 * (fmin(d2, d4) - d1);
} else {
tmp = d1 * (fmin(d2, d4) + fmax(d2, d4));
}
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(d1, d2, d3, d4)
use fmin_fmax_functions
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: tmp
if (fmax(d2, d4) <= 3.9d-56) then
tmp = d1 * (fmin(d2, d4) - d1)
else
tmp = d1 * (fmin(d2, d4) + fmax(d2, d4))
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if (fmax(d2, d4) <= 3.9e-56) {
tmp = d1 * (fmin(d2, d4) - d1);
} else {
tmp = d1 * (fmin(d2, d4) + fmax(d2, d4));
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if fmax(d2, d4) <= 3.9e-56: tmp = d1 * (fmin(d2, d4) - d1) else: tmp = d1 * (fmin(d2, d4) + fmax(d2, d4)) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (fmax(d2, d4) <= 3.9e-56) tmp = Float64(d1 * Float64(fmin(d2, d4) - d1)); else tmp = Float64(d1 * Float64(fmin(d2, d4) + fmax(d2, d4))); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (max(d2, d4) <= 3.9e-56) tmp = d1 * (min(d2, d4) - d1); else tmp = d1 * (min(d2, d4) + max(d2, d4)); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[N[Max[d2, d4], $MachinePrecision], 3.9e-56], N[(d1 * N[(N[Min[d2, d4], $MachinePrecision] - d1), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(N[Min[d2, d4], $MachinePrecision] + N[Max[d2, d4], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;\mathsf{max}\left(d2, d4\right) \leq 3.9 \cdot 10^{-56}:\\
\;\;\;\;d1 \cdot \left(\mathsf{min}\left(d2, d4\right) - d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(\mathsf{min}\left(d2, d4\right) + \mathsf{max}\left(d2, d4\right)\right)\\
\end{array}
if d4 < 3.9000000000000002e-56Initial program 87.6%
lift--.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
distribute-lft-out--N/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-outN/A
*-commutativeN/A
distribute-rgt-out--N/A
lower-*.f64N/A
lower--.f64N/A
+-commutativeN/A
sub-negate-revN/A
sub-flip-reverseN/A
lower--.f64N/A
lower--.f64100.0%
Applied rewrites100.0%
Taylor expanded in d1 around inf
lower-*.f6432.3%
Applied rewrites32.3%
Taylor expanded in d3 around 0
lower--.f64N/A
lower-+.f6476.9%
Applied rewrites76.9%
Taylor expanded in d4 around 0
lower--.f6454.3%
Applied rewrites54.3%
if 3.9000000000000002e-56 < d4 Initial program 87.6%
lift--.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
distribute-lft-out--N/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-outN/A
*-commutativeN/A
distribute-rgt-out--N/A
lower-*.f64N/A
lower--.f64N/A
+-commutativeN/A
sub-negate-revN/A
sub-flip-reverseN/A
lower--.f64N/A
lower--.f64100.0%
Applied rewrites100.0%
Taylor expanded in d1 around inf
lower-*.f6432.3%
Applied rewrites32.3%
Taylor expanded in d3 around 0
lower--.f64N/A
lower-+.f6476.9%
Applied rewrites76.9%
Taylor expanded in d1 around 0
lower-+.f6456.2%
Applied rewrites56.2%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* (- d1) d1)))
(if (<= d1 -4.5e+132)
t_0
(if (<= d1 1.7e+64) (* d1 (+ d2 d4)) t_0))))double code(double d1, double d2, double d3, double d4) {
double t_0 = -d1 * d1;
double tmp;
if (d1 <= -4.5e+132) {
tmp = t_0;
} else if (d1 <= 1.7e+64) {
tmp = d1 * (d2 + d4);
} else {
tmp = 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(d1, d2, d3, d4)
use fmin_fmax_functions
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: t_0
real(8) :: tmp
t_0 = -d1 * d1
if (d1 <= (-4.5d+132)) then
tmp = t_0
else if (d1 <= 1.7d+64) then
tmp = d1 * (d2 + d4)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double t_0 = -d1 * d1;
double tmp;
if (d1 <= -4.5e+132) {
tmp = t_0;
} else if (d1 <= 1.7e+64) {
tmp = d1 * (d2 + d4);
} else {
tmp = t_0;
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = -d1 * d1 tmp = 0 if d1 <= -4.5e+132: tmp = t_0 elif d1 <= 1.7e+64: tmp = d1 * (d2 + d4) else: tmp = t_0 return tmp
function code(d1, d2, d3, d4) t_0 = Float64(Float64(-d1) * d1) tmp = 0.0 if (d1 <= -4.5e+132) tmp = t_0; elseif (d1 <= 1.7e+64) tmp = Float64(d1 * Float64(d2 + d4)); else tmp = t_0; end return tmp end
function tmp_2 = code(d1, d2, d3, d4) t_0 = -d1 * d1; tmp = 0.0; if (d1 <= -4.5e+132) tmp = t_0; elseif (d1 <= 1.7e+64) tmp = d1 * (d2 + d4); else tmp = t_0; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := Block[{t$95$0 = N[((-d1) * d1), $MachinePrecision]}, If[LessEqual[d1, -4.5e+132], t$95$0, If[LessEqual[d1, 1.7e+64], N[(d1 * N[(d2 + d4), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
t_0 := \left(-d1\right) \cdot d1\\
\mathbf{if}\;d1 \leq -4.5 \cdot 10^{+132}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d1 \leq 1.7 \cdot 10^{+64}:\\
\;\;\;\;d1 \cdot \left(d2 + d4\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
if d1 < -4.4999999999999997e132 or 1.7000000000000001e64 < d1 Initial program 87.6%
lift--.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
distribute-lft-out--N/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-outN/A
*-commutativeN/A
distribute-rgt-out--N/A
lower-*.f64N/A
lower--.f64N/A
+-commutativeN/A
sub-negate-revN/A
sub-flip-reverseN/A
lower--.f64N/A
lower--.f64100.0%
Applied rewrites100.0%
Taylor expanded in d1 around inf
lower-*.f6432.3%
Applied rewrites32.3%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6432.3%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6432.3%
Applied rewrites32.3%
if -4.4999999999999997e132 < d1 < 1.7000000000000001e64Initial program 87.6%
lift--.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
distribute-lft-out--N/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-outN/A
*-commutativeN/A
distribute-rgt-out--N/A
lower-*.f64N/A
lower--.f64N/A
+-commutativeN/A
sub-negate-revN/A
sub-flip-reverseN/A
lower--.f64N/A
lower--.f64100.0%
Applied rewrites100.0%
Taylor expanded in d1 around inf
lower-*.f6432.3%
Applied rewrites32.3%
Taylor expanded in d3 around 0
lower--.f64N/A
lower-+.f6476.9%
Applied rewrites76.9%
Taylor expanded in d1 around 0
lower-+.f6456.2%
Applied rewrites56.2%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= (fmin d2 d4) -1.45e+92) (* d1 (fmin d2 d4)) (* (- d1) d1)))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (fmin(d2, d4) <= -1.45e+92) {
tmp = d1 * fmin(d2, d4);
} else {
tmp = -d1 * d1;
}
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(d1, d2, d3, d4)
use fmin_fmax_functions
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: tmp
if (fmin(d2, d4) <= (-1.45d+92)) then
tmp = d1 * fmin(d2, d4)
else
tmp = -d1 * d1
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if (fmin(d2, d4) <= -1.45e+92) {
tmp = d1 * fmin(d2, d4);
} else {
tmp = -d1 * d1;
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if fmin(d2, d4) <= -1.45e+92: tmp = d1 * fmin(d2, d4) else: tmp = -d1 * d1 return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (fmin(d2, d4) <= -1.45e+92) tmp = Float64(d1 * fmin(d2, d4)); else tmp = Float64(Float64(-d1) * d1); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (min(d2, d4) <= -1.45e+92) tmp = d1 * min(d2, d4); else tmp = -d1 * d1; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[N[Min[d2, d4], $MachinePrecision], -1.45e+92], N[(d1 * N[Min[d2, d4], $MachinePrecision]), $MachinePrecision], N[((-d1) * d1), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;\mathsf{min}\left(d2, d4\right) \leq -1.45 \cdot 10^{+92}:\\
\;\;\;\;d1 \cdot \mathsf{min}\left(d2, d4\right)\\
\mathbf{else}:\\
\;\;\;\;\left(-d1\right) \cdot d1\\
\end{array}
if d2 < -1.45e92Initial program 87.6%
lift--.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
distribute-lft-out--N/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-outN/A
*-commutativeN/A
distribute-rgt-out--N/A
lower-*.f64N/A
lower--.f64N/A
+-commutativeN/A
sub-negate-revN/A
sub-flip-reverseN/A
lower--.f64N/A
lower--.f64100.0%
Applied rewrites100.0%
Taylor expanded in d2 around inf
lower-*.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-+.f6489.5%
Applied rewrites89.5%
Taylor expanded in d2 around inf
lower-*.f6431.1%
Applied rewrites31.1%
if -1.45e92 < d2 Initial program 87.6%
lift--.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
distribute-lft-out--N/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-outN/A
*-commutativeN/A
distribute-rgt-out--N/A
lower-*.f64N/A
lower--.f64N/A
+-commutativeN/A
sub-negate-revN/A
sub-flip-reverseN/A
lower--.f64N/A
lower--.f64100.0%
Applied rewrites100.0%
Taylor expanded in d1 around inf
lower-*.f6432.3%
Applied rewrites32.3%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6432.3%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6432.3%
Applied rewrites32.3%
(FPCore (d1 d2 d3 d4) :precision binary64 (* d1 (fmin d2 d4)))
double code(double d1, double d2, double d3, double d4) {
return d1 * fmin(d2, d4);
}
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(d1, d2, d3, d4)
use fmin_fmax_functions
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
code = d1 * fmin(d2, d4)
end function
public static double code(double d1, double d2, double d3, double d4) {
return d1 * fmin(d2, d4);
}
def code(d1, d2, d3, d4): return d1 * fmin(d2, d4)
function code(d1, d2, d3, d4) return Float64(d1 * fmin(d2, d4)) end
function tmp = code(d1, d2, d3, d4) tmp = d1 * min(d2, d4); end
code[d1_, d2_, d3_, d4_] := N[(d1 * N[Min[d2, d4], $MachinePrecision]), $MachinePrecision]
d1 \cdot \mathsf{min}\left(d2, d4\right)
Initial program 87.6%
lift--.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
distribute-lft-out--N/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-outN/A
*-commutativeN/A
distribute-rgt-out--N/A
lower-*.f64N/A
lower--.f64N/A
+-commutativeN/A
sub-negate-revN/A
sub-flip-reverseN/A
lower--.f64N/A
lower--.f64100.0%
Applied rewrites100.0%
Taylor expanded in d2 around inf
lower-*.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-+.f6489.5%
Applied rewrites89.5%
Taylor expanded in d2 around inf
lower-*.f6431.1%
Applied rewrites31.1%
herbie shell --seed 2025258
(FPCore (d1 d2 d3 d4)
:name "FastMath dist4"
:precision binary64
(- (+ (- (* d1 d2) (* d1 d3)) (* d4 d1)) (* d1 d1)))