
(FPCore (x y z) :precision binary64 (- (+ x (cos y)) (* z (sin y))))
double code(double x, double y, double z) {
return (x + cos(y)) - (z * sin(y));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (x + cos(y)) - (z * sin(y))
end function
public static double code(double x, double y, double z) {
return (x + Math.cos(y)) - (z * Math.sin(y));
}
def code(x, y, z): return (x + math.cos(y)) - (z * math.sin(y))
function code(x, y, z) return Float64(Float64(x + cos(y)) - Float64(z * sin(y))) end
function tmp = code(x, y, z) tmp = (x + cos(y)) - (z * sin(y)); end
code[x_, y_, z_] := N[(N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision] - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\left(x + \cos y\right) - z \cdot \sin y
Herbie found 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (- (+ x (cos y)) (* z (sin y))))
double code(double x, double y, double z) {
return (x + cos(y)) - (z * sin(y));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (x + cos(y)) - (z * sin(y))
end function
public static double code(double x, double y, double z) {
return (x + Math.cos(y)) - (z * Math.sin(y));
}
def code(x, y, z): return (x + math.cos(y)) - (z * math.sin(y))
function code(x, y, z) return Float64(Float64(x + cos(y)) - Float64(z * sin(y))) end
function tmp = code(x, y, z) tmp = (x + cos(y)) - (z * sin(y)); end
code[x_, y_, z_] := N[(N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision] - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\left(x + \cos y\right) - z \cdot \sin y
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (sin y))) (t_1 (- (+ x 1) t_0)))
(if (<= x -1098878309078401/9007199254740992)
t_1
(if (<= x 4842270319348757/2305843009213693952)
(- (cos y) t_0)
t_1))))double code(double x, double y, double z) {
double t_0 = z * sin(y);
double t_1 = (x + 1.0) - t_0;
double tmp;
if (x <= -0.122) {
tmp = t_1;
} else if (x <= 0.0021) {
tmp = cos(y) - 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(x, y, z)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = z * sin(y)
t_1 = (x + 1.0d0) - t_0
if (x <= (-0.122d0)) then
tmp = t_1
else if (x <= 0.0021d0) then
tmp = cos(y) - t_0
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = z * Math.sin(y);
double t_1 = (x + 1.0) - t_0;
double tmp;
if (x <= -0.122) {
tmp = t_1;
} else if (x <= 0.0021) {
tmp = Math.cos(y) - t_0;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z): t_0 = z * math.sin(y) t_1 = (x + 1.0) - t_0 tmp = 0 if x <= -0.122: tmp = t_1 elif x <= 0.0021: tmp = math.cos(y) - t_0 else: tmp = t_1 return tmp
function code(x, y, z) t_0 = Float64(z * sin(y)) t_1 = Float64(Float64(x + 1.0) - t_0) tmp = 0.0 if (x <= -0.122) tmp = t_1; elseif (x <= 0.0021) tmp = Float64(cos(y) - t_0); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z) t_0 = z * sin(y); t_1 = (x + 1.0) - t_0; tmp = 0.0; if (x <= -0.122) tmp = t_1; elseif (x <= 0.0021) tmp = cos(y) - t_0; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(x + 1), $MachinePrecision] - t$95$0), $MachinePrecision]}, If[LessEqual[x, -1098878309078401/9007199254740992], t$95$1, If[LessEqual[x, 4842270319348757/2305843009213693952], N[(N[Cos[y], $MachinePrecision] - t$95$0), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
t_0 := z \cdot \sin y\\
t_1 := \left(x + 1\right) - t\_0\\
\mathbf{if}\;x \leq \frac{-1098878309078401}{9007199254740992}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq \frac{4842270319348757}{2305843009213693952}:\\
\;\;\;\;\cos y - t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if x < -0.122 or 0.0020999999999999999 < x Initial program 99.9%
Taylor expanded in y around 0
Applied rewrites88.3%
if -0.122 < x < 0.0020999999999999999Initial program 99.9%
Taylor expanded in x around 0
lower-cos.f6458.4%
Applied rewrites58.4%
(FPCore (x y z) :precision binary64 (let* ((t_0 (- (+ x 1) (* z (sin y))))) (if (<= z -180000) t_0 (if (<= z 2500) (+ x (cos y)) t_0))))
double code(double x, double y, double z) {
double t_0 = (x + 1.0) - (z * sin(y));
double tmp;
if (z <= -180000.0) {
tmp = t_0;
} else if (z <= 2500.0) {
tmp = x + cos(y);
} 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(x, y, z)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = (x + 1.0d0) - (z * sin(y))
if (z <= (-180000.0d0)) then
tmp = t_0
else if (z <= 2500.0d0) then
tmp = x + cos(y)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = (x + 1.0) - (z * Math.sin(y));
double tmp;
if (z <= -180000.0) {
tmp = t_0;
} else if (z <= 2500.0) {
tmp = x + Math.cos(y);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = (x + 1.0) - (z * math.sin(y)) tmp = 0 if z <= -180000.0: tmp = t_0 elif z <= 2500.0: tmp = x + math.cos(y) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(Float64(x + 1.0) - Float64(z * sin(y))) tmp = 0.0 if (z <= -180000.0) tmp = t_0; elseif (z <= 2500.0) tmp = Float64(x + cos(y)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = (x + 1.0) - (z * sin(y)); tmp = 0.0; if (z <= -180000.0) tmp = t_0; elseif (z <= 2500.0) tmp = x + cos(y); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(x + 1), $MachinePrecision] - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -180000], t$95$0, If[LessEqual[z, 2500], N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
t_0 := \left(x + 1\right) - z \cdot \sin y\\
\mathbf{if}\;z \leq -180000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 2500:\\
\;\;\;\;x + \cos y\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
if z < -1.8e5 or 2500 < z Initial program 99.9%
Taylor expanded in y around 0
Applied rewrites88.3%
if -1.8e5 < z < 2500Initial program 99.9%
Taylor expanded in y around 0
lower-+.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-*.f6463.6%
Applied rewrites63.6%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6463.6%
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
lift-*.f64N/A
distribute-lft-neg-outN/A
metadata-evalN/A
*-lft-identity63.6%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6463.6%
Applied rewrites63.6%
Taylor expanded in x around 0
lower--.f64N/A
lower-*.f6428.8%
Applied rewrites28.8%
Taylor expanded in z around 0
lower-+.f64N/A
lower-cos.f6472.7%
Applied rewrites72.7%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* -1 (* z (sin y)))))
(if (<=
z
-40000000000000002391323129842064607406997161009352362834945437993288032823004523745242241364266405613782727968977294165463537811456)
t_0
(if (<= z 230000000000000004443498729351904554905501696)
(+ x (cos y))
(if (<=
z
195000000000000002277179190768144145496795764669256648392777950829287667760926744492748524430463593883754955609273017061957799237916241279678540485986708696505930733215055440258537551273394176)
(- (- x (* z y)) -1)
t_0)))))double code(double x, double y, double z) {
double t_0 = -1.0 * (z * sin(y));
double tmp;
if (z <= -4e+130) {
tmp = t_0;
} else if (z <= 2.3e+44) {
tmp = x + cos(y);
} else if (z <= 1.95e+191) {
tmp = (x - (z * y)) - -1.0;
} 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(x, y, z)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = (-1.0d0) * (z * sin(y))
if (z <= (-4d+130)) then
tmp = t_0
else if (z <= 2.3d+44) then
tmp = x + cos(y)
else if (z <= 1.95d+191) then
tmp = (x - (z * y)) - (-1.0d0)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = -1.0 * (z * Math.sin(y));
double tmp;
if (z <= -4e+130) {
tmp = t_0;
} else if (z <= 2.3e+44) {
tmp = x + Math.cos(y);
} else if (z <= 1.95e+191) {
tmp = (x - (z * y)) - -1.0;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = -1.0 * (z * math.sin(y)) tmp = 0 if z <= -4e+130: tmp = t_0 elif z <= 2.3e+44: tmp = x + math.cos(y) elif z <= 1.95e+191: tmp = (x - (z * y)) - -1.0 else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(-1.0 * Float64(z * sin(y))) tmp = 0.0 if (z <= -4e+130) tmp = t_0; elseif (z <= 2.3e+44) tmp = Float64(x + cos(y)); elseif (z <= 1.95e+191) tmp = Float64(Float64(x - Float64(z * y)) - -1.0); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = -1.0 * (z * sin(y)); tmp = 0.0; if (z <= -4e+130) tmp = t_0; elseif (z <= 2.3e+44) tmp = x + cos(y); elseif (z <= 1.95e+191) tmp = (x - (z * y)) - -1.0; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(-1 * N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -40000000000000002391323129842064607406997161009352362834945437993288032823004523745242241364266405613782727968977294165463537811456], t$95$0, If[LessEqual[z, 230000000000000004443498729351904554905501696], N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 195000000000000002277179190768144145496795764669256648392777950829287667760926744492748524430463593883754955609273017061957799237916241279678540485986708696505930733215055440258537551273394176], N[(N[(x - N[(z * y), $MachinePrecision]), $MachinePrecision] - -1), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
t_0 := -1 \cdot \left(z \cdot \sin y\right)\\
\mathbf{if}\;z \leq -40000000000000002391323129842064607406997161009352362834945437993288032823004523745242241364266405613782727968977294165463537811456:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 230000000000000004443498729351904554905501696:\\
\;\;\;\;x + \cos y\\
\mathbf{elif}\;z \leq 195000000000000002277179190768144145496795764669256648392777950829287667760926744492748524430463593883754955609273017061957799237916241279678540485986708696505930733215055440258537551273394176:\\
\;\;\;\;\left(x - z \cdot y\right) - -1\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
if z < -4.0000000000000002e130 or 1.95e191 < z Initial program 99.9%
Taylor expanded in z around inf
lower-*.f64N/A
lower-*.f64N/A
lower-sin.f6428.6%
Applied rewrites28.6%
if -4.0000000000000002e130 < z < 2.3e44Initial program 99.9%
Taylor expanded in y around 0
lower-+.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-*.f6463.6%
Applied rewrites63.6%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6463.6%
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
lift-*.f64N/A
distribute-lft-neg-outN/A
metadata-evalN/A
*-lft-identity63.6%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6463.6%
Applied rewrites63.6%
Taylor expanded in x around 0
lower--.f64N/A
lower-*.f6428.8%
Applied rewrites28.8%
Taylor expanded in z around 0
lower-+.f64N/A
lower-cos.f6472.7%
Applied rewrites72.7%
if 2.3e44 < z < 1.95e191Initial program 99.9%
Taylor expanded in y around 0
lower-+.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-*.f6463.6%
Applied rewrites63.6%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6463.6%
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
lift-*.f64N/A
distribute-lft-neg-outN/A
metadata-evalN/A
*-lft-identity63.6%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6463.6%
Applied rewrites63.6%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (+ x (cos y))))
(if (<= y -63)
t_0
(if (<= y 3775007508029161/5316911983139663491615228241121378304)
(+ 1 (+ x (* y (- (* y (* 1/6 (* y z))) z))))
t_0))))double code(double x, double y, double z) {
double t_0 = x + cos(y);
double tmp;
if (y <= -63.0) {
tmp = t_0;
} else if (y <= 7.1e-22) {
tmp = 1.0 + (x + (y * ((y * (0.16666666666666666 * (y * z))) - z)));
} 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(x, y, z)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = x + cos(y)
if (y <= (-63.0d0)) then
tmp = t_0
else if (y <= 7.1d-22) then
tmp = 1.0d0 + (x + (y * ((y * (0.16666666666666666d0 * (y * z))) - z)))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = x + Math.cos(y);
double tmp;
if (y <= -63.0) {
tmp = t_0;
} else if (y <= 7.1e-22) {
tmp = 1.0 + (x + (y * ((y * (0.16666666666666666 * (y * z))) - z)));
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = x + math.cos(y) tmp = 0 if y <= -63.0: tmp = t_0 elif y <= 7.1e-22: tmp = 1.0 + (x + (y * ((y * (0.16666666666666666 * (y * z))) - z))) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(x + cos(y)) tmp = 0.0 if (y <= -63.0) tmp = t_0; elseif (y <= 7.1e-22) tmp = Float64(1.0 + Float64(x + Float64(y * Float64(Float64(y * Float64(0.16666666666666666 * Float64(y * z))) - z)))); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = x + cos(y); tmp = 0.0; if (y <= -63.0) tmp = t_0; elseif (y <= 7.1e-22) tmp = 1.0 + (x + (y * ((y * (0.16666666666666666 * (y * z))) - z))); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -63], t$95$0, If[LessEqual[y, 3775007508029161/5316911983139663491615228241121378304], N[(1 + N[(x + N[(y * N[(N[(y * N[(1/6 * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
t_0 := x + \cos y\\
\mathbf{if}\;y \leq -63:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq \frac{3775007508029161}{5316911983139663491615228241121378304}:\\
\;\;\;\;1 + \left(x + y \cdot \left(y \cdot \left(\frac{1}{6} \cdot \left(y \cdot z\right)\right) - z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
if y < -63 or 7.0999999999999999e-22 < y Initial program 99.9%
Taylor expanded in y around 0
lower-+.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-*.f6463.6%
Applied rewrites63.6%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6463.6%
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
lift-*.f64N/A
distribute-lft-neg-outN/A
metadata-evalN/A
*-lft-identity63.6%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6463.6%
Applied rewrites63.6%
Taylor expanded in x around 0
lower--.f64N/A
lower-*.f6428.8%
Applied rewrites28.8%
Taylor expanded in z around 0
lower-+.f64N/A
lower-cos.f6472.7%
Applied rewrites72.7%
if -63 < y < 7.0999999999999999e-22Initial program 99.9%
Taylor expanded in y around 0
lower-+.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-*.f6454.7%
Applied rewrites54.7%
Taylor expanded in z around inf
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f6454.7%
Applied rewrites54.7%
Taylor expanded in y around inf
lower-*.f64N/A
lower-*.f6455.9%
Applied rewrites55.9%
(FPCore (x y z) :precision binary64 (if (<= y 21000000000000001000628405581096452882432) (- (- x (* z y)) -1) (* -1 (* -1 (+ 1 x)))))
double code(double x, double y, double z) {
double tmp;
if (y <= 2.1e+40) {
tmp = (x - (z * y)) - -1.0;
} else {
tmp = -1.0 * (-1.0 * (1.0 + x));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (y <= 2.1d+40) then
tmp = (x - (z * y)) - (-1.0d0)
else
tmp = (-1.0d0) * ((-1.0d0) * (1.0d0 + x))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 2.1e+40) {
tmp = (x - (z * y)) - -1.0;
} else {
tmp = -1.0 * (-1.0 * (1.0 + x));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 2.1e+40: tmp = (x - (z * y)) - -1.0 else: tmp = -1.0 * (-1.0 * (1.0 + x)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 2.1e+40) tmp = Float64(Float64(x - Float64(z * y)) - -1.0); else tmp = Float64(-1.0 * Float64(-1.0 * Float64(1.0 + x))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 2.1e+40) tmp = (x - (z * y)) - -1.0; else tmp = -1.0 * (-1.0 * (1.0 + x)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 21000000000000001000628405581096452882432], N[(N[(x - N[(z * y), $MachinePrecision]), $MachinePrecision] - -1), $MachinePrecision], N[(-1 * N[(-1 * N[(1 + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;y \leq 21000000000000001000628405581096452882432:\\
\;\;\;\;\left(x - z \cdot y\right) - -1\\
\mathbf{else}:\\
\;\;\;\;-1 \cdot \left(-1 \cdot \left(1 + x\right)\right)\\
\end{array}
if y < 2.1000000000000001e40Initial program 99.9%
Taylor expanded in y around 0
lower-+.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-*.f6463.6%
Applied rewrites63.6%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6463.6%
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
lift-*.f64N/A
distribute-lft-neg-outN/A
metadata-evalN/A
*-lft-identity63.6%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6463.6%
Applied rewrites63.6%
if 2.1000000000000001e40 < y Initial program 99.9%
Taylor expanded in y around 0
lower-+.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-*.f6463.6%
Applied rewrites63.6%
Taylor expanded in y around -inf
lower-*.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f6451.7%
Applied rewrites51.7%
Taylor expanded in y around 0
lower-*.f64N/A
lower-+.f6461.6%
Applied rewrites61.6%
(FPCore (x y z)
:precision binary64
(if (<=
y
68000000000000004339161265121898998066591766200986767441080433662542711749989323638967571054592)
(- (- x (* z y)) -1)
(* -1 (* -1 x))))double code(double x, double y, double z) {
double tmp;
if (y <= 6.8e+94) {
tmp = (x - (z * y)) - -1.0;
} else {
tmp = -1.0 * (-1.0 * x);
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (y <= 6.8d+94) then
tmp = (x - (z * y)) - (-1.0d0)
else
tmp = (-1.0d0) * ((-1.0d0) * x)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 6.8e+94) {
tmp = (x - (z * y)) - -1.0;
} else {
tmp = -1.0 * (-1.0 * x);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 6.8e+94: tmp = (x - (z * y)) - -1.0 else: tmp = -1.0 * (-1.0 * x) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 6.8e+94) tmp = Float64(Float64(x - Float64(z * y)) - -1.0); else tmp = Float64(-1.0 * Float64(-1.0 * x)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 6.8e+94) tmp = (x - (z * y)) - -1.0; else tmp = -1.0 * (-1.0 * x); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 68000000000000004339161265121898998066591766200986767441080433662542711749989323638967571054592], N[(N[(x - N[(z * y), $MachinePrecision]), $MachinePrecision] - -1), $MachinePrecision], N[(-1 * N[(-1 * x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;y \leq 68000000000000004339161265121898998066591766200986767441080433662542711749989323638967571054592:\\
\;\;\;\;\left(x - z \cdot y\right) - -1\\
\mathbf{else}:\\
\;\;\;\;-1 \cdot \left(-1 \cdot x\right)\\
\end{array}
if y < 6.8000000000000004e94Initial program 99.9%
Taylor expanded in y around 0
lower-+.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-*.f6463.6%
Applied rewrites63.6%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6463.6%
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
lift-*.f64N/A
distribute-lft-neg-outN/A
metadata-evalN/A
*-lft-identity63.6%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6463.6%
Applied rewrites63.6%
if 6.8000000000000004e94 < y Initial program 99.9%
Taylor expanded in y around 0
lower-+.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-*.f6463.6%
Applied rewrites63.6%
Taylor expanded in y around -inf
lower-*.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f6451.7%
Applied rewrites51.7%
Taylor expanded in x around inf
lower-*.f6442.9%
Applied rewrites42.9%
(FPCore (x y z) :precision binary64 (let* ((t_0 (* -1 (* -1 x)))) (if (<= x -24000000000) t_0 (if (<= x 40000000) (- 1 (* y z)) t_0))))
double code(double x, double y, double z) {
double t_0 = -1.0 * (-1.0 * x);
double tmp;
if (x <= -24000000000.0) {
tmp = t_0;
} else if (x <= 40000000.0) {
tmp = 1.0 - (y * z);
} 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(x, y, z)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = (-1.0d0) * ((-1.0d0) * x)
if (x <= (-24000000000.0d0)) then
tmp = t_0
else if (x <= 40000000.0d0) then
tmp = 1.0d0 - (y * z)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = -1.0 * (-1.0 * x);
double tmp;
if (x <= -24000000000.0) {
tmp = t_0;
} else if (x <= 40000000.0) {
tmp = 1.0 - (y * z);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = -1.0 * (-1.0 * x) tmp = 0 if x <= -24000000000.0: tmp = t_0 elif x <= 40000000.0: tmp = 1.0 - (y * z) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(-1.0 * Float64(-1.0 * x)) tmp = 0.0 if (x <= -24000000000.0) tmp = t_0; elseif (x <= 40000000.0) tmp = Float64(1.0 - Float64(y * z)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = -1.0 * (-1.0 * x); tmp = 0.0; if (x <= -24000000000.0) tmp = t_0; elseif (x <= 40000000.0) tmp = 1.0 - (y * z); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(-1 * N[(-1 * x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -24000000000], t$95$0, If[LessEqual[x, 40000000], N[(1 - N[(y * z), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
t_0 := -1 \cdot \left(-1 \cdot x\right)\\
\mathbf{if}\;x \leq -24000000000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 40000000:\\
\;\;\;\;1 - y \cdot z\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
if x < -2.4e10 or 4e7 < x Initial program 99.9%
Taylor expanded in y around 0
lower-+.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-*.f6463.6%
Applied rewrites63.6%
Taylor expanded in y around -inf
lower-*.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f6451.7%
Applied rewrites51.7%
Taylor expanded in x around inf
lower-*.f6442.9%
Applied rewrites42.9%
if -2.4e10 < x < 4e7Initial program 99.9%
Taylor expanded in y around 0
lower-+.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-*.f6463.6%
Applied rewrites63.6%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6463.6%
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
lift-*.f64N/A
distribute-lft-neg-outN/A
metadata-evalN/A
*-lft-identity63.6%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6463.6%
Applied rewrites63.6%
Taylor expanded in x around 0
lower--.f64N/A
lower-*.f6428.8%
Applied rewrites28.8%
(FPCore (x y z) :precision binary64 (- 1 (* y z)))
double code(double x, double y, double z) {
return 1.0 - (y * z);
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = 1.0d0 - (y * z)
end function
public static double code(double x, double y, double z) {
return 1.0 - (y * z);
}
def code(x, y, z): return 1.0 - (y * z)
function code(x, y, z) return Float64(1.0 - Float64(y * z)) end
function tmp = code(x, y, z) tmp = 1.0 - (y * z); end
code[x_, y_, z_] := N[(1 - N[(y * z), $MachinePrecision]), $MachinePrecision]
1 - y \cdot z
Initial program 99.9%
Taylor expanded in y around 0
lower-+.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-*.f6463.6%
Applied rewrites63.6%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6463.6%
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
lift-*.f64N/A
distribute-lft-neg-outN/A
metadata-evalN/A
*-lft-identity63.6%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6463.6%
Applied rewrites63.6%
Taylor expanded in x around 0
lower--.f64N/A
lower-*.f6428.8%
Applied rewrites28.8%
herbie shell --seed 2025271 -o generate:evaluate
(FPCore (x y z)
:name "Graphics.Rasterific.Svg.PathConverter:segmentToBezier from rasterific-svg-0.2.3.1, B"
:precision binary64
(- (+ x (cos y)) (* z (sin y))))