
(FPCore (z0 z2 z1) :precision binary64 (- z0 (* (- (* z2 (- (* (* z1 z1) 41.341705691712875) 6.2831854820251465)) (* (* -19.739209900765786 z0) z1)) z1)))
double code(double z0, double z2, double z1) {
return z0 - (((z2 * (((z1 * z1) * 41.341705691712875) - 6.2831854820251465)) - ((-19.739209900765786 * z0) * z1)) * z1);
}
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, z2, z1)
use fmin_fmax_functions
real(8), intent (in) :: z0
real(8), intent (in) :: z2
real(8), intent (in) :: z1
code = z0 - (((z2 * (((z1 * z1) * 41.341705691712875d0) - 6.2831854820251465d0)) - (((-19.739209900765786d0) * z0) * z1)) * z1)
end function
public static double code(double z0, double z2, double z1) {
return z0 - (((z2 * (((z1 * z1) * 41.341705691712875) - 6.2831854820251465)) - ((-19.739209900765786 * z0) * z1)) * z1);
}
def code(z0, z2, z1): return z0 - (((z2 * (((z1 * z1) * 41.341705691712875) - 6.2831854820251465)) - ((-19.739209900765786 * z0) * z1)) * z1)
function code(z0, z2, z1) return Float64(z0 - Float64(Float64(Float64(z2 * Float64(Float64(Float64(z1 * z1) * 41.341705691712875) - 6.2831854820251465)) - Float64(Float64(-19.739209900765786 * z0) * z1)) * z1)) end
function tmp = code(z0, z2, z1) tmp = z0 - (((z2 * (((z1 * z1) * 41.341705691712875) - 6.2831854820251465)) - ((-19.739209900765786 * z0) * z1)) * z1); end
code[z0_, z2_, z1_] := N[(z0 - N[(N[(N[(z2 * N[(N[(N[(z1 * z1), $MachinePrecision] * 41.341705691712875), $MachinePrecision] - 6.2831854820251465), $MachinePrecision]), $MachinePrecision] - N[(N[(-19.739209900765786 * z0), $MachinePrecision] * z1), $MachinePrecision]), $MachinePrecision] * z1), $MachinePrecision]), $MachinePrecision]
z0 - \left(z2 \cdot \left(\left(z1 \cdot z1\right) \cdot 41.341705691712875 - 6.2831854820251465\right) - \left(-19.739209900765786 \cdot z0\right) \cdot z1\right) \cdot z1
Herbie found 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (z0 z2 z1) :precision binary64 (- z0 (* (- (* z2 (- (* (* z1 z1) 41.341705691712875) 6.2831854820251465)) (* (* -19.739209900765786 z0) z1)) z1)))
double code(double z0, double z2, double z1) {
return z0 - (((z2 * (((z1 * z1) * 41.341705691712875) - 6.2831854820251465)) - ((-19.739209900765786 * z0) * z1)) * z1);
}
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, z2, z1)
use fmin_fmax_functions
real(8), intent (in) :: z0
real(8), intent (in) :: z2
real(8), intent (in) :: z1
code = z0 - (((z2 * (((z1 * z1) * 41.341705691712875d0) - 6.2831854820251465d0)) - (((-19.739209900765786d0) * z0) * z1)) * z1)
end function
public static double code(double z0, double z2, double z1) {
return z0 - (((z2 * (((z1 * z1) * 41.341705691712875) - 6.2831854820251465)) - ((-19.739209900765786 * z0) * z1)) * z1);
}
def code(z0, z2, z1): return z0 - (((z2 * (((z1 * z1) * 41.341705691712875) - 6.2831854820251465)) - ((-19.739209900765786 * z0) * z1)) * z1)
function code(z0, z2, z1) return Float64(z0 - Float64(Float64(Float64(z2 * Float64(Float64(Float64(z1 * z1) * 41.341705691712875) - 6.2831854820251465)) - Float64(Float64(-19.739209900765786 * z0) * z1)) * z1)) end
function tmp = code(z0, z2, z1) tmp = z0 - (((z2 * (((z1 * z1) * 41.341705691712875) - 6.2831854820251465)) - ((-19.739209900765786 * z0) * z1)) * z1); end
code[z0_, z2_, z1_] := N[(z0 - N[(N[(N[(z2 * N[(N[(N[(z1 * z1), $MachinePrecision] * 41.341705691712875), $MachinePrecision] - 6.2831854820251465), $MachinePrecision]), $MachinePrecision] - N[(N[(-19.739209900765786 * z0), $MachinePrecision] * z1), $MachinePrecision]), $MachinePrecision] * z1), $MachinePrecision]), $MachinePrecision]
z0 - \left(z2 \cdot \left(\left(z1 \cdot z1\right) \cdot 41.341705691712875 - 6.2831854820251465\right) - \left(-19.739209900765786 \cdot z0\right) \cdot z1\right) \cdot z1
(FPCore (z0 z2 z1)
:precision binary64
(-
z0
(*
(-
(*
z1
(+ (* 19.739209900765786 z0) (* (* z1 z2) 41.341705691712875)))
(* 6.2831854820251465 z2))
z1)))double code(double z0, double z2, double z1) {
return z0 - (((z1 * ((19.739209900765786 * z0) + ((z1 * z2) * 41.341705691712875))) - (6.2831854820251465 * z2)) * z1);
}
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, z2, z1)
use fmin_fmax_functions
real(8), intent (in) :: z0
real(8), intent (in) :: z2
real(8), intent (in) :: z1
code = z0 - (((z1 * ((19.739209900765786d0 * z0) + ((z1 * z2) * 41.341705691712875d0))) - (6.2831854820251465d0 * z2)) * z1)
end function
public static double code(double z0, double z2, double z1) {
return z0 - (((z1 * ((19.739209900765786 * z0) + ((z1 * z2) * 41.341705691712875))) - (6.2831854820251465 * z2)) * z1);
}
def code(z0, z2, z1): return z0 - (((z1 * ((19.739209900765786 * z0) + ((z1 * z2) * 41.341705691712875))) - (6.2831854820251465 * z2)) * z1)
function code(z0, z2, z1) return Float64(z0 - Float64(Float64(Float64(z1 * Float64(Float64(19.739209900765786 * z0) + Float64(Float64(z1 * z2) * 41.341705691712875))) - Float64(6.2831854820251465 * z2)) * z1)) end
function tmp = code(z0, z2, z1) tmp = z0 - (((z1 * ((19.739209900765786 * z0) + ((z1 * z2) * 41.341705691712875))) - (6.2831854820251465 * z2)) * z1); end
code[z0_, z2_, z1_] := N[(z0 - N[(N[(N[(z1 * N[(N[(19.739209900765786 * z0), $MachinePrecision] + N[(N[(z1 * z2), $MachinePrecision] * 41.341705691712875), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(6.2831854820251465 * z2), $MachinePrecision]), $MachinePrecision] * z1), $MachinePrecision]), $MachinePrecision]
z0 - \left(z1 \cdot \left(19.739209900765786 \cdot z0 + \left(z1 \cdot z2\right) \cdot 41.341705691712875\right) - 6.2831854820251465 \cdot z2\right) \cdot z1
Initial program 93.5%
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
lift-*.f64N/A
lift--.f64N/A
sub-flipN/A
distribute-lft-inN/A
associate-+r+N/A
add-flipN/A
lower--.f64N/A
Applied rewrites99.6%
(FPCore (z0 z2 z1)
:precision binary64
(let* ((t_0
(*
(*
(-
(* (/ z0 z1) -19.739209900765786)
(* 41.341705691712875 z2))
z1)
(* z1 z1))))
(if (<= z1 -800000000.0)
t_0
(if (<= z1 11000.0)
(-
z0
(*
(-
(* z1 (* 41.341705691712875 (* z1 z2)))
(* 6.2831854820251465 z2))
z1))
t_0))))double code(double z0, double z2, double z1) {
double t_0 = ((((z0 / z1) * -19.739209900765786) - (41.341705691712875 * z2)) * z1) * (z1 * z1);
double tmp;
if (z1 <= -800000000.0) {
tmp = t_0;
} else if (z1 <= 11000.0) {
tmp = z0 - (((z1 * (41.341705691712875 * (z1 * z2))) - (6.2831854820251465 * z2)) * z1);
} 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(z0, z2, z1)
use fmin_fmax_functions
real(8), intent (in) :: z0
real(8), intent (in) :: z2
real(8), intent (in) :: z1
real(8) :: t_0
real(8) :: tmp
t_0 = ((((z0 / z1) * (-19.739209900765786d0)) - (41.341705691712875d0 * z2)) * z1) * (z1 * z1)
if (z1 <= (-800000000.0d0)) then
tmp = t_0
else if (z1 <= 11000.0d0) then
tmp = z0 - (((z1 * (41.341705691712875d0 * (z1 * z2))) - (6.2831854820251465d0 * z2)) * z1)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double z0, double z2, double z1) {
double t_0 = ((((z0 / z1) * -19.739209900765786) - (41.341705691712875 * z2)) * z1) * (z1 * z1);
double tmp;
if (z1 <= -800000000.0) {
tmp = t_0;
} else if (z1 <= 11000.0) {
tmp = z0 - (((z1 * (41.341705691712875 * (z1 * z2))) - (6.2831854820251465 * z2)) * z1);
} else {
tmp = t_0;
}
return tmp;
}
def code(z0, z2, z1): t_0 = ((((z0 / z1) * -19.739209900765786) - (41.341705691712875 * z2)) * z1) * (z1 * z1) tmp = 0 if z1 <= -800000000.0: tmp = t_0 elif z1 <= 11000.0: tmp = z0 - (((z1 * (41.341705691712875 * (z1 * z2))) - (6.2831854820251465 * z2)) * z1) else: tmp = t_0 return tmp
function code(z0, z2, z1) t_0 = Float64(Float64(Float64(Float64(Float64(z0 / z1) * -19.739209900765786) - Float64(41.341705691712875 * z2)) * z1) * Float64(z1 * z1)) tmp = 0.0 if (z1 <= -800000000.0) tmp = t_0; elseif (z1 <= 11000.0) tmp = Float64(z0 - Float64(Float64(Float64(z1 * Float64(41.341705691712875 * Float64(z1 * z2))) - Float64(6.2831854820251465 * z2)) * z1)); else tmp = t_0; end return tmp end
function tmp_2 = code(z0, z2, z1) t_0 = ((((z0 / z1) * -19.739209900765786) - (41.341705691712875 * z2)) * z1) * (z1 * z1); tmp = 0.0; if (z1 <= -800000000.0) tmp = t_0; elseif (z1 <= 11000.0) tmp = z0 - (((z1 * (41.341705691712875 * (z1 * z2))) - (6.2831854820251465 * z2)) * z1); else tmp = t_0; end tmp_2 = tmp; end
code[z0_, z2_, z1_] := Block[{t$95$0 = N[(N[(N[(N[(N[(z0 / z1), $MachinePrecision] * -19.739209900765786), $MachinePrecision] - N[(41.341705691712875 * z2), $MachinePrecision]), $MachinePrecision] * z1), $MachinePrecision] * N[(z1 * z1), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z1, -800000000.0], t$95$0, If[LessEqual[z1, 11000.0], N[(z0 - N[(N[(N[(z1 * N[(41.341705691712875 * N[(z1 * z2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(6.2831854820251465 * z2), $MachinePrecision]), $MachinePrecision] * z1), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
t_0 := \left(\left(\frac{z0}{z1} \cdot -19.739209900765786 - 41.341705691712875 \cdot z2\right) \cdot z1\right) \cdot \left(z1 \cdot z1\right)\\
\mathbf{if}\;z1 \leq -800000000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z1 \leq 11000:\\
\;\;\;\;z0 - \left(z1 \cdot \left(41.341705691712875 \cdot \left(z1 \cdot z2\right)\right) - 6.2831854820251465 \cdot z2\right) \cdot z1\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
if z1 < -8e8 or 11000 < z1 Initial program 93.5%
Taylor expanded in z1 around inf
lower-*.f64N/A
lower-pow.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6448.5%
Applied rewrites48.5%
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
cube-multN/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6450.0%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6450.0%
Applied rewrites50.0%
if -8e8 < z1 < 11000Initial program 93.5%
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
lift-*.f64N/A
lift--.f64N/A
sub-flipN/A
distribute-lft-inN/A
associate-+r+N/A
add-flipN/A
lower--.f64N/A
Applied rewrites99.6%
Taylor expanded in z0 around 0
lower-*.f64N/A
lower-*.f6486.9%
Applied rewrites86.9%
(FPCore (z0 z2 z1)
:precision binary64
(if (<= z2 -1.4e-131)
(-
z0
(*
(*
1.0
(* (- (* 41.341705691712875 (* z1 z1)) 6.2831854820251465) z2))
z1))
(if (<= z2 2.6e-252)
(*
(-
1.0
(*
z1
(+
(* -6.2831854820251465 (/ z2 z0))
(* 19.739209900765786 z1))))
z0)
(-
z0
(*
(-
(* z1 (* 41.341705691712875 (* z1 z2)))
(* 6.2831854820251465 z2))
z1)))))double code(double z0, double z2, double z1) {
double tmp;
if (z2 <= -1.4e-131) {
tmp = z0 - ((1.0 * (((41.341705691712875 * (z1 * z1)) - 6.2831854820251465) * z2)) * z1);
} else if (z2 <= 2.6e-252) {
tmp = (1.0 - (z1 * ((-6.2831854820251465 * (z2 / z0)) + (19.739209900765786 * z1)))) * z0;
} else {
tmp = z0 - (((z1 * (41.341705691712875 * (z1 * z2))) - (6.2831854820251465 * z2)) * z1);
}
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, z2, z1)
use fmin_fmax_functions
real(8), intent (in) :: z0
real(8), intent (in) :: z2
real(8), intent (in) :: z1
real(8) :: tmp
if (z2 <= (-1.4d-131)) then
tmp = z0 - ((1.0d0 * (((41.341705691712875d0 * (z1 * z1)) - 6.2831854820251465d0) * z2)) * z1)
else if (z2 <= 2.6d-252) then
tmp = (1.0d0 - (z1 * (((-6.2831854820251465d0) * (z2 / z0)) + (19.739209900765786d0 * z1)))) * z0
else
tmp = z0 - (((z1 * (41.341705691712875d0 * (z1 * z2))) - (6.2831854820251465d0 * z2)) * z1)
end if
code = tmp
end function
public static double code(double z0, double z2, double z1) {
double tmp;
if (z2 <= -1.4e-131) {
tmp = z0 - ((1.0 * (((41.341705691712875 * (z1 * z1)) - 6.2831854820251465) * z2)) * z1);
} else if (z2 <= 2.6e-252) {
tmp = (1.0 - (z1 * ((-6.2831854820251465 * (z2 / z0)) + (19.739209900765786 * z1)))) * z0;
} else {
tmp = z0 - (((z1 * (41.341705691712875 * (z1 * z2))) - (6.2831854820251465 * z2)) * z1);
}
return tmp;
}
def code(z0, z2, z1): tmp = 0 if z2 <= -1.4e-131: tmp = z0 - ((1.0 * (((41.341705691712875 * (z1 * z1)) - 6.2831854820251465) * z2)) * z1) elif z2 <= 2.6e-252: tmp = (1.0 - (z1 * ((-6.2831854820251465 * (z2 / z0)) + (19.739209900765786 * z1)))) * z0 else: tmp = z0 - (((z1 * (41.341705691712875 * (z1 * z2))) - (6.2831854820251465 * z2)) * z1) return tmp
function code(z0, z2, z1) tmp = 0.0 if (z2 <= -1.4e-131) tmp = Float64(z0 - Float64(Float64(1.0 * Float64(Float64(Float64(41.341705691712875 * Float64(z1 * z1)) - 6.2831854820251465) * z2)) * z1)); elseif (z2 <= 2.6e-252) tmp = Float64(Float64(1.0 - Float64(z1 * Float64(Float64(-6.2831854820251465 * Float64(z2 / z0)) + Float64(19.739209900765786 * z1)))) * z0); else tmp = Float64(z0 - Float64(Float64(Float64(z1 * Float64(41.341705691712875 * Float64(z1 * z2))) - Float64(6.2831854820251465 * z2)) * z1)); end return tmp end
function tmp_2 = code(z0, z2, z1) tmp = 0.0; if (z2 <= -1.4e-131) tmp = z0 - ((1.0 * (((41.341705691712875 * (z1 * z1)) - 6.2831854820251465) * z2)) * z1); elseif (z2 <= 2.6e-252) tmp = (1.0 - (z1 * ((-6.2831854820251465 * (z2 / z0)) + (19.739209900765786 * z1)))) * z0; else tmp = z0 - (((z1 * (41.341705691712875 * (z1 * z2))) - (6.2831854820251465 * z2)) * z1); end tmp_2 = tmp; end
code[z0_, z2_, z1_] := If[LessEqual[z2, -1.4e-131], N[(z0 - N[(N[(1.0 * N[(N[(N[(41.341705691712875 * N[(z1 * z1), $MachinePrecision]), $MachinePrecision] - 6.2831854820251465), $MachinePrecision] * z2), $MachinePrecision]), $MachinePrecision] * z1), $MachinePrecision]), $MachinePrecision], If[LessEqual[z2, 2.6e-252], N[(N[(1.0 - N[(z1 * N[(N[(-6.2831854820251465 * N[(z2 / z0), $MachinePrecision]), $MachinePrecision] + N[(19.739209900765786 * z1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * z0), $MachinePrecision], N[(z0 - N[(N[(N[(z1 * N[(41.341705691712875 * N[(z1 * z2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(6.2831854820251465 * z2), $MachinePrecision]), $MachinePrecision] * z1), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;z2 \leq -1.4 \cdot 10^{-131}:\\
\;\;\;\;z0 - \left(1 \cdot \left(\left(41.341705691712875 \cdot \left(z1 \cdot z1\right) - 6.2831854820251465\right) \cdot z2\right)\right) \cdot z1\\
\mathbf{elif}\;z2 \leq 2.6 \cdot 10^{-252}:\\
\;\;\;\;\left(1 - z1 \cdot \left(-6.2831854820251465 \cdot \frac{z2}{z0} + 19.739209900765786 \cdot z1\right)\right) \cdot z0\\
\mathbf{else}:\\
\;\;\;\;z0 - \left(z1 \cdot \left(41.341705691712875 \cdot \left(z1 \cdot z2\right)\right) - 6.2831854820251465 \cdot z2\right) \cdot z1\\
\end{array}
if z2 < -1.4e-131Initial program 93.5%
lift--.f64N/A
sub-to-multN/A
lower-unsound-*.f64N/A
lower-unsound--.f64N/A
lower-unsound-/.f6485.9%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6485.9%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6485.9%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6485.9%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6485.9%
Applied rewrites85.9%
Taylor expanded in z0 around 0
Applied rewrites86.9%
if -1.4e-131 < z2 < 2.5999999999999999e-252Initial program 93.5%
lift--.f64N/A
sub-to-multN/A
lower-unsound-*.f64N/A
Applied rewrites88.3%
Taylor expanded in z1 around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6466.4%
Applied rewrites66.4%
if 2.5999999999999999e-252 < z2 Initial program 93.5%
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
lift-*.f64N/A
lift--.f64N/A
sub-flipN/A
distribute-lft-inN/A
associate-+r+N/A
add-flipN/A
lower--.f64N/A
Applied rewrites99.6%
Taylor expanded in z0 around 0
lower-*.f64N/A
lower-*.f6486.9%
Applied rewrites86.9%
(FPCore (z0 z2 z1)
:precision binary64
(if (<= z2 -1.4e-131)
(-
z0
(*
(*
1.0
(* (- (* 41.341705691712875 (* z1 z1)) 6.2831854820251465) z2))
z1))
(if (<= z2 2.6e-252)
(* (- 1.0 (* z1 (* 19.739209900765786 z1))) z0)
(-
z0
(*
(-
(* z1 (* 41.341705691712875 (* z1 z2)))
(* 6.2831854820251465 z2))
z1)))))double code(double z0, double z2, double z1) {
double tmp;
if (z2 <= -1.4e-131) {
tmp = z0 - ((1.0 * (((41.341705691712875 * (z1 * z1)) - 6.2831854820251465) * z2)) * z1);
} else if (z2 <= 2.6e-252) {
tmp = (1.0 - (z1 * (19.739209900765786 * z1))) * z0;
} else {
tmp = z0 - (((z1 * (41.341705691712875 * (z1 * z2))) - (6.2831854820251465 * z2)) * z1);
}
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, z2, z1)
use fmin_fmax_functions
real(8), intent (in) :: z0
real(8), intent (in) :: z2
real(8), intent (in) :: z1
real(8) :: tmp
if (z2 <= (-1.4d-131)) then
tmp = z0 - ((1.0d0 * (((41.341705691712875d0 * (z1 * z1)) - 6.2831854820251465d0) * z2)) * z1)
else if (z2 <= 2.6d-252) then
tmp = (1.0d0 - (z1 * (19.739209900765786d0 * z1))) * z0
else
tmp = z0 - (((z1 * (41.341705691712875d0 * (z1 * z2))) - (6.2831854820251465d0 * z2)) * z1)
end if
code = tmp
end function
public static double code(double z0, double z2, double z1) {
double tmp;
if (z2 <= -1.4e-131) {
tmp = z0 - ((1.0 * (((41.341705691712875 * (z1 * z1)) - 6.2831854820251465) * z2)) * z1);
} else if (z2 <= 2.6e-252) {
tmp = (1.0 - (z1 * (19.739209900765786 * z1))) * z0;
} else {
tmp = z0 - (((z1 * (41.341705691712875 * (z1 * z2))) - (6.2831854820251465 * z2)) * z1);
}
return tmp;
}
def code(z0, z2, z1): tmp = 0 if z2 <= -1.4e-131: tmp = z0 - ((1.0 * (((41.341705691712875 * (z1 * z1)) - 6.2831854820251465) * z2)) * z1) elif z2 <= 2.6e-252: tmp = (1.0 - (z1 * (19.739209900765786 * z1))) * z0 else: tmp = z0 - (((z1 * (41.341705691712875 * (z1 * z2))) - (6.2831854820251465 * z2)) * z1) return tmp
function code(z0, z2, z1) tmp = 0.0 if (z2 <= -1.4e-131) tmp = Float64(z0 - Float64(Float64(1.0 * Float64(Float64(Float64(41.341705691712875 * Float64(z1 * z1)) - 6.2831854820251465) * z2)) * z1)); elseif (z2 <= 2.6e-252) tmp = Float64(Float64(1.0 - Float64(z1 * Float64(19.739209900765786 * z1))) * z0); else tmp = Float64(z0 - Float64(Float64(Float64(z1 * Float64(41.341705691712875 * Float64(z1 * z2))) - Float64(6.2831854820251465 * z2)) * z1)); end return tmp end
function tmp_2 = code(z0, z2, z1) tmp = 0.0; if (z2 <= -1.4e-131) tmp = z0 - ((1.0 * (((41.341705691712875 * (z1 * z1)) - 6.2831854820251465) * z2)) * z1); elseif (z2 <= 2.6e-252) tmp = (1.0 - (z1 * (19.739209900765786 * z1))) * z0; else tmp = z0 - (((z1 * (41.341705691712875 * (z1 * z2))) - (6.2831854820251465 * z2)) * z1); end tmp_2 = tmp; end
code[z0_, z2_, z1_] := If[LessEqual[z2, -1.4e-131], N[(z0 - N[(N[(1.0 * N[(N[(N[(41.341705691712875 * N[(z1 * z1), $MachinePrecision]), $MachinePrecision] - 6.2831854820251465), $MachinePrecision] * z2), $MachinePrecision]), $MachinePrecision] * z1), $MachinePrecision]), $MachinePrecision], If[LessEqual[z2, 2.6e-252], N[(N[(1.0 - N[(z1 * N[(19.739209900765786 * z1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * z0), $MachinePrecision], N[(z0 - N[(N[(N[(z1 * N[(41.341705691712875 * N[(z1 * z2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(6.2831854820251465 * z2), $MachinePrecision]), $MachinePrecision] * z1), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;z2 \leq -1.4 \cdot 10^{-131}:\\
\;\;\;\;z0 - \left(1 \cdot \left(\left(41.341705691712875 \cdot \left(z1 \cdot z1\right) - 6.2831854820251465\right) \cdot z2\right)\right) \cdot z1\\
\mathbf{elif}\;z2 \leq 2.6 \cdot 10^{-252}:\\
\;\;\;\;\left(1 - z1 \cdot \left(19.739209900765786 \cdot z1\right)\right) \cdot z0\\
\mathbf{else}:\\
\;\;\;\;z0 - \left(z1 \cdot \left(41.341705691712875 \cdot \left(z1 \cdot z2\right)\right) - 6.2831854820251465 \cdot z2\right) \cdot z1\\
\end{array}
if z2 < -1.4e-131Initial program 93.5%
lift--.f64N/A
sub-to-multN/A
lower-unsound-*.f64N/A
lower-unsound--.f64N/A
lower-unsound-/.f6485.9%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6485.9%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6485.9%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6485.9%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6485.9%
Applied rewrites85.9%
Taylor expanded in z0 around 0
Applied rewrites86.9%
if -1.4e-131 < z2 < 2.5999999999999999e-252Initial program 93.5%
lift--.f64N/A
sub-to-multN/A
lower-unsound-*.f64N/A
Applied rewrites88.3%
Taylor expanded in z1 around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6466.4%
Applied rewrites66.4%
Taylor expanded in z0 around inf
lower-*.f6460.9%
Applied rewrites60.9%
if 2.5999999999999999e-252 < z2 Initial program 93.5%
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
lift-*.f64N/A
lift--.f64N/A
sub-flipN/A
distribute-lft-inN/A
associate-+r+N/A
add-flipN/A
lower--.f64N/A
Applied rewrites99.6%
Taylor expanded in z0 around 0
lower-*.f64N/A
lower-*.f6486.9%
Applied rewrites86.9%
(FPCore (z0 z2 z1)
:precision binary64
(let* ((t_0
(-
z0
(*
(*
1.0
(*
(- (* 41.341705691712875 (* z1 z1)) 6.2831854820251465)
z2))
z1))))
(if (<= z2 -1.4e-131)
t_0
(if (<= z2 2.6e-252)
(* (- 1.0 (* z1 (* 19.739209900765786 z1))) z0)
t_0))))double code(double z0, double z2, double z1) {
double t_0 = z0 - ((1.0 * (((41.341705691712875 * (z1 * z1)) - 6.2831854820251465) * z2)) * z1);
double tmp;
if (z2 <= -1.4e-131) {
tmp = t_0;
} else if (z2 <= 2.6e-252) {
tmp = (1.0 - (z1 * (19.739209900765786 * z1))) * z0;
} 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(z0, z2, z1)
use fmin_fmax_functions
real(8), intent (in) :: z0
real(8), intent (in) :: z2
real(8), intent (in) :: z1
real(8) :: t_0
real(8) :: tmp
t_0 = z0 - ((1.0d0 * (((41.341705691712875d0 * (z1 * z1)) - 6.2831854820251465d0) * z2)) * z1)
if (z2 <= (-1.4d-131)) then
tmp = t_0
else if (z2 <= 2.6d-252) then
tmp = (1.0d0 - (z1 * (19.739209900765786d0 * z1))) * z0
else
tmp = t_0
end if
code = tmp
end function
public static double code(double z0, double z2, double z1) {
double t_0 = z0 - ((1.0 * (((41.341705691712875 * (z1 * z1)) - 6.2831854820251465) * z2)) * z1);
double tmp;
if (z2 <= -1.4e-131) {
tmp = t_0;
} else if (z2 <= 2.6e-252) {
tmp = (1.0 - (z1 * (19.739209900765786 * z1))) * z0;
} else {
tmp = t_0;
}
return tmp;
}
def code(z0, z2, z1): t_0 = z0 - ((1.0 * (((41.341705691712875 * (z1 * z1)) - 6.2831854820251465) * z2)) * z1) tmp = 0 if z2 <= -1.4e-131: tmp = t_0 elif z2 <= 2.6e-252: tmp = (1.0 - (z1 * (19.739209900765786 * z1))) * z0 else: tmp = t_0 return tmp
function code(z0, z2, z1) t_0 = Float64(z0 - Float64(Float64(1.0 * Float64(Float64(Float64(41.341705691712875 * Float64(z1 * z1)) - 6.2831854820251465) * z2)) * z1)) tmp = 0.0 if (z2 <= -1.4e-131) tmp = t_0; elseif (z2 <= 2.6e-252) tmp = Float64(Float64(1.0 - Float64(z1 * Float64(19.739209900765786 * z1))) * z0); else tmp = t_0; end return tmp end
function tmp_2 = code(z0, z2, z1) t_0 = z0 - ((1.0 * (((41.341705691712875 * (z1 * z1)) - 6.2831854820251465) * z2)) * z1); tmp = 0.0; if (z2 <= -1.4e-131) tmp = t_0; elseif (z2 <= 2.6e-252) tmp = (1.0 - (z1 * (19.739209900765786 * z1))) * z0; else tmp = t_0; end tmp_2 = tmp; end
code[z0_, z2_, z1_] := Block[{t$95$0 = N[(z0 - N[(N[(1.0 * N[(N[(N[(41.341705691712875 * N[(z1 * z1), $MachinePrecision]), $MachinePrecision] - 6.2831854820251465), $MachinePrecision] * z2), $MachinePrecision]), $MachinePrecision] * z1), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z2, -1.4e-131], t$95$0, If[LessEqual[z2, 2.6e-252], N[(N[(1.0 - N[(z1 * N[(19.739209900765786 * z1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * z0), $MachinePrecision], t$95$0]]]
\begin{array}{l}
t_0 := z0 - \left(1 \cdot \left(\left(41.341705691712875 \cdot \left(z1 \cdot z1\right) - 6.2831854820251465\right) \cdot z2\right)\right) \cdot z1\\
\mathbf{if}\;z2 \leq -1.4 \cdot 10^{-131}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z2 \leq 2.6 \cdot 10^{-252}:\\
\;\;\;\;\left(1 - z1 \cdot \left(19.739209900765786 \cdot z1\right)\right) \cdot z0\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
if z2 < -1.4e-131 or 2.5999999999999999e-252 < z2 Initial program 93.5%
lift--.f64N/A
sub-to-multN/A
lower-unsound-*.f64N/A
lower-unsound--.f64N/A
lower-unsound-/.f6485.9%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6485.9%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6485.9%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6485.9%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6485.9%
Applied rewrites85.9%
Taylor expanded in z0 around 0
Applied rewrites86.9%
if -1.4e-131 < z2 < 2.5999999999999999e-252Initial program 93.5%
lift--.f64N/A
sub-to-multN/A
lower-unsound-*.f64N/A
Applied rewrites88.3%
Taylor expanded in z1 around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6466.4%
Applied rewrites66.4%
Taylor expanded in z0 around inf
lower-*.f6460.9%
Applied rewrites60.9%
(FPCore (z0 z2 z1)
:precision binary64
(let* ((t_0 (* (- 1.0 (* z1 (* 19.739209900765786 z1))) z0)))
(if (<= z1 -1.6e-16)
t_0
(if (<= z1 1.65) (- z0 (* (* -6.2831854820251465 z1) z2)) t_0))))double code(double z0, double z2, double z1) {
double t_0 = (1.0 - (z1 * (19.739209900765786 * z1))) * z0;
double tmp;
if (z1 <= -1.6e-16) {
tmp = t_0;
} else if (z1 <= 1.65) {
tmp = z0 - ((-6.2831854820251465 * z1) * z2);
} 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(z0, z2, z1)
use fmin_fmax_functions
real(8), intent (in) :: z0
real(8), intent (in) :: z2
real(8), intent (in) :: z1
real(8) :: t_0
real(8) :: tmp
t_0 = (1.0d0 - (z1 * (19.739209900765786d0 * z1))) * z0
if (z1 <= (-1.6d-16)) then
tmp = t_0
else if (z1 <= 1.65d0) then
tmp = z0 - (((-6.2831854820251465d0) * z1) * z2)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double z0, double z2, double z1) {
double t_0 = (1.0 - (z1 * (19.739209900765786 * z1))) * z0;
double tmp;
if (z1 <= -1.6e-16) {
tmp = t_0;
} else if (z1 <= 1.65) {
tmp = z0 - ((-6.2831854820251465 * z1) * z2);
} else {
tmp = t_0;
}
return tmp;
}
def code(z0, z2, z1): t_0 = (1.0 - (z1 * (19.739209900765786 * z1))) * z0 tmp = 0 if z1 <= -1.6e-16: tmp = t_0 elif z1 <= 1.65: tmp = z0 - ((-6.2831854820251465 * z1) * z2) else: tmp = t_0 return tmp
function code(z0, z2, z1) t_0 = Float64(Float64(1.0 - Float64(z1 * Float64(19.739209900765786 * z1))) * z0) tmp = 0.0 if (z1 <= -1.6e-16) tmp = t_0; elseif (z1 <= 1.65) tmp = Float64(z0 - Float64(Float64(-6.2831854820251465 * z1) * z2)); else tmp = t_0; end return tmp end
function tmp_2 = code(z0, z2, z1) t_0 = (1.0 - (z1 * (19.739209900765786 * z1))) * z0; tmp = 0.0; if (z1 <= -1.6e-16) tmp = t_0; elseif (z1 <= 1.65) tmp = z0 - ((-6.2831854820251465 * z1) * z2); else tmp = t_0; end tmp_2 = tmp; end
code[z0_, z2_, z1_] := Block[{t$95$0 = N[(N[(1.0 - N[(z1 * N[(19.739209900765786 * z1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * z0), $MachinePrecision]}, If[LessEqual[z1, -1.6e-16], t$95$0, If[LessEqual[z1, 1.65], N[(z0 - N[(N[(-6.2831854820251465 * z1), $MachinePrecision] * z2), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
t_0 := \left(1 - z1 \cdot \left(19.739209900765786 \cdot z1\right)\right) \cdot z0\\
\mathbf{if}\;z1 \leq -1.6 \cdot 10^{-16}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z1 \leq 1.65:\\
\;\;\;\;z0 - \left(-6.2831854820251465 \cdot z1\right) \cdot z2\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
if z1 < -1.6000000000000001e-16 or 1.6499999999999999 < z1 Initial program 93.5%
lift--.f64N/A
sub-to-multN/A
lower-unsound-*.f64N/A
Applied rewrites88.3%
Taylor expanded in z1 around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6466.4%
Applied rewrites66.4%
Taylor expanded in z0 around inf
lower-*.f6460.9%
Applied rewrites60.9%
if -1.6000000000000001e-16 < z1 < 1.6499999999999999Initial program 93.5%
Taylor expanded in z1 around 0
lower-*.f64N/A
lower-*.f6449.7%
Applied rewrites49.7%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6449.7%
Applied rewrites49.7%
(FPCore (z0 z2 z1)
:precision binary64
(if (<= z1 9e-12)
(-
z0
(*
(- (* z2 -6.2831854820251465) (* (* -19.739209900765786 z0) z1))
z1))
(* (- 1.0 (* z1 (* 19.739209900765786 z1))) z0)))double code(double z0, double z2, double z1) {
double tmp;
if (z1 <= 9e-12) {
tmp = z0 - (((z2 * -6.2831854820251465) - ((-19.739209900765786 * z0) * z1)) * z1);
} else {
tmp = (1.0 - (z1 * (19.739209900765786 * z1))) * z0;
}
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, z2, z1)
use fmin_fmax_functions
real(8), intent (in) :: z0
real(8), intent (in) :: z2
real(8), intent (in) :: z1
real(8) :: tmp
if (z1 <= 9d-12) then
tmp = z0 - (((z2 * (-6.2831854820251465d0)) - (((-19.739209900765786d0) * z0) * z1)) * z1)
else
tmp = (1.0d0 - (z1 * (19.739209900765786d0 * z1))) * z0
end if
code = tmp
end function
public static double code(double z0, double z2, double z1) {
double tmp;
if (z1 <= 9e-12) {
tmp = z0 - (((z2 * -6.2831854820251465) - ((-19.739209900765786 * z0) * z1)) * z1);
} else {
tmp = (1.0 - (z1 * (19.739209900765786 * z1))) * z0;
}
return tmp;
}
def code(z0, z2, z1): tmp = 0 if z1 <= 9e-12: tmp = z0 - (((z2 * -6.2831854820251465) - ((-19.739209900765786 * z0) * z1)) * z1) else: tmp = (1.0 - (z1 * (19.739209900765786 * z1))) * z0 return tmp
function code(z0, z2, z1) tmp = 0.0 if (z1 <= 9e-12) tmp = Float64(z0 - Float64(Float64(Float64(z2 * -6.2831854820251465) - Float64(Float64(-19.739209900765786 * z0) * z1)) * z1)); else tmp = Float64(Float64(1.0 - Float64(z1 * Float64(19.739209900765786 * z1))) * z0); end return tmp end
function tmp_2 = code(z0, z2, z1) tmp = 0.0; if (z1 <= 9e-12) tmp = z0 - (((z2 * -6.2831854820251465) - ((-19.739209900765786 * z0) * z1)) * z1); else tmp = (1.0 - (z1 * (19.739209900765786 * z1))) * z0; end tmp_2 = tmp; end
code[z0_, z2_, z1_] := If[LessEqual[z1, 9e-12], N[(z0 - N[(N[(N[(z2 * -6.2831854820251465), $MachinePrecision] - N[(N[(-19.739209900765786 * z0), $MachinePrecision] * z1), $MachinePrecision]), $MachinePrecision] * z1), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - N[(z1 * N[(19.739209900765786 * z1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * z0), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;z1 \leq 9 \cdot 10^{-12}:\\
\;\;\;\;z0 - \left(z2 \cdot -6.2831854820251465 - \left(-19.739209900765786 \cdot z0\right) \cdot z1\right) \cdot z1\\
\mathbf{else}:\\
\;\;\;\;\left(1 - z1 \cdot \left(19.739209900765786 \cdot z1\right)\right) \cdot z0\\
\end{array}
if z1 < 8.9999999999999996e-12Initial program 93.5%
Taylor expanded in z1 around 0
Applied rewrites71.4%
if 8.9999999999999996e-12 < z1 Initial program 93.5%
lift--.f64N/A
sub-to-multN/A
lower-unsound-*.f64N/A
Applied rewrites88.3%
Taylor expanded in z1 around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6466.4%
Applied rewrites66.4%
Taylor expanded in z0 around inf
lower-*.f6460.9%
Applied rewrites60.9%
(FPCore (z0 z2 z1) :precision binary64 (- z0 (* (* -6.2831854820251465 z1) z2)))
double code(double z0, double z2, double z1) {
return z0 - ((-6.2831854820251465 * z1) * 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, z2, z1)
use fmin_fmax_functions
real(8), intent (in) :: z0
real(8), intent (in) :: z2
real(8), intent (in) :: z1
code = z0 - (((-6.2831854820251465d0) * z1) * z2)
end function
public static double code(double z0, double z2, double z1) {
return z0 - ((-6.2831854820251465 * z1) * z2);
}
def code(z0, z2, z1): return z0 - ((-6.2831854820251465 * z1) * z2)
function code(z0, z2, z1) return Float64(z0 - Float64(Float64(-6.2831854820251465 * z1) * z2)) end
function tmp = code(z0, z2, z1) tmp = z0 - ((-6.2831854820251465 * z1) * z2); end
code[z0_, z2_, z1_] := N[(z0 - N[(N[(-6.2831854820251465 * z1), $MachinePrecision] * z2), $MachinePrecision]), $MachinePrecision]
z0 - \left(-6.2831854820251465 \cdot z1\right) \cdot z2
Initial program 93.5%
Taylor expanded in z1 around 0
lower-*.f64N/A
lower-*.f6449.7%
Applied rewrites49.7%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6449.7%
Applied rewrites49.7%
(FPCore (z0 z2 z1) :precision binary64 (- z0 (* -6.2831854820251465 (* z1 z2))))
double code(double z0, double z2, double z1) {
return z0 - (-6.2831854820251465 * (z1 * 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, z2, z1)
use fmin_fmax_functions
real(8), intent (in) :: z0
real(8), intent (in) :: z2
real(8), intent (in) :: z1
code = z0 - ((-6.2831854820251465d0) * (z1 * z2))
end function
public static double code(double z0, double z2, double z1) {
return z0 - (-6.2831854820251465 * (z1 * z2));
}
def code(z0, z2, z1): return z0 - (-6.2831854820251465 * (z1 * z2))
function code(z0, z2, z1) return Float64(z0 - Float64(-6.2831854820251465 * Float64(z1 * z2))) end
function tmp = code(z0, z2, z1) tmp = z0 - (-6.2831854820251465 * (z1 * z2)); end
code[z0_, z2_, z1_] := N[(z0 - N[(-6.2831854820251465 * N[(z1 * z2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
z0 - -6.2831854820251465 \cdot \left(z1 \cdot z2\right)
Initial program 93.5%
Taylor expanded in z1 around 0
lower-*.f64N/A
lower-*.f6449.7%
Applied rewrites49.7%
herbie shell --seed 2025250
(FPCore (z0 z2 z1)
:name "(- z0 (* (- (* z2 (- (* (* z1 z1) 330733645533703/8000000000000) 12566370964050293/2000000000000000)) (* (* -9869604950382893/500000000000000 z0) z1)) z1))"
:precision binary64
(- z0 (* (- (* z2 (- (* (* z1 z1) 41.341705691712875) 6.2831854820251465)) (* (* -19.739209900765786 z0) z1)) z1)))