
(FPCore (x y z) :precision binary64 (/ (* (cosh x) (/ y x)) z))
double code(double x, double y, double z) {
return (cosh(x) * (y / x)) / 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 = (cosh(x) * (y / x)) / z
end function
public static double code(double x, double y, double z) {
return (Math.cosh(x) * (y / x)) / z;
}
def code(x, y, z): return (math.cosh(x) * (y / x)) / z
function code(x, y, z) return Float64(Float64(cosh(x) * Float64(y / x)) / z) end
function tmp = code(x, y, z) tmp = (cosh(x) * (y / x)) / z; end
code[x_, y_, z_] := N[(N[(N[Cosh[x], $MachinePrecision] * N[(y / x), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]
\begin{array}{l}
\\
\frac{\cosh x \cdot \frac{y}{x}}{z}
\end{array}
Herbie found 15 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (/ (* (cosh x) (/ y x)) z))
double code(double x, double y, double z) {
return (cosh(x) * (y / x)) / 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 = (cosh(x) * (y / x)) / z
end function
public static double code(double x, double y, double z) {
return (Math.cosh(x) * (y / x)) / z;
}
def code(x, y, z): return (math.cosh(x) * (y / x)) / z
function code(x, y, z) return Float64(Float64(cosh(x) * Float64(y / x)) / z) end
function tmp = code(x, y, z) tmp = (cosh(x) * (y / x)) / z; end
code[x_, y_, z_] := N[(N[(N[Cosh[x], $MachinePrecision] * N[(y / x), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]
\begin{array}{l}
\\
\frac{\cosh x \cdot \frac{y}{x}}{z}
\end{array}
(FPCore (x y z) :precision binary64 (let* ((t_0 (/ (* (cosh x) (/ y x)) z))) (if (<= t_0 INFINITY) t_0 (/ (* (/ (* (* x x) 0.5) z) y) x))))
double code(double x, double y, double z) {
double t_0 = (cosh(x) * (y / x)) / z;
double tmp;
if (t_0 <= ((double) INFINITY)) {
tmp = t_0;
} else {
tmp = ((((x * x) * 0.5) / z) * y) / x;
}
return tmp;
}
public static double code(double x, double y, double z) {
double t_0 = (Math.cosh(x) * (y / x)) / z;
double tmp;
if (t_0 <= Double.POSITIVE_INFINITY) {
tmp = t_0;
} else {
tmp = ((((x * x) * 0.5) / z) * y) / x;
}
return tmp;
}
def code(x, y, z): t_0 = (math.cosh(x) * (y / x)) / z tmp = 0 if t_0 <= math.inf: tmp = t_0 else: tmp = ((((x * x) * 0.5) / z) * y) / x return tmp
function code(x, y, z) t_0 = Float64(Float64(cosh(x) * Float64(y / x)) / z) tmp = 0.0 if (t_0 <= Inf) tmp = t_0; else tmp = Float64(Float64(Float64(Float64(Float64(x * x) * 0.5) / z) * y) / x); end return tmp end
function tmp_2 = code(x, y, z) t_0 = (cosh(x) * (y / x)) / z; tmp = 0.0; if (t_0 <= Inf) tmp = t_0; else tmp = ((((x * x) * 0.5) / z) * y) / x; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(N[Cosh[x], $MachinePrecision] * N[(y / x), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]}, If[LessEqual[t$95$0, Infinity], t$95$0, N[(N[(N[(N[(N[(x * x), $MachinePrecision] * 0.5), $MachinePrecision] / z), $MachinePrecision] * y), $MachinePrecision] / x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\cosh x \cdot \frac{y}{x}}{z}\\
\mathbf{if}\;t\_0 \leq \infty:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\left(x \cdot x\right) \cdot 0.5}{z} \cdot y}{x}\\
\end{array}
\end{array}
if (/.f64 (*.f64 (cosh.f64 x) (/.f64 y x)) z) < +inf.0Initial program 85.1%
if +inf.0 < (/.f64 (*.f64 (cosh.f64 x) (/.f64 y x)) z) Initial program 85.1%
Taylor expanded in x around 0
lower-/.f64N/A
associate-*r/N/A
div-add-revN/A
+-commutativeN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6481.0
Applied rewrites81.0%
lift-/.f64N/A
lift-/.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-/l/N/A
*-commutativeN/A
pow2N/A
associate-*r*N/A
distribute-lft1-inN/A
+-commutativeN/A
*-commutativeN/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
Applied rewrites67.9%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
*-commutativeN/A
associate-/r*N/A
+-commutativeN/A
pow2N/A
*-commutativeN/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites81.2%
Taylor expanded in x around inf
*-commutativeN/A
pow2N/A
lift-*.f64N/A
lift-*.f6440.8
Applied rewrites40.8%
(FPCore (x y z) :precision binary64 (if (<= x 4e+135) (/ (* (cosh x) y) (* z x)) (/ (/ (* (* (* x x) 0.5) y) z) x)))
double code(double x, double y, double z) {
double tmp;
if (x <= 4e+135) {
tmp = (cosh(x) * y) / (z * x);
} else {
tmp = ((((x * x) * 0.5) * y) / z) / 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 (x <= 4d+135) then
tmp = (cosh(x) * y) / (z * x)
else
tmp = ((((x * x) * 0.5d0) * y) / z) / x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= 4e+135) {
tmp = (Math.cosh(x) * y) / (z * x);
} else {
tmp = ((((x * x) * 0.5) * y) / z) / x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= 4e+135: tmp = (math.cosh(x) * y) / (z * x) else: tmp = ((((x * x) * 0.5) * y) / z) / x return tmp
function code(x, y, z) tmp = 0.0 if (x <= 4e+135) tmp = Float64(Float64(cosh(x) * y) / Float64(z * x)); else tmp = Float64(Float64(Float64(Float64(Float64(x * x) * 0.5) * y) / z) / x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= 4e+135) tmp = (cosh(x) * y) / (z * x); else tmp = ((((x * x) * 0.5) * y) / z) / x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, 4e+135], N[(N[(N[Cosh[x], $MachinePrecision] * y), $MachinePrecision] / N[(z * x), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(N[(x * x), $MachinePrecision] * 0.5), $MachinePrecision] * y), $MachinePrecision] / z), $MachinePrecision] / x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 4 \cdot 10^{+135}:\\
\;\;\;\;\frac{\cosh x \cdot y}{z \cdot x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\left(\left(x \cdot x\right) \cdot 0.5\right) \cdot y}{z}}{x}\\
\end{array}
\end{array}
if x < 3.99999999999999985e135Initial program 85.1%
lift-/.f64N/A
lift-*.f64N/A
lift-cosh.f64N/A
lift-/.f64N/A
associate-*r/N/A
associate-/l/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-cosh.f64N/A
*-commutativeN/A
lower-*.f6483.4
Applied rewrites83.4%
if 3.99999999999999985e135 < x Initial program 85.1%
Taylor expanded in x around 0
lower-/.f64N/A
associate-*r/N/A
div-add-revN/A
+-commutativeN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6481.0
Applied rewrites81.0%
Taylor expanded in x around inf
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
pow2N/A
lift-*.f6440.5
Applied rewrites40.5%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (fma (* x x) 0.5 1.0)))
(if (<= (* (cosh x) (/ y x)) 5e+169)
(/ (* t_0 (/ y x)) z)
(/ (* y (/ t_0 z)) x))))
double code(double x, double y, double z) {
double t_0 = fma((x * x), 0.5, 1.0);
double tmp;
if ((cosh(x) * (y / x)) <= 5e+169) {
tmp = (t_0 * (y / x)) / z;
} else {
tmp = (y * (t_0 / z)) / x;
}
return tmp;
}
function code(x, y, z) t_0 = fma(Float64(x * x), 0.5, 1.0) tmp = 0.0 if (Float64(cosh(x) * Float64(y / x)) <= 5e+169) tmp = Float64(Float64(t_0 * Float64(y / x)) / z); else tmp = Float64(Float64(y * Float64(t_0 / z)) / x); end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(x * x), $MachinePrecision] * 0.5 + 1.0), $MachinePrecision]}, If[LessEqual[N[(N[Cosh[x], $MachinePrecision] * N[(y / x), $MachinePrecision]), $MachinePrecision], 5e+169], N[(N[(t$95$0 * N[(y / x), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], N[(N[(y * N[(t$95$0 / z), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(x \cdot x, 0.5, 1\right)\\
\mathbf{if}\;\cosh x \cdot \frac{y}{x} \leq 5 \cdot 10^{+169}:\\
\;\;\;\;\frac{t\_0 \cdot \frac{y}{x}}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{y \cdot \frac{t\_0}{z}}{x}\\
\end{array}
\end{array}
if (*.f64 (cosh.f64 x) (/.f64 y x)) < 5.00000000000000017e169Initial program 85.1%
Taylor expanded in x around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6469.4
Applied rewrites69.4%
if 5.00000000000000017e169 < (*.f64 (cosh.f64 x) (/.f64 y x)) Initial program 85.1%
Taylor expanded in x around 0
lower-/.f64N/A
associate-*r/N/A
div-add-revN/A
+-commutativeN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6481.0
Applied rewrites81.0%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
lower-fma.f64N/A
*-commutativeN/A
associate-*r*N/A
*-lft-identityN/A
distribute-rgt-inN/A
+-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f6481.2
Applied rewrites81.2%
(FPCore (x y z) :precision binary64 (if (<= (/ (* (cosh x) (/ y x)) z) 5e+298) (/ (/ (fma (* (* x x) y) 0.5 y) x) z) (/ (* y (/ (fma (* x x) 0.5 1.0) z)) x)))
double code(double x, double y, double z) {
double tmp;
if (((cosh(x) * (y / x)) / z) <= 5e+298) {
tmp = (fma(((x * x) * y), 0.5, y) / x) / z;
} else {
tmp = (y * (fma((x * x), 0.5, 1.0) / z)) / x;
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (Float64(Float64(cosh(x) * Float64(y / x)) / z) <= 5e+298) tmp = Float64(Float64(fma(Float64(Float64(x * x) * y), 0.5, y) / x) / z); else tmp = Float64(Float64(y * Float64(fma(Float64(x * x), 0.5, 1.0) / z)) / x); end return tmp end
code[x_, y_, z_] := If[LessEqual[N[(N[(N[Cosh[x], $MachinePrecision] * N[(y / x), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], 5e+298], N[(N[(N[(N[(N[(x * x), $MachinePrecision] * y), $MachinePrecision] * 0.5 + y), $MachinePrecision] / x), $MachinePrecision] / z), $MachinePrecision], N[(N[(y * N[(N[(N[(x * x), $MachinePrecision] * 0.5 + 1.0), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{\cosh x \cdot \frac{y}{x}}{z} \leq 5 \cdot 10^{+298}:\\
\;\;\;\;\frac{\frac{\mathsf{fma}\left(\left(x \cdot x\right) \cdot y, 0.5, y\right)}{x}}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{y \cdot \frac{\mathsf{fma}\left(x \cdot x, 0.5, 1\right)}{z}}{x}\\
\end{array}
\end{array}
if (/.f64 (*.f64 (cosh.f64 x) (/.f64 y x)) z) < 5.0000000000000003e298Initial program 85.1%
Taylor expanded in x around 0
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6479.7
Applied rewrites79.7%
if 5.0000000000000003e298 < (/.f64 (*.f64 (cosh.f64 x) (/.f64 y x)) z) Initial program 85.1%
Taylor expanded in x around 0
lower-/.f64N/A
associate-*r/N/A
div-add-revN/A
+-commutativeN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6481.0
Applied rewrites81.0%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
lower-fma.f64N/A
*-commutativeN/A
associate-*r*N/A
*-lft-identityN/A
distribute-rgt-inN/A
+-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f6481.2
Applied rewrites81.2%
(FPCore (x y z) :precision binary64 (let* ((t_0 (/ (fma (* x x) 0.5 1.0) z))) (if (<= (* (cosh x) (/ y x)) 4e+153) (* (/ y x) t_0) (/ (* y t_0) x))))
double code(double x, double y, double z) {
double t_0 = fma((x * x), 0.5, 1.0) / z;
double tmp;
if ((cosh(x) * (y / x)) <= 4e+153) {
tmp = (y / x) * t_0;
} else {
tmp = (y * t_0) / x;
}
return tmp;
}
function code(x, y, z) t_0 = Float64(fma(Float64(x * x), 0.5, 1.0) / z) tmp = 0.0 if (Float64(cosh(x) * Float64(y / x)) <= 4e+153) tmp = Float64(Float64(y / x) * t_0); else tmp = Float64(Float64(y * t_0) / x); end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(N[(x * x), $MachinePrecision] * 0.5 + 1.0), $MachinePrecision] / z), $MachinePrecision]}, If[LessEqual[N[(N[Cosh[x], $MachinePrecision] * N[(y / x), $MachinePrecision]), $MachinePrecision], 4e+153], N[(N[(y / x), $MachinePrecision] * t$95$0), $MachinePrecision], N[(N[(y * t$95$0), $MachinePrecision] / x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\mathsf{fma}\left(x \cdot x, 0.5, 1\right)}{z}\\
\mathbf{if}\;\cosh x \cdot \frac{y}{x} \leq 4 \cdot 10^{+153}:\\
\;\;\;\;\frac{y}{x} \cdot t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{y \cdot t\_0}{x}\\
\end{array}
\end{array}
if (*.f64 (cosh.f64 x) (/.f64 y x)) < 4e153Initial program 85.1%
lift-/.f64N/A
lift-*.f64N/A
lift-cosh.f64N/A
lift-/.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lift-/.f64N/A
lower-/.f64N/A
lift-cosh.f6485.1
Applied rewrites85.1%
Taylor expanded in x around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f6470.4
Applied rewrites70.4%
if 4e153 < (*.f64 (cosh.f64 x) (/.f64 y x)) Initial program 85.1%
Taylor expanded in x around 0
lower-/.f64N/A
associate-*r/N/A
div-add-revN/A
+-commutativeN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6481.0
Applied rewrites81.0%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
lower-fma.f64N/A
*-commutativeN/A
associate-*r*N/A
*-lft-identityN/A
distribute-rgt-inN/A
+-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f6481.2
Applied rewrites81.2%
(FPCore (x y z) :precision binary64 (if (<= (/ (* (cosh x) (/ y x)) z) 1e-53) (/ (/ y x) z) (/ (* y (/ (fma (* x x) 0.5 1.0) z)) x)))
double code(double x, double y, double z) {
double tmp;
if (((cosh(x) * (y / x)) / z) <= 1e-53) {
tmp = (y / x) / z;
} else {
tmp = (y * (fma((x * x), 0.5, 1.0) / z)) / x;
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (Float64(Float64(cosh(x) * Float64(y / x)) / z) <= 1e-53) tmp = Float64(Float64(y / x) / z); else tmp = Float64(Float64(y * Float64(fma(Float64(x * x), 0.5, 1.0) / z)) / x); end return tmp end
code[x_, y_, z_] := If[LessEqual[N[(N[(N[Cosh[x], $MachinePrecision] * N[(y / x), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], 1e-53], N[(N[(y / x), $MachinePrecision] / z), $MachinePrecision], N[(N[(y * N[(N[(N[(x * x), $MachinePrecision] * 0.5 + 1.0), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{\cosh x \cdot \frac{y}{x}}{z} \leq 10^{-53}:\\
\;\;\;\;\frac{\frac{y}{x}}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{y \cdot \frac{\mathsf{fma}\left(x \cdot x, 0.5, 1\right)}{z}}{x}\\
\end{array}
\end{array}
if (/.f64 (*.f64 (cosh.f64 x) (/.f64 y x)) z) < 1.00000000000000003e-53Initial program 85.1%
Taylor expanded in x around 0
lift-/.f6449.5
Applied rewrites49.5%
if 1.00000000000000003e-53 < (/.f64 (*.f64 (cosh.f64 x) (/.f64 y x)) z) Initial program 85.1%
Taylor expanded in x around 0
lower-/.f64N/A
associate-*r/N/A
div-add-revN/A
+-commutativeN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6481.0
Applied rewrites81.0%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
lower-fma.f64N/A
*-commutativeN/A
associate-*r*N/A
*-lft-identityN/A
distribute-rgt-inN/A
+-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f6481.2
Applied rewrites81.2%
(FPCore (x y z) :precision binary64 (if (<= x 380000.0) (/ (* (fma (* x x) 0.5 1.0) y) (* z x)) (/ (* (/ (* (* x x) 0.5) z) y) x)))
double code(double x, double y, double z) {
double tmp;
if (x <= 380000.0) {
tmp = (fma((x * x), 0.5, 1.0) * y) / (z * x);
} else {
tmp = ((((x * x) * 0.5) / z) * y) / x;
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (x <= 380000.0) tmp = Float64(Float64(fma(Float64(x * x), 0.5, 1.0) * y) / Float64(z * x)); else tmp = Float64(Float64(Float64(Float64(Float64(x * x) * 0.5) / z) * y) / x); end return tmp end
code[x_, y_, z_] := If[LessEqual[x, 380000.0], N[(N[(N[(N[(x * x), $MachinePrecision] * 0.5 + 1.0), $MachinePrecision] * y), $MachinePrecision] / N[(z * x), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(N[(x * x), $MachinePrecision] * 0.5), $MachinePrecision] / z), $MachinePrecision] * y), $MachinePrecision] / x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 380000:\\
\;\;\;\;\frac{\mathsf{fma}\left(x \cdot x, 0.5, 1\right) \cdot y}{z \cdot x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\left(x \cdot x\right) \cdot 0.5}{z} \cdot y}{x}\\
\end{array}
\end{array}
if x < 3.8e5Initial program 85.1%
Taylor expanded in x around 0
lower-/.f64N/A
associate-*r/N/A
div-add-revN/A
+-commutativeN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6481.0
Applied rewrites81.0%
lift-/.f64N/A
lift-/.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-/l/N/A
*-commutativeN/A
lower-/.f64N/A
*-commutativeN/A
pow2N/A
associate-*r*N/A
distribute-lft1-inN/A
+-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f64N/A
*-commutativeN/A
Applied rewrites69.0%
if 3.8e5 < x Initial program 85.1%
Taylor expanded in x around 0
lower-/.f64N/A
associate-*r/N/A
div-add-revN/A
+-commutativeN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6481.0
Applied rewrites81.0%
lift-/.f64N/A
lift-/.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-/l/N/A
*-commutativeN/A
pow2N/A
associate-*r*N/A
distribute-lft1-inN/A
+-commutativeN/A
*-commutativeN/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
Applied rewrites67.9%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
*-commutativeN/A
associate-/r*N/A
+-commutativeN/A
pow2N/A
*-commutativeN/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites81.2%
Taylor expanded in x around inf
*-commutativeN/A
pow2N/A
lift-*.f64N/A
lift-*.f6440.8
Applied rewrites40.8%
(FPCore (x y z) :precision binary64 (if (<= x 380000.0) (* (/ (fma (* x x) 0.5 1.0) (* z x)) y) (/ (* (/ (* (* x x) 0.5) z) y) x)))
double code(double x, double y, double z) {
double tmp;
if (x <= 380000.0) {
tmp = (fma((x * x), 0.5, 1.0) / (z * x)) * y;
} else {
tmp = ((((x * x) * 0.5) / z) * y) / x;
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (x <= 380000.0) tmp = Float64(Float64(fma(Float64(x * x), 0.5, 1.0) / Float64(z * x)) * y); else tmp = Float64(Float64(Float64(Float64(Float64(x * x) * 0.5) / z) * y) / x); end return tmp end
code[x_, y_, z_] := If[LessEqual[x, 380000.0], N[(N[(N[(N[(x * x), $MachinePrecision] * 0.5 + 1.0), $MachinePrecision] / N[(z * x), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision], N[(N[(N[(N[(N[(x * x), $MachinePrecision] * 0.5), $MachinePrecision] / z), $MachinePrecision] * y), $MachinePrecision] / x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 380000:\\
\;\;\;\;\frac{\mathsf{fma}\left(x \cdot x, 0.5, 1\right)}{z \cdot x} \cdot y\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\left(x \cdot x\right) \cdot 0.5}{z} \cdot y}{x}\\
\end{array}
\end{array}
if x < 3.8e5Initial program 85.1%
Taylor expanded in x around 0
lower-/.f64N/A
associate-*r/N/A
div-add-revN/A
+-commutativeN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6481.0
Applied rewrites81.0%
lift-/.f64N/A
lift-/.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-/l/N/A
*-commutativeN/A
pow2N/A
associate-*r*N/A
distribute-lft1-inN/A
+-commutativeN/A
*-commutativeN/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
Applied rewrites67.9%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-*.f6467.9
Applied rewrites67.9%
if 3.8e5 < x Initial program 85.1%
Taylor expanded in x around 0
lower-/.f64N/A
associate-*r/N/A
div-add-revN/A
+-commutativeN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6481.0
Applied rewrites81.0%
lift-/.f64N/A
lift-/.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-/l/N/A
*-commutativeN/A
pow2N/A
associate-*r*N/A
distribute-lft1-inN/A
+-commutativeN/A
*-commutativeN/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
Applied rewrites67.9%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
*-commutativeN/A
associate-/r*N/A
+-commutativeN/A
pow2N/A
*-commutativeN/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites81.2%
Taylor expanded in x around inf
*-commutativeN/A
pow2N/A
lift-*.f64N/A
lift-*.f6440.8
Applied rewrites40.8%
(FPCore (x y z) :precision binary64 (if (<= x 1.4) (/ (/ y x) z) (/ (* (/ (* (* x x) 0.5) z) y) x)))
double code(double x, double y, double z) {
double tmp;
if (x <= 1.4) {
tmp = (y / x) / z;
} else {
tmp = ((((x * x) * 0.5) / z) * y) / 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 (x <= 1.4d0) then
tmp = (y / x) / z
else
tmp = ((((x * x) * 0.5d0) / z) * y) / x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= 1.4) {
tmp = (y / x) / z;
} else {
tmp = ((((x * x) * 0.5) / z) * y) / x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= 1.4: tmp = (y / x) / z else: tmp = ((((x * x) * 0.5) / z) * y) / x return tmp
function code(x, y, z) tmp = 0.0 if (x <= 1.4) tmp = Float64(Float64(y / x) / z); else tmp = Float64(Float64(Float64(Float64(Float64(x * x) * 0.5) / z) * y) / x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= 1.4) tmp = (y / x) / z; else tmp = ((((x * x) * 0.5) / z) * y) / x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, 1.4], N[(N[(y / x), $MachinePrecision] / z), $MachinePrecision], N[(N[(N[(N[(N[(x * x), $MachinePrecision] * 0.5), $MachinePrecision] / z), $MachinePrecision] * y), $MachinePrecision] / x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.4:\\
\;\;\;\;\frac{\frac{y}{x}}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\left(x \cdot x\right) \cdot 0.5}{z} \cdot y}{x}\\
\end{array}
\end{array}
if x < 1.3999999999999999Initial program 85.1%
Taylor expanded in x around 0
lift-/.f6449.5
Applied rewrites49.5%
if 1.3999999999999999 < x Initial program 85.1%
Taylor expanded in x around 0
lower-/.f64N/A
associate-*r/N/A
div-add-revN/A
+-commutativeN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6481.0
Applied rewrites81.0%
lift-/.f64N/A
lift-/.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-/l/N/A
*-commutativeN/A
pow2N/A
associate-*r*N/A
distribute-lft1-inN/A
+-commutativeN/A
*-commutativeN/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
Applied rewrites67.9%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
*-commutativeN/A
associate-/r*N/A
+-commutativeN/A
pow2N/A
*-commutativeN/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites81.2%
Taylor expanded in x around inf
*-commutativeN/A
pow2N/A
lift-*.f64N/A
lift-*.f6440.8
Applied rewrites40.8%
(FPCore (x y z) :precision binary64 (if (<= x 1.4) (/ (/ y x) z) (* y (/ (* (* x x) 0.5) (* z x)))))
double code(double x, double y, double z) {
double tmp;
if (x <= 1.4) {
tmp = (y / x) / z;
} else {
tmp = y * (((x * x) * 0.5) / (z * 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 (x <= 1.4d0) then
tmp = (y / x) / z
else
tmp = y * (((x * x) * 0.5d0) / (z * x))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= 1.4) {
tmp = (y / x) / z;
} else {
tmp = y * (((x * x) * 0.5) / (z * x));
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= 1.4: tmp = (y / x) / z else: tmp = y * (((x * x) * 0.5) / (z * x)) return tmp
function code(x, y, z) tmp = 0.0 if (x <= 1.4) tmp = Float64(Float64(y / x) / z); else tmp = Float64(y * Float64(Float64(Float64(x * x) * 0.5) / Float64(z * x))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= 1.4) tmp = (y / x) / z; else tmp = y * (((x * x) * 0.5) / (z * x)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, 1.4], N[(N[(y / x), $MachinePrecision] / z), $MachinePrecision], N[(y * N[(N[(N[(x * x), $MachinePrecision] * 0.5), $MachinePrecision] / N[(z * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.4:\\
\;\;\;\;\frac{\frac{y}{x}}{z}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{\left(x \cdot x\right) \cdot 0.5}{z \cdot x}\\
\end{array}
\end{array}
if x < 1.3999999999999999Initial program 85.1%
Taylor expanded in x around 0
lift-/.f6449.5
Applied rewrites49.5%
if 1.3999999999999999 < x Initial program 85.1%
Taylor expanded in x around 0
lower-/.f64N/A
associate-*r/N/A
div-add-revN/A
+-commutativeN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6481.0
Applied rewrites81.0%
lift-/.f64N/A
lift-/.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-/l/N/A
*-commutativeN/A
pow2N/A
associate-*r*N/A
distribute-lft1-inN/A
+-commutativeN/A
*-commutativeN/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
Applied rewrites67.9%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
pow2N/A
lift-*.f6428.9
Applied rewrites28.9%
(FPCore (x y z) :precision binary64 (if (<= x 1.4) (/ (/ y x) z) (* (* y x) (/ 0.5 z))))
double code(double x, double y, double z) {
double tmp;
if (x <= 1.4) {
tmp = (y / x) / z;
} else {
tmp = (y * x) * (0.5 / z);
}
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 (x <= 1.4d0) then
tmp = (y / x) / z
else
tmp = (y * x) * (0.5d0 / z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= 1.4) {
tmp = (y / x) / z;
} else {
tmp = (y * x) * (0.5 / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= 1.4: tmp = (y / x) / z else: tmp = (y * x) * (0.5 / z) return tmp
function code(x, y, z) tmp = 0.0 if (x <= 1.4) tmp = Float64(Float64(y / x) / z); else tmp = Float64(Float64(y * x) * Float64(0.5 / z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= 1.4) tmp = (y / x) / z; else tmp = (y * x) * (0.5 / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, 1.4], N[(N[(y / x), $MachinePrecision] / z), $MachinePrecision], N[(N[(y * x), $MachinePrecision] * N[(0.5 / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.4:\\
\;\;\;\;\frac{\frac{y}{x}}{z}\\
\mathbf{else}:\\
\;\;\;\;\left(y \cdot x\right) \cdot \frac{0.5}{z}\\
\end{array}
\end{array}
if x < 1.3999999999999999Initial program 85.1%
Taylor expanded in x around 0
lift-/.f6449.5
Applied rewrites49.5%
if 1.3999999999999999 < x Initial program 85.1%
Taylor expanded in x around 0
lower-/.f64N/A
associate-*r/N/A
div-add-revN/A
+-commutativeN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6481.0
Applied rewrites81.0%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6425.9
Applied rewrites25.9%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-/l*N/A
associate-*l/N/A
associate-/l*N/A
metadata-evalN/A
associate-*r/N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f6425.9
Applied rewrites25.9%
(FPCore (x y z) :precision binary64 (if (<= x 1.4) (/ (/ y x) z) (* (* x (/ y z)) 0.5)))
double code(double x, double y, double z) {
double tmp;
if (x <= 1.4) {
tmp = (y / x) / z;
} else {
tmp = (x * (y / z)) * 0.5;
}
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 (x <= 1.4d0) then
tmp = (y / x) / z
else
tmp = (x * (y / z)) * 0.5d0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= 1.4) {
tmp = (y / x) / z;
} else {
tmp = (x * (y / z)) * 0.5;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= 1.4: tmp = (y / x) / z else: tmp = (x * (y / z)) * 0.5 return tmp
function code(x, y, z) tmp = 0.0 if (x <= 1.4) tmp = Float64(Float64(y / x) / z); else tmp = Float64(Float64(x * Float64(y / z)) * 0.5); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= 1.4) tmp = (y / x) / z; else tmp = (x * (y / z)) * 0.5; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, 1.4], N[(N[(y / x), $MachinePrecision] / z), $MachinePrecision], N[(N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.4:\\
\;\;\;\;\frac{\frac{y}{x}}{z}\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot \frac{y}{z}\right) \cdot 0.5\\
\end{array}
\end{array}
if x < 1.3999999999999999Initial program 85.1%
Taylor expanded in x around 0
lift-/.f6449.5
Applied rewrites49.5%
if 1.3999999999999999 < x Initial program 85.1%
Taylor expanded in x around 0
lower-/.f64N/A
associate-*r/N/A
div-add-revN/A
+-commutativeN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6481.0
Applied rewrites81.0%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6425.9
Applied rewrites25.9%
(FPCore (x y z) :precision binary64 (if (<= (* (cosh x) (/ y x)) 1e+185) (/ (/ y x) z) (/ (/ y z) x)))
double code(double x, double y, double z) {
double tmp;
if ((cosh(x) * (y / x)) <= 1e+185) {
tmp = (y / x) / z;
} else {
tmp = (y / z) / 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 ((cosh(x) * (y / x)) <= 1d+185) then
tmp = (y / x) / z
else
tmp = (y / z) / x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((Math.cosh(x) * (y / x)) <= 1e+185) {
tmp = (y / x) / z;
} else {
tmp = (y / z) / x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (math.cosh(x) * (y / x)) <= 1e+185: tmp = (y / x) / z else: tmp = (y / z) / x return tmp
function code(x, y, z) tmp = 0.0 if (Float64(cosh(x) * Float64(y / x)) <= 1e+185) tmp = Float64(Float64(y / x) / z); else tmp = Float64(Float64(y / z) / x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((cosh(x) * (y / x)) <= 1e+185) tmp = (y / x) / z; else tmp = (y / z) / x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[N[(N[Cosh[x], $MachinePrecision] * N[(y / x), $MachinePrecision]), $MachinePrecision], 1e+185], N[(N[(y / x), $MachinePrecision] / z), $MachinePrecision], N[(N[(y / z), $MachinePrecision] / x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cosh x \cdot \frac{y}{x} \leq 10^{+185}:\\
\;\;\;\;\frac{\frac{y}{x}}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{y}{z}}{x}\\
\end{array}
\end{array}
if (*.f64 (cosh.f64 x) (/.f64 y x)) < 9.9999999999999998e184Initial program 85.1%
Taylor expanded in x around 0
lift-/.f6449.5
Applied rewrites49.5%
if 9.9999999999999998e184 < (*.f64 (cosh.f64 x) (/.f64 y x)) Initial program 85.1%
Taylor expanded in x around 0
lower-/.f64N/A
associate-*r/N/A
div-add-revN/A
+-commutativeN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6481.0
Applied rewrites81.0%
Taylor expanded in x around 0
Applied rewrites53.4%
(FPCore (x y z) :precision binary64 (if (<= (/ (* (cosh x) (/ y x)) z) 2e-42) (/ y (* z x)) (/ (/ y z) x)))
double code(double x, double y, double z) {
double tmp;
if (((cosh(x) * (y / x)) / z) <= 2e-42) {
tmp = y / (z * x);
} else {
tmp = (y / z) / 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 (((cosh(x) * (y / x)) / z) <= 2d-42) then
tmp = y / (z * x)
else
tmp = (y / z) / x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (((Math.cosh(x) * (y / x)) / z) <= 2e-42) {
tmp = y / (z * x);
} else {
tmp = (y / z) / x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if ((math.cosh(x) * (y / x)) / z) <= 2e-42: tmp = y / (z * x) else: tmp = (y / z) / x return tmp
function code(x, y, z) tmp = 0.0 if (Float64(Float64(cosh(x) * Float64(y / x)) / z) <= 2e-42) tmp = Float64(y / Float64(z * x)); else tmp = Float64(Float64(y / z) / x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (((cosh(x) * (y / x)) / z) <= 2e-42) tmp = y / (z * x); else tmp = (y / z) / x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[N[(N[(N[Cosh[x], $MachinePrecision] * N[(y / x), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], 2e-42], N[(y / N[(z * x), $MachinePrecision]), $MachinePrecision], N[(N[(y / z), $MachinePrecision] / x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{\cosh x \cdot \frac{y}{x}}{z} \leq 2 \cdot 10^{-42}:\\
\;\;\;\;\frac{y}{z \cdot x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{y}{z}}{x}\\
\end{array}
\end{array}
if (/.f64 (*.f64 (cosh.f64 x) (/.f64 y x)) z) < 2.00000000000000008e-42Initial program 85.1%
Taylor expanded in x around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f6449.4
Applied rewrites49.4%
if 2.00000000000000008e-42 < (/.f64 (*.f64 (cosh.f64 x) (/.f64 y x)) z) Initial program 85.1%
Taylor expanded in x around 0
lower-/.f64N/A
associate-*r/N/A
div-add-revN/A
+-commutativeN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6481.0
Applied rewrites81.0%
Taylor expanded in x around 0
Applied rewrites53.4%
(FPCore (x y z) :precision binary64 (/ y (* z x)))
double code(double x, double y, double z) {
return y / (z * x);
}
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 = y / (z * x)
end function
public static double code(double x, double y, double z) {
return y / (z * x);
}
def code(x, y, z): return y / (z * x)
function code(x, y, z) return Float64(y / Float64(z * x)) end
function tmp = code(x, y, z) tmp = y / (z * x); end
code[x_, y_, z_] := N[(y / N[(z * x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{y}{z \cdot x}
\end{array}
Initial program 85.1%
Taylor expanded in x around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f6449.4
Applied rewrites49.4%
herbie shell --seed 2025123
(FPCore (x y z)
:name "Linear.Quaternion:$ctan from linear-1.19.1.3"
:precision binary64
(/ (* (cosh x) (/ y x)) z))