
(FPCore (x y z t) :precision binary64 (* (* (- (* x 0.5) y) (sqrt (* z 2.0))) (exp (/ (* t t) 2.0))))
double code(double x, double y, double z, double t) {
return (((x * 0.5) - y) * sqrt((z * 2.0))) * exp(((t * t) / 2.0));
}
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, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((x * 0.5d0) - y) * sqrt((z * 2.0d0))) * exp(((t * t) / 2.0d0))
end function
public static double code(double x, double y, double z, double t) {
return (((x * 0.5) - y) * Math.sqrt((z * 2.0))) * Math.exp(((t * t) / 2.0));
}
def code(x, y, z, t): return (((x * 0.5) - y) * math.sqrt((z * 2.0))) * math.exp(((t * t) / 2.0))
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(z * 2.0))) * exp(Float64(Float64(t * t) / 2.0))) end
function tmp = code(x, y, z, t) tmp = (((x * 0.5) - y) * sqrt((z * 2.0))) * exp(((t * t) / 2.0)); end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Exp[N[(N[(t * t), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot e^{\frac{t \cdot t}{2}}
\end{array}
Herbie found 23 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (* (* (- (* x 0.5) y) (sqrt (* z 2.0))) (exp (/ (* t t) 2.0))))
double code(double x, double y, double z, double t) {
return (((x * 0.5) - y) * sqrt((z * 2.0))) * exp(((t * t) / 2.0));
}
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, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((x * 0.5d0) - y) * sqrt((z * 2.0d0))) * exp(((t * t) / 2.0d0))
end function
public static double code(double x, double y, double z, double t) {
return (((x * 0.5) - y) * Math.sqrt((z * 2.0))) * Math.exp(((t * t) / 2.0));
}
def code(x, y, z, t): return (((x * 0.5) - y) * math.sqrt((z * 2.0))) * math.exp(((t * t) / 2.0))
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(z * 2.0))) * exp(Float64(Float64(t * t) / 2.0))) end
function tmp = code(x, y, z, t) tmp = (((x * 0.5) - y) * sqrt((z * 2.0))) * exp(((t * t) / 2.0)); end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Exp[N[(N[(t * t), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot e^{\frac{t \cdot t}{2}}
\end{array}
(FPCore (x y z t) :precision binary64 (* (* (* (sqrt z) (sqrt (pow (exp t) t))) (fma 0.5 x (- y))) (sqrt 2.0)))
double code(double x, double y, double z, double t) {
return ((sqrt(z) * sqrt(pow(exp(t), t))) * fma(0.5, x, -y)) * sqrt(2.0);
}
function code(x, y, z, t) return Float64(Float64(Float64(sqrt(z) * sqrt((exp(t) ^ t))) * fma(0.5, x, Float64(-y))) * sqrt(2.0)) end
code[x_, y_, z_, t_] := N[(N[(N[(N[Sqrt[z], $MachinePrecision] * N[Sqrt[N[Power[N[Exp[t], $MachinePrecision], t], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(0.5 * x + (-y)), $MachinePrecision]), $MachinePrecision] * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\sqrt{z} \cdot \sqrt{{\left(e^{t}\right)}^{t}}\right) \cdot \mathsf{fma}\left(0.5, x, -y\right)\right) \cdot \sqrt{2}
\end{array}
Initial program 99.4%
lift-*.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-sqrt.f64N/A
*-commutativeN/A
sqrt-prodN/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
lift-exp.f64N/A
lift-*.f64N/A
lift-/.f64N/A
pow2N/A
exp-sqrtN/A
pow1/2N/A
exp-prodN/A
*-commutativeN/A
Applied rewrites99.6%
(FPCore (x y z t) :precision binary64 (* (* (fma x 0.5 (- y)) (sqrt (* z (pow (+ 1.0 t) t)))) (sqrt 2.0)))
double code(double x, double y, double z, double t) {
return (fma(x, 0.5, -y) * sqrt((z * pow((1.0 + t), t)))) * sqrt(2.0);
}
function code(x, y, z, t) return Float64(Float64(fma(x, 0.5, Float64(-y)) * sqrt(Float64(z * (Float64(1.0 + t) ^ t)))) * sqrt(2.0)) end
code[x_, y_, z_, t_] := N[(N[(N[(x * 0.5 + (-y)), $MachinePrecision] * N[Sqrt[N[(z * N[Power[N[(1.0 + t), $MachinePrecision], t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\mathsf{fma}\left(x, 0.5, -y\right) \cdot \sqrt{z \cdot {\left(1 + t\right)}^{t}}\right) \cdot \sqrt{2}
\end{array}
Initial program 99.4%
lift-*.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-sqrt.f64N/A
*-commutativeN/A
sqrt-prodN/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
lift-exp.f64N/A
lift-*.f64N/A
lift-/.f64N/A
pow2N/A
exp-sqrtN/A
pow1/2N/A
exp-prodN/A
*-commutativeN/A
Applied rewrites99.6%
Taylor expanded in t around 0
lower-+.f6475.4
Applied rewrites75.4%
lift-*.f64N/A
lift-fma.f64N/A
lift-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lift-neg.f64N/A
lower-fma.f6475.4
lift-*.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
lower-sqrt.f64N/A
lower-*.f6475.4
Applied rewrites75.4%
(FPCore (x y z t) :precision binary64 (* (* (- (* x 0.5) y) (sqrt (* z 2.0))) (exp (* (* t t) 0.5))))
double code(double x, double y, double z, double t) {
return (((x * 0.5) - y) * sqrt((z * 2.0))) * exp(((t * t) * 0.5));
}
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, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((x * 0.5d0) - y) * sqrt((z * 2.0d0))) * exp(((t * t) * 0.5d0))
end function
public static double code(double x, double y, double z, double t) {
return (((x * 0.5) - y) * Math.sqrt((z * 2.0))) * Math.exp(((t * t) * 0.5));
}
def code(x, y, z, t): return (((x * 0.5) - y) * math.sqrt((z * 2.0))) * math.exp(((t * t) * 0.5))
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(z * 2.0))) * exp(Float64(Float64(t * t) * 0.5))) end
function tmp = code(x, y, z, t) tmp = (((x * 0.5) - y) * sqrt((z * 2.0))) * exp(((t * t) * 0.5)); end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Exp[N[(N[(t * t), $MachinePrecision] * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot e^{\left(t \cdot t\right) \cdot 0.5}
\end{array}
Initial program 99.4%
lift-exp.f64N/A
lift-*.f64N/A
lift-/.f64N/A
pow2N/A
exp-sqrtN/A
pow1/2N/A
exp-prodN/A
*-commutativeN/A
lower-exp.f64N/A
*-commutativeN/A
lower-*.f64N/A
pow2N/A
lift-*.f6499.4
Applied rewrites99.4%
(FPCore (x y z t)
:precision binary64
(*
(*
(*
(sqrt z)
(fma
(fma (fma 0.020833333333333332 (* t t) 0.125) (* t t) 0.5)
(* t t)
1.0))
(fma 0.5 x (- y)))
(sqrt 2.0)))
double code(double x, double y, double z, double t) {
return ((sqrt(z) * fma(fma(fma(0.020833333333333332, (t * t), 0.125), (t * t), 0.5), (t * t), 1.0)) * fma(0.5, x, -y)) * sqrt(2.0);
}
function code(x, y, z, t) return Float64(Float64(Float64(sqrt(z) * fma(fma(fma(0.020833333333333332, Float64(t * t), 0.125), Float64(t * t), 0.5), Float64(t * t), 1.0)) * fma(0.5, x, Float64(-y))) * sqrt(2.0)) end
code[x_, y_, z_, t_] := N[(N[(N[(N[Sqrt[z], $MachinePrecision] * N[(N[(N[(0.020833333333333332 * N[(t * t), $MachinePrecision] + 0.125), $MachinePrecision] * N[(t * t), $MachinePrecision] + 0.5), $MachinePrecision] * N[(t * t), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] * N[(0.5 * x + (-y)), $MachinePrecision]), $MachinePrecision] * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\sqrt{z} \cdot \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.020833333333333332, t \cdot t, 0.125\right), t \cdot t, 0.5\right), t \cdot t, 1\right)\right) \cdot \mathsf{fma}\left(0.5, x, -y\right)\right) \cdot \sqrt{2}
\end{array}
Initial program 99.4%
lift-*.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-sqrt.f64N/A
*-commutativeN/A
sqrt-prodN/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
lift-exp.f64N/A
lift-*.f64N/A
lift-/.f64N/A
pow2N/A
exp-sqrtN/A
pow1/2N/A
exp-prodN/A
*-commutativeN/A
Applied rewrites99.6%
Taylor expanded in t around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f64N/A
pow2N/A
lift-*.f64N/A
pow2N/A
lift-*.f6495.0
Applied rewrites95.0%
(FPCore (x y z t)
:precision binary64
(*
(*
(sqrt z)
(*
(fma
(fma (fma 0.020833333333333332 (* t t) 0.125) (* t t) 0.5)
(* t t)
1.0)
(fma x 0.5 (- y))))
(sqrt 2.0)))
double code(double x, double y, double z, double t) {
return (sqrt(z) * (fma(fma(fma(0.020833333333333332, (t * t), 0.125), (t * t), 0.5), (t * t), 1.0) * fma(x, 0.5, -y))) * sqrt(2.0);
}
function code(x, y, z, t) return Float64(Float64(sqrt(z) * Float64(fma(fma(fma(0.020833333333333332, Float64(t * t), 0.125), Float64(t * t), 0.5), Float64(t * t), 1.0) * fma(x, 0.5, Float64(-y)))) * sqrt(2.0)) end
code[x_, y_, z_, t_] := N[(N[(N[Sqrt[z], $MachinePrecision] * N[(N[(N[(N[(0.020833333333333332 * N[(t * t), $MachinePrecision] + 0.125), $MachinePrecision] * N[(t * t), $MachinePrecision] + 0.5), $MachinePrecision] * N[(t * t), $MachinePrecision] + 1.0), $MachinePrecision] * N[(x * 0.5 + (-y)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\sqrt{z} \cdot \left(\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.020833333333333332, t \cdot t, 0.125\right), t \cdot t, 0.5\right), t \cdot t, 1\right) \cdot \mathsf{fma}\left(x, 0.5, -y\right)\right)\right) \cdot \sqrt{2}
\end{array}
Initial program 99.4%
lift-*.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-sqrt.f64N/A
*-commutativeN/A
sqrt-prodN/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
lift-exp.f64N/A
lift-*.f64N/A
lift-/.f64N/A
pow2N/A
exp-sqrtN/A
pow1/2N/A
exp-prodN/A
*-commutativeN/A
Applied rewrites99.6%
Taylor expanded in t around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f6486.1
Applied rewrites86.1%
lift-*.f64N/A
lift-*.f64N/A
lift-sqrt.f64N/A
lift-fma.f64N/A
lift-neg.f64N/A
associate-*l*N/A
lower-*.f64N/A
lift-sqrt.f64N/A
lower-*.f64N/A
*-commutativeN/A
lift-neg.f64N/A
lower-fma.f6487.6
Applied rewrites87.6%
Taylor expanded in t around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f64N/A
pow2N/A
lift-*.f64N/A
pow2N/A
lift-*.f6495.4
Applied rewrites95.4%
(FPCore (x y z t) :precision binary64 (* (* (- (* x 0.5) y) (sqrt (* z 2.0))) (fma (fma (fma 0.020833333333333332 (* t t) 0.125) (* t t) 0.5) (* t t) 1.0)))
double code(double x, double y, double z, double t) {
return (((x * 0.5) - y) * sqrt((z * 2.0))) * fma(fma(fma(0.020833333333333332, (t * t), 0.125), (t * t), 0.5), (t * t), 1.0);
}
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(z * 2.0))) * fma(fma(fma(0.020833333333333332, Float64(t * t), 0.125), Float64(t * t), 0.5), Float64(t * t), 1.0)) end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[(N[(0.020833333333333332 * N[(t * t), $MachinePrecision] + 0.125), $MachinePrecision] * N[(t * t), $MachinePrecision] + 0.5), $MachinePrecision] * N[(t * t), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.020833333333333332, t \cdot t, 0.125\right), t \cdot t, 0.5\right), t \cdot t, 1\right)
\end{array}
Initial program 99.4%
Taylor expanded in t around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f64N/A
pow2N/A
lift-*.f64N/A
pow2N/A
lift-*.f6494.5
Applied rewrites94.5%
(FPCore (x y z t)
:precision binary64
(if (<= t 7.8e+43)
(* (fma (* 0.5 x) (sqrt z) (* (- y) (sqrt z))) (sqrt 2.0))
(if (<= t 3.9e+115)
(* (* (sqrt (* (* 2.0 z) (fma (fma (* t t) 0.5 1.0) (* t t) 1.0))) 0.5) x)
(* (sqrt z) (* (* (* t t) 0.5) (* (- (* x 0.5) y) (sqrt 2.0)))))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= 7.8e+43) {
tmp = fma((0.5 * x), sqrt(z), (-y * sqrt(z))) * sqrt(2.0);
} else if (t <= 3.9e+115) {
tmp = (sqrt(((2.0 * z) * fma(fma((t * t), 0.5, 1.0), (t * t), 1.0))) * 0.5) * x;
} else {
tmp = sqrt(z) * (((t * t) * 0.5) * (((x * 0.5) - y) * sqrt(2.0)));
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (t <= 7.8e+43) tmp = Float64(fma(Float64(0.5 * x), sqrt(z), Float64(Float64(-y) * sqrt(z))) * sqrt(2.0)); elseif (t <= 3.9e+115) tmp = Float64(Float64(sqrt(Float64(Float64(2.0 * z) * fma(fma(Float64(t * t), 0.5, 1.0), Float64(t * t), 1.0))) * 0.5) * x); else tmp = Float64(sqrt(z) * Float64(Float64(Float64(t * t) * 0.5) * Float64(Float64(Float64(x * 0.5) - y) * sqrt(2.0)))); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[t, 7.8e+43], N[(N[(N[(0.5 * x), $MachinePrecision] * N[Sqrt[z], $MachinePrecision] + N[((-y) * N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 3.9e+115], N[(N[(N[Sqrt[N[(N[(2.0 * z), $MachinePrecision] * N[(N[(N[(t * t), $MachinePrecision] * 0.5 + 1.0), $MachinePrecision] * N[(t * t), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * 0.5), $MachinePrecision] * x), $MachinePrecision], N[(N[Sqrt[z], $MachinePrecision] * N[(N[(N[(t * t), $MachinePrecision] * 0.5), $MachinePrecision] * N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 7.8 \cdot 10^{+43}:\\
\;\;\;\;\mathsf{fma}\left(0.5 \cdot x, \sqrt{z}, \left(-y\right) \cdot \sqrt{z}\right) \cdot \sqrt{2}\\
\mathbf{elif}\;t \leq 3.9 \cdot 10^{+115}:\\
\;\;\;\;\left(\sqrt{\left(2 \cdot z\right) \cdot \mathsf{fma}\left(\mathsf{fma}\left(t \cdot t, 0.5, 1\right), t \cdot t, 1\right)} \cdot 0.5\right) \cdot x\\
\mathbf{else}:\\
\;\;\;\;\sqrt{z} \cdot \left(\left(\left(t \cdot t\right) \cdot 0.5\right) \cdot \left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{2}\right)\right)\\
\end{array}
\end{array}
if t < 7.8000000000000001e43Initial program 99.4%
lift-*.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-sqrt.f64N/A
*-commutativeN/A
sqrt-prodN/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
lift-exp.f64N/A
lift-*.f64N/A
lift-/.f64N/A
pow2N/A
exp-sqrtN/A
pow1/2N/A
exp-prodN/A
*-commutativeN/A
Applied rewrites99.5%
Taylor expanded in t around 0
lift-sqrt.f6468.9
Applied rewrites68.9%
lift-*.f64N/A
lift-fma.f64N/A
distribute-rgt-inN/A
lower-fma.f64N/A
lower-*.f64N/A
sqrt-prodN/A
sqrt-prodN/A
sqrt-prodN/A
Applied rewrites68.5%
if 7.8000000000000001e43 < t < 3.90000000000000006e115Initial program 99.1%
Taylor expanded in x around inf
*-commutativeN/A
*-commutativeN/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
Applied rewrites75.7%
Taylor expanded in t around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f64N/A
pow2N/A
lift-*.f6456.5
Applied rewrites56.5%
if 3.90000000000000006e115 < t Initial program 99.1%
Taylor expanded in t around 0
associate-*r*N/A
*-commutativeN/A
distribute-rgt-outN/A
lower-*.f64N/A
lower-sqrt.f64N/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites95.5%
Taylor expanded in t around inf
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
pow2N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-sqrt.f6495.5
Applied rewrites95.5%
(FPCore (x y z t)
:precision binary64
(if (<= t 7.8e+43)
(* (* (sqrt z) (fma 0.5 x (- y))) (sqrt 2.0))
(if (<= t 3.9e+115)
(* (* (sqrt (* (* 2.0 z) (fma (fma (* t t) 0.5 1.0) (* t t) 1.0))) 0.5) x)
(* (sqrt z) (* (* (* t t) 0.5) (* (- (* x 0.5) y) (sqrt 2.0)))))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= 7.8e+43) {
tmp = (sqrt(z) * fma(0.5, x, -y)) * sqrt(2.0);
} else if (t <= 3.9e+115) {
tmp = (sqrt(((2.0 * z) * fma(fma((t * t), 0.5, 1.0), (t * t), 1.0))) * 0.5) * x;
} else {
tmp = sqrt(z) * (((t * t) * 0.5) * (((x * 0.5) - y) * sqrt(2.0)));
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (t <= 7.8e+43) tmp = Float64(Float64(sqrt(z) * fma(0.5, x, Float64(-y))) * sqrt(2.0)); elseif (t <= 3.9e+115) tmp = Float64(Float64(sqrt(Float64(Float64(2.0 * z) * fma(fma(Float64(t * t), 0.5, 1.0), Float64(t * t), 1.0))) * 0.5) * x); else tmp = Float64(sqrt(z) * Float64(Float64(Float64(t * t) * 0.5) * Float64(Float64(Float64(x * 0.5) - y) * sqrt(2.0)))); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[t, 7.8e+43], N[(N[(N[Sqrt[z], $MachinePrecision] * N[(0.5 * x + (-y)), $MachinePrecision]), $MachinePrecision] * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 3.9e+115], N[(N[(N[Sqrt[N[(N[(2.0 * z), $MachinePrecision] * N[(N[(N[(t * t), $MachinePrecision] * 0.5 + 1.0), $MachinePrecision] * N[(t * t), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * 0.5), $MachinePrecision] * x), $MachinePrecision], N[(N[Sqrt[z], $MachinePrecision] * N[(N[(N[(t * t), $MachinePrecision] * 0.5), $MachinePrecision] * N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 7.8 \cdot 10^{+43}:\\
\;\;\;\;\left(\sqrt{z} \cdot \mathsf{fma}\left(0.5, x, -y\right)\right) \cdot \sqrt{2}\\
\mathbf{elif}\;t \leq 3.9 \cdot 10^{+115}:\\
\;\;\;\;\left(\sqrt{\left(2 \cdot z\right) \cdot \mathsf{fma}\left(\mathsf{fma}\left(t \cdot t, 0.5, 1\right), t \cdot t, 1\right)} \cdot 0.5\right) \cdot x\\
\mathbf{else}:\\
\;\;\;\;\sqrt{z} \cdot \left(\left(\left(t \cdot t\right) \cdot 0.5\right) \cdot \left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{2}\right)\right)\\
\end{array}
\end{array}
if t < 7.8000000000000001e43Initial program 99.4%
lift-*.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-sqrt.f64N/A
*-commutativeN/A
sqrt-prodN/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
lift-exp.f64N/A
lift-*.f64N/A
lift-/.f64N/A
pow2N/A
exp-sqrtN/A
pow1/2N/A
exp-prodN/A
*-commutativeN/A
Applied rewrites99.5%
Taylor expanded in t around 0
lift-sqrt.f6468.9
Applied rewrites68.9%
if 7.8000000000000001e43 < t < 3.90000000000000006e115Initial program 99.1%
Taylor expanded in x around inf
*-commutativeN/A
*-commutativeN/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
Applied rewrites75.7%
Taylor expanded in t around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f64N/A
pow2N/A
lift-*.f6456.5
Applied rewrites56.5%
if 3.90000000000000006e115 < t Initial program 99.1%
Taylor expanded in t around 0
associate-*r*N/A
*-commutativeN/A
distribute-rgt-outN/A
lower-*.f64N/A
lower-sqrt.f64N/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites95.5%
Taylor expanded in t around inf
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
pow2N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-sqrt.f6495.5
Applied rewrites95.5%
(FPCore (x y z t) :precision binary64 (* (* (* (sqrt z) (fma (fma 0.125 (* t t) 0.5) (* t t) 1.0)) (fma 0.5 x (- y))) (sqrt 2.0)))
double code(double x, double y, double z, double t) {
return ((sqrt(z) * fma(fma(0.125, (t * t), 0.5), (t * t), 1.0)) * fma(0.5, x, -y)) * sqrt(2.0);
}
function code(x, y, z, t) return Float64(Float64(Float64(sqrt(z) * fma(fma(0.125, Float64(t * t), 0.5), Float64(t * t), 1.0)) * fma(0.5, x, Float64(-y))) * sqrt(2.0)) end
code[x_, y_, z_, t_] := N[(N[(N[(N[Sqrt[z], $MachinePrecision] * N[(N[(0.125 * N[(t * t), $MachinePrecision] + 0.5), $MachinePrecision] * N[(t * t), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] * N[(0.5 * x + (-y)), $MachinePrecision]), $MachinePrecision] * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\sqrt{z} \cdot \mathsf{fma}\left(\mathsf{fma}\left(0.125, t \cdot t, 0.5\right), t \cdot t, 1\right)\right) \cdot \mathsf{fma}\left(0.5, x, -y\right)\right) \cdot \sqrt{2}
\end{array}
Initial program 99.4%
lift-*.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-sqrt.f64N/A
*-commutativeN/A
sqrt-prodN/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
lift-exp.f64N/A
lift-*.f64N/A
lift-/.f64N/A
pow2N/A
exp-sqrtN/A
pow1/2N/A
exp-prodN/A
*-commutativeN/A
Applied rewrites99.6%
Taylor expanded in t around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f64N/A
pow2N/A
lift-*.f6492.7
Applied rewrites92.7%
(FPCore (x y z t) :precision binary64 (* (* (sqrt z) (* (fma (fma 0.125 (* t t) 0.5) (* t t) 1.0) (fma x 0.5 (- y)))) (sqrt 2.0)))
double code(double x, double y, double z, double t) {
return (sqrt(z) * (fma(fma(0.125, (t * t), 0.5), (t * t), 1.0) * fma(x, 0.5, -y))) * sqrt(2.0);
}
function code(x, y, z, t) return Float64(Float64(sqrt(z) * Float64(fma(fma(0.125, Float64(t * t), 0.5), Float64(t * t), 1.0) * fma(x, 0.5, Float64(-y)))) * sqrt(2.0)) end
code[x_, y_, z_, t_] := N[(N[(N[Sqrt[z], $MachinePrecision] * N[(N[(N[(0.125 * N[(t * t), $MachinePrecision] + 0.5), $MachinePrecision] * N[(t * t), $MachinePrecision] + 1.0), $MachinePrecision] * N[(x * 0.5 + (-y)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\sqrt{z} \cdot \left(\mathsf{fma}\left(\mathsf{fma}\left(0.125, t \cdot t, 0.5\right), t \cdot t, 1\right) \cdot \mathsf{fma}\left(x, 0.5, -y\right)\right)\right) \cdot \sqrt{2}
\end{array}
Initial program 99.4%
lift-*.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-sqrt.f64N/A
*-commutativeN/A
sqrt-prodN/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
lift-exp.f64N/A
lift-*.f64N/A
lift-/.f64N/A
pow2N/A
exp-sqrtN/A
pow1/2N/A
exp-prodN/A
*-commutativeN/A
Applied rewrites99.6%
Taylor expanded in t around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f6486.1
Applied rewrites86.1%
lift-*.f64N/A
lift-*.f64N/A
lift-sqrt.f64N/A
lift-fma.f64N/A
lift-neg.f64N/A
associate-*l*N/A
lower-*.f64N/A
lift-sqrt.f64N/A
lower-*.f64N/A
*-commutativeN/A
lift-neg.f64N/A
lower-fma.f6487.6
Applied rewrites87.6%
Taylor expanded in t around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f64N/A
pow2N/A
lift-*.f6493.5
Applied rewrites93.5%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (fma (* t t) 0.5 1.0)))
(if (<= t 7.8e+43)
(* (* (sqrt z) (fma 0.5 x (- y))) (sqrt 2.0))
(if (<= t 2e+134)
(* (* (sqrt (* (* 2.0 z) (fma t_1 (* t t) 1.0))) 0.5) x)
(* (* (- (* x 0.5) y) (sqrt (* z 2.0))) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = fma((t * t), 0.5, 1.0);
double tmp;
if (t <= 7.8e+43) {
tmp = (sqrt(z) * fma(0.5, x, -y)) * sqrt(2.0);
} else if (t <= 2e+134) {
tmp = (sqrt(((2.0 * z) * fma(t_1, (t * t), 1.0))) * 0.5) * x;
} else {
tmp = (((x * 0.5) - y) * sqrt((z * 2.0))) * t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = fma(Float64(t * t), 0.5, 1.0) tmp = 0.0 if (t <= 7.8e+43) tmp = Float64(Float64(sqrt(z) * fma(0.5, x, Float64(-y))) * sqrt(2.0)); elseif (t <= 2e+134) tmp = Float64(Float64(sqrt(Float64(Float64(2.0 * z) * fma(t_1, Float64(t * t), 1.0))) * 0.5) * x); else tmp = Float64(Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(z * 2.0))) * t_1); end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(t * t), $MachinePrecision] * 0.5 + 1.0), $MachinePrecision]}, If[LessEqual[t, 7.8e+43], N[(N[(N[Sqrt[z], $MachinePrecision] * N[(0.5 * x + (-y)), $MachinePrecision]), $MachinePrecision] * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 2e+134], N[(N[(N[Sqrt[N[(N[(2.0 * z), $MachinePrecision] * N[(t$95$1 * N[(t * t), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * 0.5), $MachinePrecision] * x), $MachinePrecision], N[(N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(t \cdot t, 0.5, 1\right)\\
\mathbf{if}\;t \leq 7.8 \cdot 10^{+43}:\\
\;\;\;\;\left(\sqrt{z} \cdot \mathsf{fma}\left(0.5, x, -y\right)\right) \cdot \sqrt{2}\\
\mathbf{elif}\;t \leq 2 \cdot 10^{+134}:\\
\;\;\;\;\left(\sqrt{\left(2 \cdot z\right) \cdot \mathsf{fma}\left(t\_1, t \cdot t, 1\right)} \cdot 0.5\right) \cdot x\\
\mathbf{else}:\\
\;\;\;\;\left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot t\_1\\
\end{array}
\end{array}
if t < 7.8000000000000001e43Initial program 99.4%
lift-*.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-sqrt.f64N/A
*-commutativeN/A
sqrt-prodN/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
lift-exp.f64N/A
lift-*.f64N/A
lift-/.f64N/A
pow2N/A
exp-sqrtN/A
pow1/2N/A
exp-prodN/A
*-commutativeN/A
Applied rewrites99.5%
Taylor expanded in t around 0
lift-sqrt.f6468.9
Applied rewrites68.9%
if 7.8000000000000001e43 < t < 1.99999999999999984e134Initial program 99.3%
Taylor expanded in x around inf
*-commutativeN/A
*-commutativeN/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
Applied rewrites75.1%
Taylor expanded in t around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f64N/A
pow2N/A
lift-*.f6460.2
Applied rewrites60.2%
if 1.99999999999999984e134 < t Initial program 99.0%
Taylor expanded in t around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f6495.7
Applied rewrites95.7%
(FPCore (x y z t) :precision binary64 (* (* (- (* x 0.5) y) (sqrt (* z 2.0))) (fma (fma 0.125 (* t t) 0.5) (* t t) 1.0)))
double code(double x, double y, double z, double t) {
return (((x * 0.5) - y) * sqrt((z * 2.0))) * fma(fma(0.125, (t * t), 0.5), (t * t), 1.0);
}
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(z * 2.0))) * fma(fma(0.125, Float64(t * t), 0.5), Float64(t * t), 1.0)) end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[(0.125 * N[(t * t), $MachinePrecision] + 0.5), $MachinePrecision] * N[(t * t), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot \mathsf{fma}\left(\mathsf{fma}\left(0.125, t \cdot t, 0.5\right), t \cdot t, 1\right)
\end{array}
Initial program 99.4%
Taylor expanded in t around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f64N/A
pow2N/A
lift-*.f6492.3
Applied rewrites92.3%
(FPCore (x y z t) :precision binary64 (* (* (sqrt z) (* (fma (* t t) 0.5 1.0) (fma x 0.5 (- y)))) (sqrt 2.0)))
double code(double x, double y, double z, double t) {
return (sqrt(z) * (fma((t * t), 0.5, 1.0) * fma(x, 0.5, -y))) * sqrt(2.0);
}
function code(x, y, z, t) return Float64(Float64(sqrt(z) * Float64(fma(Float64(t * t), 0.5, 1.0) * fma(x, 0.5, Float64(-y)))) * sqrt(2.0)) end
code[x_, y_, z_, t_] := N[(N[(N[Sqrt[z], $MachinePrecision] * N[(N[(N[(t * t), $MachinePrecision] * 0.5 + 1.0), $MachinePrecision] * N[(x * 0.5 + (-y)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\sqrt{z} \cdot \left(\mathsf{fma}\left(t \cdot t, 0.5, 1\right) \cdot \mathsf{fma}\left(x, 0.5, -y\right)\right)\right) \cdot \sqrt{2}
\end{array}
Initial program 99.4%
lift-*.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-sqrt.f64N/A
*-commutativeN/A
sqrt-prodN/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
lift-exp.f64N/A
lift-*.f64N/A
lift-/.f64N/A
pow2N/A
exp-sqrtN/A
pow1/2N/A
exp-prodN/A
*-commutativeN/A
Applied rewrites99.6%
Taylor expanded in t around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f6486.1
Applied rewrites86.1%
lift-*.f64N/A
lift-*.f64N/A
lift-sqrt.f64N/A
lift-fma.f64N/A
lift-neg.f64N/A
associate-*l*N/A
lower-*.f64N/A
lift-sqrt.f64N/A
lower-*.f64N/A
*-commutativeN/A
lift-neg.f64N/A
lower-fma.f6487.6
Applied rewrites87.6%
(FPCore (x y z t) :precision binary64 (* (sqrt z) (* (* (fma 0.5 x (- y)) (fma (* t t) 0.5 1.0)) (sqrt 2.0))))
double code(double x, double y, double z, double t) {
return sqrt(z) * ((fma(0.5, x, -y) * fma((t * t), 0.5, 1.0)) * sqrt(2.0));
}
function code(x, y, z, t) return Float64(sqrt(z) * Float64(Float64(fma(0.5, x, Float64(-y)) * fma(Float64(t * t), 0.5, 1.0)) * sqrt(2.0))) end
code[x_, y_, z_, t_] := N[(N[Sqrt[z], $MachinePrecision] * N[(N[(N[(0.5 * x + (-y)), $MachinePrecision] * N[(N[(t * t), $MachinePrecision] * 0.5 + 1.0), $MachinePrecision]), $MachinePrecision] * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sqrt{z} \cdot \left(\left(\mathsf{fma}\left(0.5, x, -y\right) \cdot \mathsf{fma}\left(t \cdot t, 0.5, 1\right)\right) \cdot \sqrt{2}\right)
\end{array}
Initial program 99.4%
lift-*.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-sqrt.f64N/A
*-commutativeN/A
sqrt-prodN/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
lift-exp.f64N/A
lift-*.f64N/A
lift-/.f64N/A
pow2N/A
exp-sqrtN/A
pow1/2N/A
exp-prodN/A
*-commutativeN/A
Applied rewrites99.6%
Taylor expanded in t around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f6486.1
Applied rewrites86.1%
lift-*.f64N/A
lift-*.f64N/A
lift-sqrt.f64N/A
lift-fma.f64N/A
lift-neg.f64N/A
associate-*l*N/A
lower-*.f64N/A
lift-sqrt.f64N/A
lower-*.f64N/A
*-commutativeN/A
lift-neg.f64N/A
lower-fma.f6487.6
Applied rewrites87.6%
lift-*.f64N/A
lift-*.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
associate-*l*N/A
lower-*.f64N/A
lift-sqrt.f64N/A
lower-*.f64N/A
Applied rewrites87.6%
(FPCore (x y z t) :precision binary64 (if (<= t 6.2e-7) (* (* (sqrt z) (fma 0.5 x (- y))) (sqrt 2.0)) (* (* (* t t) (* (sqrt (* 2.0 z)) (- (* x 0.5) y))) 0.5)))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= 6.2e-7) {
tmp = (sqrt(z) * fma(0.5, x, -y)) * sqrt(2.0);
} else {
tmp = ((t * t) * (sqrt((2.0 * z)) * ((x * 0.5) - y))) * 0.5;
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (t <= 6.2e-7) tmp = Float64(Float64(sqrt(z) * fma(0.5, x, Float64(-y))) * sqrt(2.0)); else tmp = Float64(Float64(Float64(t * t) * Float64(sqrt(Float64(2.0 * z)) * Float64(Float64(x * 0.5) - y))) * 0.5); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[t, 6.2e-7], N[(N[(N[Sqrt[z], $MachinePrecision] * N[(0.5 * x + (-y)), $MachinePrecision]), $MachinePrecision] * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision], N[(N[(N[(t * t), $MachinePrecision] * N[(N[Sqrt[N[(2.0 * z), $MachinePrecision]], $MachinePrecision] * N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 6.2 \cdot 10^{-7}:\\
\;\;\;\;\left(\sqrt{z} \cdot \mathsf{fma}\left(0.5, x, -y\right)\right) \cdot \sqrt{2}\\
\mathbf{else}:\\
\;\;\;\;\left(\left(t \cdot t\right) \cdot \left(\sqrt{2 \cdot z} \cdot \left(x \cdot 0.5 - y\right)\right)\right) \cdot 0.5\\
\end{array}
\end{array}
if t < 6.1999999999999999e-7Initial program 99.4%
lift-*.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-sqrt.f64N/A
*-commutativeN/A
sqrt-prodN/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
lift-exp.f64N/A
lift-*.f64N/A
lift-/.f64N/A
pow2N/A
exp-sqrtN/A
pow1/2N/A
exp-prodN/A
*-commutativeN/A
Applied rewrites99.5%
Taylor expanded in t around 0
lift-sqrt.f6471.6
Applied rewrites71.6%
if 6.1999999999999999e-7 < t Initial program 99.2%
Taylor expanded in t around 0
associate-*r*N/A
*-commutativeN/A
distribute-rgt-outN/A
lower-*.f64N/A
lower-sqrt.f64N/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites77.4%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites72.1%
(FPCore (x y z t) :precision binary64 (if (<= t 8e+43) (* (* (sqrt z) (fma 0.5 x (- y))) (sqrt 2.0)) (* (* (sqrt (* (* 2.0 z) (fma t t 1.0))) 0.5) x)))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= 8e+43) {
tmp = (sqrt(z) * fma(0.5, x, -y)) * sqrt(2.0);
} else {
tmp = (sqrt(((2.0 * z) * fma(t, t, 1.0))) * 0.5) * x;
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (t <= 8e+43) tmp = Float64(Float64(sqrt(z) * fma(0.5, x, Float64(-y))) * sqrt(2.0)); else tmp = Float64(Float64(sqrt(Float64(Float64(2.0 * z) * fma(t, t, 1.0))) * 0.5) * x); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[t, 8e+43], N[(N[(N[Sqrt[z], $MachinePrecision] * N[(0.5 * x + (-y)), $MachinePrecision]), $MachinePrecision] * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[N[(N[(2.0 * z), $MachinePrecision] * N[(t * t + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * 0.5), $MachinePrecision] * x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 8 \cdot 10^{+43}:\\
\;\;\;\;\left(\sqrt{z} \cdot \mathsf{fma}\left(0.5, x, -y\right)\right) \cdot \sqrt{2}\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{\left(2 \cdot z\right) \cdot \mathsf{fma}\left(t, t, 1\right)} \cdot 0.5\right) \cdot x\\
\end{array}
\end{array}
if t < 8.00000000000000011e43Initial program 99.4%
lift-*.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-sqrt.f64N/A
*-commutativeN/A
sqrt-prodN/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
lift-exp.f64N/A
lift-*.f64N/A
lift-/.f64N/A
pow2N/A
exp-sqrtN/A
pow1/2N/A
exp-prodN/A
*-commutativeN/A
Applied rewrites99.5%
Taylor expanded in t around 0
lift-sqrt.f6468.9
Applied rewrites68.9%
if 8.00000000000000011e43 < t Initial program 99.1%
Taylor expanded in x around inf
*-commutativeN/A
*-commutativeN/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
Applied rewrites73.7%
Taylor expanded in t around 0
+-commutativeN/A
pow2N/A
lower-fma.f6457.0
Applied rewrites57.0%
(FPCore (x y z t) :precision binary64 (if (<= t 8e+43) (* (* (sqrt z) (sqrt 2.0)) (fma 0.5 x (- y))) (* (* (sqrt (* (* 2.0 z) (fma t t 1.0))) 0.5) x)))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= 8e+43) {
tmp = (sqrt(z) * sqrt(2.0)) * fma(0.5, x, -y);
} else {
tmp = (sqrt(((2.0 * z) * fma(t, t, 1.0))) * 0.5) * x;
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (t <= 8e+43) tmp = Float64(Float64(sqrt(z) * sqrt(2.0)) * fma(0.5, x, Float64(-y))); else tmp = Float64(Float64(sqrt(Float64(Float64(2.0 * z) * fma(t, t, 1.0))) * 0.5) * x); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[t, 8e+43], N[(N[(N[Sqrt[z], $MachinePrecision] * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision] * N[(0.5 * x + (-y)), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[N[(N[(2.0 * z), $MachinePrecision] * N[(t * t + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * 0.5), $MachinePrecision] * x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 8 \cdot 10^{+43}:\\
\;\;\;\;\left(\sqrt{z} \cdot \sqrt{2}\right) \cdot \mathsf{fma}\left(0.5, x, -y\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{\left(2 \cdot z\right) \cdot \mathsf{fma}\left(t, t, 1\right)} \cdot 0.5\right) \cdot x\\
\end{array}
\end{array}
if t < 8.00000000000000011e43Initial program 99.4%
Taylor expanded in t around 0
associate-*r*N/A
sqrt-prodN/A
*-commutativeN/A
lower-*.f64N/A
lift-sqrt.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f6469.1
Applied rewrites69.1%
lift-*.f64N/A
lift-sqrt.f64N/A
sqrt-prodN/A
*-commutativeN/A
lower-*.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f6468.9
Applied rewrites68.9%
if 8.00000000000000011e43 < t Initial program 99.1%
Taylor expanded in x around inf
*-commutativeN/A
*-commutativeN/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
Applied rewrites73.7%
Taylor expanded in t around 0
+-commutativeN/A
pow2N/A
lower-fma.f6457.0
Applied rewrites57.0%
(FPCore (x y z t) :precision binary64 (if (<= t 8e+43) (* (sqrt z) (* (- (* x 0.5) y) (sqrt 2.0))) (* (* (sqrt (* (* 2.0 z) (fma t t 1.0))) 0.5) x)))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= 8e+43) {
tmp = sqrt(z) * (((x * 0.5) - y) * sqrt(2.0));
} else {
tmp = (sqrt(((2.0 * z) * fma(t, t, 1.0))) * 0.5) * x;
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (t <= 8e+43) tmp = Float64(sqrt(z) * Float64(Float64(Float64(x * 0.5) - y) * sqrt(2.0))); else tmp = Float64(Float64(sqrt(Float64(Float64(2.0 * z) * fma(t, t, 1.0))) * 0.5) * x); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[t, 8e+43], N[(N[Sqrt[z], $MachinePrecision] * N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[N[(N[(2.0 * z), $MachinePrecision] * N[(t * t + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * 0.5), $MachinePrecision] * x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 8 \cdot 10^{+43}:\\
\;\;\;\;\sqrt{z} \cdot \left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{2}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{\left(2 \cdot z\right) \cdot \mathsf{fma}\left(t, t, 1\right)} \cdot 0.5\right) \cdot x\\
\end{array}
\end{array}
if t < 8.00000000000000011e43Initial program 99.4%
Taylor expanded in t around 0
associate-*r*N/A
*-commutativeN/A
distribute-rgt-outN/A
lower-*.f64N/A
lower-sqrt.f64N/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites88.1%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-sqrt.f6468.9
Applied rewrites68.9%
if 8.00000000000000011e43 < t Initial program 99.1%
Taylor expanded in x around inf
*-commutativeN/A
*-commutativeN/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
Applied rewrites73.7%
Taylor expanded in t around 0
+-commutativeN/A
pow2N/A
lower-fma.f6457.0
Applied rewrites57.0%
(FPCore (x y z t) :precision binary64 (* (* (- (* x 0.5) y) (sqrt (* z 2.0))) (fma (* t t) 0.5 1.0)))
double code(double x, double y, double z, double t) {
return (((x * 0.5) - y) * sqrt((z * 2.0))) * fma((t * t), 0.5, 1.0);
}
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(z * 2.0))) * fma(Float64(t * t), 0.5, 1.0)) end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[(t * t), $MachinePrecision] * 0.5 + 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot \mathsf{fma}\left(t \cdot t, 0.5, 1\right)
\end{array}
Initial program 99.4%
Taylor expanded in t around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f6485.5
Applied rewrites85.5%
(FPCore (x y z t) :precision binary64 (if (<= t 8e+43) (* (sqrt (+ z z)) (fma 0.5 x (- y))) (* (* (sqrt (* (* 2.0 z) (fma t t 1.0))) 0.5) x)))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= 8e+43) {
tmp = sqrt((z + z)) * fma(0.5, x, -y);
} else {
tmp = (sqrt(((2.0 * z) * fma(t, t, 1.0))) * 0.5) * x;
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (t <= 8e+43) tmp = Float64(sqrt(Float64(z + z)) * fma(0.5, x, Float64(-y))); else tmp = Float64(Float64(sqrt(Float64(Float64(2.0 * z) * fma(t, t, 1.0))) * 0.5) * x); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[t, 8e+43], N[(N[Sqrt[N[(z + z), $MachinePrecision]], $MachinePrecision] * N[(0.5 * x + (-y)), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[N[(N[(2.0 * z), $MachinePrecision] * N[(t * t + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * 0.5), $MachinePrecision] * x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 8 \cdot 10^{+43}:\\
\;\;\;\;\sqrt{z + z} \cdot \mathsf{fma}\left(0.5, x, -y\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{\left(2 \cdot z\right) \cdot \mathsf{fma}\left(t, t, 1\right)} \cdot 0.5\right) \cdot x\\
\end{array}
\end{array}
if t < 8.00000000000000011e43Initial program 99.4%
Taylor expanded in t around 0
associate-*r*N/A
sqrt-prodN/A
*-commutativeN/A
lower-*.f64N/A
lift-sqrt.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f6469.1
Applied rewrites69.1%
lift-*.f64N/A
count-2-revN/A
lower-+.f6469.1
Applied rewrites69.1%
if 8.00000000000000011e43 < t Initial program 99.1%
Taylor expanded in x around inf
*-commutativeN/A
*-commutativeN/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
Applied rewrites73.7%
Taylor expanded in t around 0
+-commutativeN/A
pow2N/A
lower-fma.f6457.0
Applied rewrites57.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (sqrt (+ z z)) (- y))))
(if (<= y -9.8e-48)
t_1
(if (<= y 1.18e-94) (* (* (sqrt (* 2.0 z)) 0.5) x) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = sqrt((z + z)) * -y;
double tmp;
if (y <= -9.8e-48) {
tmp = t_1;
} else if (y <= 1.18e-94) {
tmp = (sqrt((2.0 * z)) * 0.5) * x;
} 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, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt((z + z)) * -y
if (y <= (-9.8d-48)) then
tmp = t_1
else if (y <= 1.18d-94) then
tmp = (sqrt((2.0d0 * z)) * 0.5d0) * x
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((z + z)) * -y;
double tmp;
if (y <= -9.8e-48) {
tmp = t_1;
} else if (y <= 1.18e-94) {
tmp = (Math.sqrt((2.0 * z)) * 0.5) * x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = math.sqrt((z + z)) * -y tmp = 0 if y <= -9.8e-48: tmp = t_1 elif y <= 1.18e-94: tmp = (math.sqrt((2.0 * z)) * 0.5) * x else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(sqrt(Float64(z + z)) * Float64(-y)) tmp = 0.0 if (y <= -9.8e-48) tmp = t_1; elseif (y <= 1.18e-94) tmp = Float64(Float64(sqrt(Float64(2.0 * z)) * 0.5) * x); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = sqrt((z + z)) * -y; tmp = 0.0; if (y <= -9.8e-48) tmp = t_1; elseif (y <= 1.18e-94) tmp = (sqrt((2.0 * z)) * 0.5) * x; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Sqrt[N[(z + z), $MachinePrecision]], $MachinePrecision] * (-y)), $MachinePrecision]}, If[LessEqual[y, -9.8e-48], t$95$1, If[LessEqual[y, 1.18e-94], N[(N[(N[Sqrt[N[(2.0 * z), $MachinePrecision]], $MachinePrecision] * 0.5), $MachinePrecision] * x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \sqrt{z + z} \cdot \left(-y\right)\\
\mathbf{if}\;y \leq -9.8 \cdot 10^{-48}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 1.18 \cdot 10^{-94}:\\
\;\;\;\;\left(\sqrt{2 \cdot z} \cdot 0.5\right) \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -9.8000000000000005e-48 or 1.18e-94 < y Initial program 99.8%
Taylor expanded in t around 0
associate-*r*N/A
sqrt-prodN/A
*-commutativeN/A
lower-*.f64N/A
lift-sqrt.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f6459.6
Applied rewrites59.6%
Taylor expanded in x around 0
mul-1-negN/A
lift-neg.f6442.3
Applied rewrites42.3%
lift-*.f64N/A
count-2-revN/A
lower-+.f6442.3
Applied rewrites42.3%
if -9.8000000000000005e-48 < y < 1.18e-94Initial program 98.6%
Taylor expanded in x around inf
*-commutativeN/A
*-commutativeN/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
Applied rewrites85.0%
Taylor expanded in t around 0
lift-*.f6444.8
Applied rewrites44.8%
(FPCore (x y z t) :precision binary64 (* (sqrt (+ z z)) (fma 0.5 x (- y))))
double code(double x, double y, double z, double t) {
return sqrt((z + z)) * fma(0.5, x, -y);
}
function code(x, y, z, t) return Float64(sqrt(Float64(z + z)) * fma(0.5, x, Float64(-y))) end
code[x_, y_, z_, t_] := N[(N[Sqrt[N[(z + z), $MachinePrecision]], $MachinePrecision] * N[(0.5 * x + (-y)), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sqrt{z + z} \cdot \mathsf{fma}\left(0.5, x, -y\right)
\end{array}
Initial program 99.4%
Taylor expanded in t around 0
associate-*r*N/A
sqrt-prodN/A
*-commutativeN/A
lower-*.f64N/A
lift-sqrt.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f6457.5
Applied rewrites57.5%
lift-*.f64N/A
count-2-revN/A
lower-+.f6457.5
Applied rewrites57.5%
(FPCore (x y z t) :precision binary64 (* (sqrt (+ z z)) (- y)))
double code(double x, double y, double z, double t) {
return sqrt((z + z)) * -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, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = sqrt((z + z)) * -y
end function
public static double code(double x, double y, double z, double t) {
return Math.sqrt((z + z)) * -y;
}
def code(x, y, z, t): return math.sqrt((z + z)) * -y
function code(x, y, z, t) return Float64(sqrt(Float64(z + z)) * Float64(-y)) end
function tmp = code(x, y, z, t) tmp = sqrt((z + z)) * -y; end
code[x_, y_, z_, t_] := N[(N[Sqrt[N[(z + z), $MachinePrecision]], $MachinePrecision] * (-y)), $MachinePrecision]
\begin{array}{l}
\\
\sqrt{z + z} \cdot \left(-y\right)
\end{array}
Initial program 99.4%
Taylor expanded in t around 0
associate-*r*N/A
sqrt-prodN/A
*-commutativeN/A
lower-*.f64N/A
lift-sqrt.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f6457.5
Applied rewrites57.5%
Taylor expanded in x around 0
mul-1-negN/A
lift-neg.f6430.7
Applied rewrites30.7%
lift-*.f64N/A
count-2-revN/A
lower-+.f6430.7
Applied rewrites30.7%
(FPCore (x y z t) :precision binary64 (* (* (- (* x 0.5) y) (sqrt (* z 2.0))) (pow (exp 1.0) (/ (* t t) 2.0))))
double code(double x, double y, double z, double t) {
return (((x * 0.5) - y) * sqrt((z * 2.0))) * pow(exp(1.0), ((t * t) / 2.0));
}
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, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((x * 0.5d0) - y) * sqrt((z * 2.0d0))) * (exp(1.0d0) ** ((t * t) / 2.0d0))
end function
public static double code(double x, double y, double z, double t) {
return (((x * 0.5) - y) * Math.sqrt((z * 2.0))) * Math.pow(Math.exp(1.0), ((t * t) / 2.0));
}
def code(x, y, z, t): return (((x * 0.5) - y) * math.sqrt((z * 2.0))) * math.pow(math.exp(1.0), ((t * t) / 2.0))
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(z * 2.0))) * (exp(1.0) ^ Float64(Float64(t * t) / 2.0))) end
function tmp = code(x, y, z, t) tmp = (((x * 0.5) - y) * sqrt((z * 2.0))) * (exp(1.0) ^ ((t * t) / 2.0)); end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Power[N[Exp[1.0], $MachinePrecision], N[(N[(t * t), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot {\left(e^{1}\right)}^{\left(\frac{t \cdot t}{2}\right)}
\end{array}
herbie shell --seed 2025095
(FPCore (x y z t)
:name "Data.Number.Erf:$cinvnormcdf from erf-2.0.0.0, A"
:precision binary64
:alt
(! :herbie-platform default (* (* (- (* x 1/2) y) (sqrt (* z 2))) (pow (exp 1) (/ (* t t) 2))))
(* (* (- (* x 0.5) y) (sqrt (* z 2.0))) (exp (/ (* t t) 2.0))))