
(FPCore (x y z t) :precision binary64 (- (+ (* x (log y)) (* z (log (- 1.0 y)))) t))
double code(double x, double y, double z, double t) {
return ((x * log(y)) + (z * log((1.0 - y)))) - t;
}
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 * log(y)) + (z * log((1.0d0 - y)))) - t
end function
public static double code(double x, double y, double z, double t) {
return ((x * Math.log(y)) + (z * Math.log((1.0 - y)))) - t;
}
def code(x, y, z, t): return ((x * math.log(y)) + (z * math.log((1.0 - y)))) - t
function code(x, y, z, t) return Float64(Float64(Float64(x * log(y)) + Float64(z * log(Float64(1.0 - y)))) - t) end
function tmp = code(x, y, z, t) tmp = ((x * log(y)) + (z * log((1.0 - y)))) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] + N[(z * N[Log[N[(1.0 - y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot \log y + z \cdot \log \left(1 - y\right)\right) - t
\end{array}
Herbie found 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (- (+ (* x (log y)) (* z (log (- 1.0 y)))) t))
double code(double x, double y, double z, double t) {
return ((x * log(y)) + (z * log((1.0 - y)))) - t;
}
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 * log(y)) + (z * log((1.0d0 - y)))) - t
end function
public static double code(double x, double y, double z, double t) {
return ((x * Math.log(y)) + (z * Math.log((1.0 - y)))) - t;
}
def code(x, y, z, t): return ((x * math.log(y)) + (z * math.log((1.0 - y)))) - t
function code(x, y, z, t) return Float64(Float64(Float64(x * log(y)) + Float64(z * log(Float64(1.0 - y)))) - t) end
function tmp = code(x, y, z, t) tmp = ((x * log(y)) + (z * log((1.0 - y)))) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] + N[(z * N[Log[N[(1.0 - y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot \log y + z \cdot \log \left(1 - y\right)\right) - t
\end{array}
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (- (* (- (* -0.25 y) 0.3333333333333333) y) 0.5) y)))
(-
(+
(* x (log y))
(*
z
(*
(-
(/ (pow t_1 3.0) 1.0)
(/
1.0
(+
(pow (* (- (* -0.3333333333333333 y) 0.5) y) 2.0)
(+ 1.0 (* t_1 1.0)))))
y)))
t)))
double code(double x, double y, double z, double t) {
double t_1 = ((((-0.25 * y) - 0.3333333333333333) * y) - 0.5) * y;
return ((x * log(y)) + (z * (((pow(t_1, 3.0) / 1.0) - (1.0 / (pow((((-0.3333333333333333 * y) - 0.5) * y), 2.0) + (1.0 + (t_1 * 1.0))))) * y))) - t;
}
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
t_1 = (((((-0.25d0) * y) - 0.3333333333333333d0) * y) - 0.5d0) * y
code = ((x * log(y)) + (z * ((((t_1 ** 3.0d0) / 1.0d0) - (1.0d0 / ((((((-0.3333333333333333d0) * y) - 0.5d0) * y) ** 2.0d0) + (1.0d0 + (t_1 * 1.0d0))))) * y))) - t
end function
public static double code(double x, double y, double z, double t) {
double t_1 = ((((-0.25 * y) - 0.3333333333333333) * y) - 0.5) * y;
return ((x * Math.log(y)) + (z * (((Math.pow(t_1, 3.0) / 1.0) - (1.0 / (Math.pow((((-0.3333333333333333 * y) - 0.5) * y), 2.0) + (1.0 + (t_1 * 1.0))))) * y))) - t;
}
def code(x, y, z, t): t_1 = ((((-0.25 * y) - 0.3333333333333333) * y) - 0.5) * y return ((x * math.log(y)) + (z * (((math.pow(t_1, 3.0) / 1.0) - (1.0 / (math.pow((((-0.3333333333333333 * y) - 0.5) * y), 2.0) + (1.0 + (t_1 * 1.0))))) * y))) - t
function code(x, y, z, t) t_1 = Float64(Float64(Float64(Float64(Float64(-0.25 * y) - 0.3333333333333333) * y) - 0.5) * y) return Float64(Float64(Float64(x * log(y)) + Float64(z * Float64(Float64(Float64((t_1 ^ 3.0) / 1.0) - Float64(1.0 / Float64((Float64(Float64(Float64(-0.3333333333333333 * y) - 0.5) * y) ^ 2.0) + Float64(1.0 + Float64(t_1 * 1.0))))) * y))) - t) end
function tmp = code(x, y, z, t) t_1 = ((((-0.25 * y) - 0.3333333333333333) * y) - 0.5) * y; tmp = ((x * log(y)) + (z * ((((t_1 ^ 3.0) / 1.0) - (1.0 / (((((-0.3333333333333333 * y) - 0.5) * y) ^ 2.0) + (1.0 + (t_1 * 1.0))))) * y))) - t; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(N[(N[(N[(-0.25 * y), $MachinePrecision] - 0.3333333333333333), $MachinePrecision] * y), $MachinePrecision] - 0.5), $MachinePrecision] * y), $MachinePrecision]}, N[(N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] + N[(z * N[(N[(N[(N[Power[t$95$1, 3.0], $MachinePrecision] / 1.0), $MachinePrecision] - N[(1.0 / N[(N[Power[N[(N[(N[(-0.3333333333333333 * y), $MachinePrecision] - 0.5), $MachinePrecision] * y), $MachinePrecision], 2.0], $MachinePrecision] + N[(1.0 + N[(t$95$1 * 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(\left(-0.25 \cdot y - 0.3333333333333333\right) \cdot y - 0.5\right) \cdot y\\
\left(x \cdot \log y + z \cdot \left(\left(\frac{{t\_1}^{3}}{1} - \frac{1}{{\left(\left(-0.3333333333333333 \cdot y - 0.5\right) \cdot y\right)}^{2} + \left(1 + t\_1 \cdot 1\right)}\right) \cdot y\right)\right) - t
\end{array}
\end{array}
Initial program 85.0%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f6499.6
Applied rewrites99.6%
lift--.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift--.f64N/A
flip3--N/A
metadata-evalN/A
Applied rewrites99.6%
Taylor expanded in y around 0
Applied rewrites99.7%
Taylor expanded in y around 0
Applied rewrites99.7%
(FPCore (x y z t)
:precision binary64
(-
(+
(* x (log y))
(*
z
(*
(-
(* (- (* -0.3125 y) 0.125) (* (* y y) y))
(/
1.0
(+
(pow (* (- (* -0.3333333333333333 y) 0.5) y) 2.0)
(+
1.0
(* (* (- (* (- (* -0.25 y) 0.3333333333333333) y) 0.5) y) 1.0)))))
y)))
t))
double code(double x, double y, double z, double t) {
return ((x * log(y)) + (z * (((((-0.3125 * y) - 0.125) * ((y * y) * y)) - (1.0 / (pow((((-0.3333333333333333 * y) - 0.5) * y), 2.0) + (1.0 + ((((((-0.25 * y) - 0.3333333333333333) * y) - 0.5) * y) * 1.0))))) * y))) - t;
}
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 * log(y)) + (z * ((((((-0.3125d0) * y) - 0.125d0) * ((y * y) * y)) - (1.0d0 / ((((((-0.3333333333333333d0) * y) - 0.5d0) * y) ** 2.0d0) + (1.0d0 + (((((((-0.25d0) * y) - 0.3333333333333333d0) * y) - 0.5d0) * y) * 1.0d0))))) * y))) - t
end function
public static double code(double x, double y, double z, double t) {
return ((x * Math.log(y)) + (z * (((((-0.3125 * y) - 0.125) * ((y * y) * y)) - (1.0 / (Math.pow((((-0.3333333333333333 * y) - 0.5) * y), 2.0) + (1.0 + ((((((-0.25 * y) - 0.3333333333333333) * y) - 0.5) * y) * 1.0))))) * y))) - t;
}
def code(x, y, z, t): return ((x * math.log(y)) + (z * (((((-0.3125 * y) - 0.125) * ((y * y) * y)) - (1.0 / (math.pow((((-0.3333333333333333 * y) - 0.5) * y), 2.0) + (1.0 + ((((((-0.25 * y) - 0.3333333333333333) * y) - 0.5) * y) * 1.0))))) * y))) - t
function code(x, y, z, t) return Float64(Float64(Float64(x * log(y)) + Float64(z * Float64(Float64(Float64(Float64(Float64(-0.3125 * y) - 0.125) * Float64(Float64(y * y) * y)) - Float64(1.0 / Float64((Float64(Float64(Float64(-0.3333333333333333 * y) - 0.5) * y) ^ 2.0) + Float64(1.0 + Float64(Float64(Float64(Float64(Float64(Float64(-0.25 * y) - 0.3333333333333333) * y) - 0.5) * y) * 1.0))))) * y))) - t) end
function tmp = code(x, y, z, t) tmp = ((x * log(y)) + (z * (((((-0.3125 * y) - 0.125) * ((y * y) * y)) - (1.0 / (((((-0.3333333333333333 * y) - 0.5) * y) ^ 2.0) + (1.0 + ((((((-0.25 * y) - 0.3333333333333333) * y) - 0.5) * y) * 1.0))))) * y))) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] + N[(z * N[(N[(N[(N[(N[(-0.3125 * y), $MachinePrecision] - 0.125), $MachinePrecision] * N[(N[(y * y), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision] - N[(1.0 / N[(N[Power[N[(N[(N[(-0.3333333333333333 * y), $MachinePrecision] - 0.5), $MachinePrecision] * y), $MachinePrecision], 2.0], $MachinePrecision] + N[(1.0 + N[(N[(N[(N[(N[(N[(-0.25 * y), $MachinePrecision] - 0.3333333333333333), $MachinePrecision] * y), $MachinePrecision] - 0.5), $MachinePrecision] * y), $MachinePrecision] * 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot \log y + z \cdot \left(\left(\left(-0.3125 \cdot y - 0.125\right) \cdot \left(\left(y \cdot y\right) \cdot y\right) - \frac{1}{{\left(\left(-0.3333333333333333 \cdot y - 0.5\right) \cdot y\right)}^{2} + \left(1 + \left(\left(\left(-0.25 \cdot y - 0.3333333333333333\right) \cdot y - 0.5\right) \cdot y\right) \cdot 1\right)}\right) \cdot y\right)\right) - t
\end{array}
Initial program 85.0%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f6499.6
Applied rewrites99.6%
lift--.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift--.f64N/A
flip3--N/A
metadata-evalN/A
Applied rewrites99.6%
Taylor expanded in y around 0
Applied rewrites99.7%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
unpow3N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6499.7
Applied rewrites99.7%
(FPCore (x y z t) :precision binary64 (fma (log y) x (- (* (* (- (* (- (* (- (* -0.25 y) 0.3333333333333333) y) 0.5) y) 1.0) y) z) t)))
double code(double x, double y, double z, double t) {
return fma(log(y), x, (((((((((-0.25 * y) - 0.3333333333333333) * y) - 0.5) * y) - 1.0) * y) * z) - t));
}
function code(x, y, z, t) return fma(log(y), x, Float64(Float64(Float64(Float64(Float64(Float64(Float64(Float64(Float64(-0.25 * y) - 0.3333333333333333) * y) - 0.5) * y) - 1.0) * y) * z) - t)) end
code[x_, y_, z_, t_] := N[(N[Log[y], $MachinePrecision] * x + N[(N[(N[(N[(N[(N[(N[(N[(N[(-0.25 * y), $MachinePrecision] - 0.3333333333333333), $MachinePrecision] * y), $MachinePrecision] - 0.5), $MachinePrecision] * y), $MachinePrecision] - 1.0), $MachinePrecision] * y), $MachinePrecision] * z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\log y, x, \left(\left(\left(\left(-0.25 \cdot y - 0.3333333333333333\right) \cdot y - 0.5\right) \cdot y - 1\right) \cdot y\right) \cdot z - t\right)
\end{array}
Initial program 85.0%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f6499.6
Applied rewrites99.6%
lift--.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-log.f64N/A
associate--l+N/A
*-commutativeN/A
lower-fma.f64N/A
lift-log.f64N/A
lower--.f6499.6
Applied rewrites99.6%
(FPCore (x y z t) :precision binary64 (fma (log y) x (- (fma (- z) y (* (* (* z y) -0.5) y)) t)))
double code(double x, double y, double z, double t) {
return fma(log(y), x, (fma(-z, y, (((z * y) * -0.5) * y)) - t));
}
function code(x, y, z, t) return fma(log(y), x, Float64(fma(Float64(-z), y, Float64(Float64(Float64(z * y) * -0.5) * y)) - t)) end
code[x_, y_, z_, t_] := N[(N[Log[y], $MachinePrecision] * x + N[(N[((-z) * y + N[(N[(N[(z * y), $MachinePrecision] * -0.5), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\log y, x, \mathsf{fma}\left(-z, y, \left(\left(z \cdot y\right) \cdot -0.5\right) \cdot y\right) - t\right)
\end{array}
Initial program 85.0%
lift--.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-log.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-log.f64N/A
associate--l+N/A
*-commutativeN/A
lower-fma.f64N/A
lift-log.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-log.f64N/A
lift--.f6485.0
Applied rewrites85.0%
Taylor expanded in y around 0
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6499.5
Applied rewrites99.5%
lift-*.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
lift-neg.f64N/A
mul-1-negN/A
+-commutativeN/A
*-commutativeN/A
*-commutativeN/A
distribute-rgt-inN/A
lower-fma.f64N/A
mul-1-negN/A
lift-neg.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lift-*.f6499.5
Applied rewrites99.5%
(FPCore (x y z t) :precision binary64 (fma (log y) x (- (* (fma -0.5 (* z y) (- z)) y) t)))
double code(double x, double y, double z, double t) {
return fma(log(y), x, ((fma(-0.5, (z * y), -z) * y) - t));
}
function code(x, y, z, t) return fma(log(y), x, Float64(Float64(fma(-0.5, Float64(z * y), Float64(-z)) * y) - t)) end
code[x_, y_, z_, t_] := N[(N[Log[y], $MachinePrecision] * x + N[(N[(N[(-0.5 * N[(z * y), $MachinePrecision] + (-z)), $MachinePrecision] * y), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\log y, x, \mathsf{fma}\left(-0.5, z \cdot y, -z\right) \cdot y - t\right)
\end{array}
Initial program 85.0%
lift--.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-log.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-log.f64N/A
associate--l+N/A
*-commutativeN/A
lower-fma.f64N/A
lift-log.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-log.f64N/A
lift--.f6485.0
Applied rewrites85.0%
Taylor expanded in y around 0
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6499.5
Applied rewrites99.5%
(FPCore (x y z t) :precision binary64 (- (fma (fma -0.5 (* z y) (- z)) y (* (log y) x)) t))
double code(double x, double y, double z, double t) {
return fma(fma(-0.5, (z * y), -z), y, (log(y) * x)) - t;
}
function code(x, y, z, t) return Float64(fma(fma(-0.5, Float64(z * y), Float64(-z)), y, Float64(log(y) * x)) - t) end
code[x_, y_, z_, t_] := N[(N[(N[(-0.5 * N[(z * y), $MachinePrecision] + (-z)), $MachinePrecision] * y + N[(N[Log[y], $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\mathsf{fma}\left(-0.5, z \cdot y, -z\right), y, \log y \cdot x\right) - t
\end{array}
Initial program 85.0%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-log.f6499.5
Applied rewrites99.5%
(FPCore (x y z t) :precision binary64 (fma (log y) x (- (* (- y) z) t)))
double code(double x, double y, double z, double t) {
return fma(log(y), x, ((-y * z) - t));
}
function code(x, y, z, t) return fma(log(y), x, Float64(Float64(Float64(-y) * z) - t)) end
code[x_, y_, z_, t_] := N[(N[Log[y], $MachinePrecision] * x + N[(N[((-y) * z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\log y, x, \left(-y\right) \cdot z - t\right)
\end{array}
Initial program 85.0%
lift--.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-log.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-log.f64N/A
associate--l+N/A
*-commutativeN/A
lower-fma.f64N/A
lift-log.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-log.f64N/A
lift--.f6485.0
Applied rewrites85.0%
Taylor expanded in y around 0
lower--.f64N/A
associate-*r*N/A
mul-1-negN/A
lower-*.f64N/A
lower-neg.f6499.1
Applied rewrites99.1%
(FPCore (x y z t) :precision binary64 (- (fma (- y) z (* (log y) x)) t))
double code(double x, double y, double z, double t) {
return fma(-y, z, (log(y) * x)) - t;
}
function code(x, y, z, t) return Float64(fma(Float64(-y), z, Float64(log(y) * x)) - t) end
code[x_, y_, z_, t_] := N[(N[((-y) * z + N[(N[Log[y], $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(-y, z, \log y \cdot x\right) - t
\end{array}
Initial program 85.0%
Taylor expanded in y around 0
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-log.f6499.1
Applied rewrites99.1%
(FPCore (x y z t) :precision binary64 (if (<= t -3.4e-79) (- (* (log y) x) t) (if (<= t 9e-155) (fma (log y) x (* (- y) z)) (fma (log y) x (- t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -3.4e-79) {
tmp = (log(y) * x) - t;
} else if (t <= 9e-155) {
tmp = fma(log(y), x, (-y * z));
} else {
tmp = fma(log(y), x, -t);
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (t <= -3.4e-79) tmp = Float64(Float64(log(y) * x) - t); elseif (t <= 9e-155) tmp = fma(log(y), x, Float64(Float64(-y) * z)); else tmp = fma(log(y), x, Float64(-t)); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[t, -3.4e-79], N[(N[(N[Log[y], $MachinePrecision] * x), $MachinePrecision] - t), $MachinePrecision], If[LessEqual[t, 9e-155], N[(N[Log[y], $MachinePrecision] * x + N[((-y) * z), $MachinePrecision]), $MachinePrecision], N[(N[Log[y], $MachinePrecision] * x + (-t)), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.4 \cdot 10^{-79}:\\
\;\;\;\;\log y \cdot x - t\\
\mathbf{elif}\;t \leq 9 \cdot 10^{-155}:\\
\;\;\;\;\mathsf{fma}\left(\log y, x, \left(-y\right) \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\log y, x, -t\right)\\
\end{array}
\end{array}
if t < -3.39999999999999976e-79Initial program 91.5%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lift-log.f6490.7
Applied rewrites90.7%
if -3.39999999999999976e-79 < t < 9.0000000000000007e-155Initial program 73.3%
lift--.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-log.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-log.f64N/A
associate--l+N/A
*-commutativeN/A
lower-fma.f64N/A
lift-log.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-log.f64N/A
lift--.f6473.3
Applied rewrites73.3%
Taylor expanded in y around 0
lower--.f64N/A
associate-*r*N/A
mul-1-negN/A
lower-*.f64N/A
lower-neg.f6498.8
Applied rewrites98.8%
Taylor expanded in y around inf
mul-1-negN/A
distribute-lft-neg-outN/A
lift-neg.f64N/A
lift-*.f6490.6
Applied rewrites90.6%
if 9.0000000000000007e-155 < t Initial program 89.2%
lift--.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-log.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-log.f64N/A
associate--l+N/A
*-commutativeN/A
lower-fma.f64N/A
lift-log.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-log.f64N/A
lift--.f6489.2
Applied rewrites89.2%
Taylor expanded in y around 0
mul-1-negN/A
lift-neg.f6488.3
Applied rewrites88.3%
(FPCore (x y z t) :precision binary64 (fma (log y) x (- t)))
double code(double x, double y, double z, double t) {
return fma(log(y), x, -t);
}
function code(x, y, z, t) return fma(log(y), x, Float64(-t)) end
code[x_, y_, z_, t_] := N[(N[Log[y], $MachinePrecision] * x + (-t)), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\log y, x, -t\right)
\end{array}
Initial program 85.0%
lift--.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-log.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-log.f64N/A
associate--l+N/A
*-commutativeN/A
lower-fma.f64N/A
lift-log.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-log.f64N/A
lift--.f6485.0
Applied rewrites85.0%
Taylor expanded in y around 0
mul-1-negN/A
lift-neg.f6483.9
Applied rewrites83.9%
(FPCore (x y z t) :precision binary64 (- (* (log y) x) t))
double code(double x, double y, double z, double t) {
return (log(y) * x) - t;
}
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 = (log(y) * x) - t
end function
public static double code(double x, double y, double z, double t) {
return (Math.log(y) * x) - t;
}
def code(x, y, z, t): return (math.log(y) * x) - t
function code(x, y, z, t) return Float64(Float64(log(y) * x) - t) end
function tmp = code(x, y, z, t) tmp = (log(y) * x) - t; end
code[x_, y_, z_, t_] := N[(N[(N[Log[y], $MachinePrecision] * x), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\log y \cdot x - t
\end{array}
Initial program 85.0%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lift-log.f6483.9
Applied rewrites83.9%
(FPCore (x y z t) :precision binary64 (if (<= t -8.2e-16) (- t) (if (<= t 3.3e-52) (* (log y) x) (- t))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -8.2e-16) {
tmp = -t;
} else if (t <= 3.3e-52) {
tmp = log(y) * x;
} else {
tmp = -t;
}
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) :: tmp
if (t <= (-8.2d-16)) then
tmp = -t
else if (t <= 3.3d-52) then
tmp = log(y) * x
else
tmp = -t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= -8.2e-16) {
tmp = -t;
} else if (t <= 3.3e-52) {
tmp = Math.log(y) * x;
} else {
tmp = -t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -8.2e-16: tmp = -t elif t <= 3.3e-52: tmp = math.log(y) * x else: tmp = -t return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -8.2e-16) tmp = Float64(-t); elseif (t <= 3.3e-52) tmp = Float64(log(y) * x); else tmp = Float64(-t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -8.2e-16) tmp = -t; elseif (t <= 3.3e-52) tmp = log(y) * x; else tmp = -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -8.2e-16], (-t), If[LessEqual[t, 3.3e-52], N[(N[Log[y], $MachinePrecision] * x), $MachinePrecision], (-t)]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -8.2 \cdot 10^{-16}:\\
\;\;\;\;-t\\
\mathbf{elif}\;t \leq 3.3 \cdot 10^{-52}:\\
\;\;\;\;\log y \cdot x\\
\mathbf{else}:\\
\;\;\;\;-t\\
\end{array}
\end{array}
if t < -8.20000000000000012e-16 or 3.29999999999999995e-52 < t Initial program 92.9%
Taylor expanded in t around inf
mul-1-negN/A
lower-neg.f6465.2
Applied rewrites65.2%
if -8.20000000000000012e-16 < t < 3.29999999999999995e-52Initial program 75.1%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lift-log.f6461.4
Applied rewrites61.4%
(FPCore (x y z t) :precision binary64 (- t))
double code(double x, double y, double z, double t) {
return -t;
}
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 = -t
end function
public static double code(double x, double y, double z, double t) {
return -t;
}
def code(x, y, z, t): return -t
function code(x, y, z, t) return Float64(-t) end
function tmp = code(x, y, z, t) tmp = -t; end
code[x_, y_, z_, t_] := (-t)
\begin{array}{l}
\\
-t
\end{array}
Initial program 85.0%
Taylor expanded in t around inf
mul-1-negN/A
lower-neg.f6442.6
Applied rewrites42.6%
herbie shell --seed 2025114
(FPCore (x y z t)
:name "Numeric.SpecFunctions:invIncompleteBetaWorker from math-functions-0.1.5.2, B"
:precision binary64
(- (+ (* x (log y)) (* z (log (- 1.0 y)))) t))