
(FPCore (x y z t) :precision binary64 (+ (- x (/ y (* z 3.0))) (/ t (* (* z 3.0) y))))
double code(double x, double y, double z, double t) {
return (x - (y / (z * 3.0))) + (t / ((z * 3.0) * 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 = (x - (y / (z * 3.0d0))) + (t / ((z * 3.0d0) * y))
end function
public static double code(double x, double y, double z, double t) {
return (x - (y / (z * 3.0))) + (t / ((z * 3.0) * y));
}
def code(x, y, z, t): return (x - (y / (z * 3.0))) + (t / ((z * 3.0) * y))
function code(x, y, z, t) return Float64(Float64(x - Float64(y / Float64(z * 3.0))) + Float64(t / Float64(Float64(z * 3.0) * y))) end
function tmp = code(x, y, z, t) tmp = (x - (y / (z * 3.0))) + (t / ((z * 3.0) * y)); end
code[x_, y_, z_, t_] := N[(N[(x - N[(y / N[(z * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t / N[(N[(z * 3.0), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (+ (- x (/ y (* z 3.0))) (/ t (* (* z 3.0) y))))
double code(double x, double y, double z, double t) {
return (x - (y / (z * 3.0))) + (t / ((z * 3.0) * 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 = (x - (y / (z * 3.0d0))) + (t / ((z * 3.0d0) * y))
end function
public static double code(double x, double y, double z, double t) {
return (x - (y / (z * 3.0))) + (t / ((z * 3.0) * y));
}
def code(x, y, z, t): return (x - (y / (z * 3.0))) + (t / ((z * 3.0) * y))
function code(x, y, z, t) return Float64(Float64(x - Float64(y / Float64(z * 3.0))) + Float64(t / Float64(Float64(z * 3.0) * y))) end
function tmp = code(x, y, z, t) tmp = (x - (y / (z * 3.0))) + (t / ((z * 3.0) * y)); end
code[x_, y_, z_, t_] := N[(N[(x - N[(y / N[(z * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t / N[(N[(z * 3.0), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y}
\end{array}
(FPCore (x y z t) :precision binary64 (if (or (<= z -2e+55) (not (<= z 5e+96))) (+ (- x (/ y (* z 3.0))) (/ t (* (* z 3.0) y))) (- x (/ (- y (/ t y)) (* 3.0 z)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -2e+55) || !(z <= 5e+96)) {
tmp = (x - (y / (z * 3.0))) + (t / ((z * 3.0) * y));
} else {
tmp = x - ((y - (t / y)) / (3.0 * z));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, 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 ((z <= (-2d+55)) .or. (.not. (z <= 5d+96))) then
tmp = (x - (y / (z * 3.0d0))) + (t / ((z * 3.0d0) * y))
else
tmp = x - ((y - (t / y)) / (3.0d0 * z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -2e+55) || !(z <= 5e+96)) {
tmp = (x - (y / (z * 3.0))) + (t / ((z * 3.0) * y));
} else {
tmp = x - ((y - (t / y)) / (3.0 * z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -2e+55) or not (z <= 5e+96): tmp = (x - (y / (z * 3.0))) + (t / ((z * 3.0) * y)) else: tmp = x - ((y - (t / y)) / (3.0 * z)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -2e+55) || !(z <= 5e+96)) tmp = Float64(Float64(x - Float64(y / Float64(z * 3.0))) + Float64(t / Float64(Float64(z * 3.0) * y))); else tmp = Float64(x - Float64(Float64(y - Float64(t / y)) / Float64(3.0 * z))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -2e+55) || ~((z <= 5e+96))) tmp = (x - (y / (z * 3.0))) + (t / ((z * 3.0) * y)); else tmp = x - ((y - (t / y)) / (3.0 * z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -2e+55], N[Not[LessEqual[z, 5e+96]], $MachinePrecision]], N[(N[(x - N[(y / N[(z * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t / N[(N[(z * 3.0), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(N[(y - N[(t / y), $MachinePrecision]), $MachinePrecision] / N[(3.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2 \cdot 10^{+55} \lor \neg \left(z \leq 5 \cdot 10^{+96}\right):\\
\;\;\;\;\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y}\\
\mathbf{else}:\\
\;\;\;\;x - \frac{y - \frac{t}{y}}{3 \cdot z}\\
\end{array}
\end{array}
if z < -2.00000000000000002e55 or 5.0000000000000004e96 < z Initial program 99.9%
if -2.00000000000000002e55 < z < 5.0000000000000004e96Initial program 93.7%
lift-+.f64N/A
lift--.f64N/A
associate-+l-N/A
lower--.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
lower-/.f6499.8
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.8
Applied rewrites99.8%
Final simplification99.8%
(FPCore (x y z t)
:precision binary64
(if (<= t 5.2e+79)
(+ (- x (/ y (* z 3.0))) (/ (/ t (* 3.0 z)) y))
(*
(-
(/ (fma -0.3333333333333333 (/ y z) x) t)
(/ (/ -0.3333333333333333 z) y))
t)))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= 5.2e+79) {
tmp = (x - (y / (z * 3.0))) + ((t / (3.0 * z)) / y);
} else {
tmp = ((fma(-0.3333333333333333, (y / z), x) / t) - ((-0.3333333333333333 / z) / y)) * t;
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (t <= 5.2e+79) tmp = Float64(Float64(x - Float64(y / Float64(z * 3.0))) + Float64(Float64(t / Float64(3.0 * z)) / y)); else tmp = Float64(Float64(Float64(fma(-0.3333333333333333, Float64(y / z), x) / t) - Float64(Float64(-0.3333333333333333 / z) / y)) * t); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[t, 5.2e+79], N[(N[(x - N[(y / N[(z * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(t / N[(3.0 * z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(-0.3333333333333333 * N[(y / z), $MachinePrecision] + x), $MachinePrecision] / t), $MachinePrecision] - N[(N[(-0.3333333333333333 / z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 5.2 \cdot 10^{+79}:\\
\;\;\;\;\left(x - \frac{y}{z \cdot 3}\right) + \frac{\frac{t}{3 \cdot z}}{y}\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{\mathsf{fma}\left(-0.3333333333333333, \frac{y}{z}, x\right)}{t} - \frac{\frac{-0.3333333333333333}{z}}{y}\right) \cdot t\\
\end{array}
\end{array}
if t < 5.20000000000000029e79Initial program 95.9%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6499.8
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.8
Applied rewrites99.8%
if 5.20000000000000029e79 < t Initial program 97.7%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites99.8%
Final simplification99.8%
(FPCore (x y z t) :precision binary64 (if (<= t 1.65e-93) (+ (- x (/ y (* z 3.0))) (/ (/ t (* 3.0 z)) y)) (+ (- x (/ (/ y 3.0) z)) (/ t (* (* z 3.0) y)))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= 1.65e-93) {
tmp = (x - (y / (z * 3.0))) + ((t / (3.0 * z)) / y);
} else {
tmp = (x - ((y / 3.0) / z)) + (t / ((z * 3.0) * y));
}
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 <= 1.65d-93) then
tmp = (x - (y / (z * 3.0d0))) + ((t / (3.0d0 * z)) / y)
else
tmp = (x - ((y / 3.0d0) / z)) + (t / ((z * 3.0d0) * y))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= 1.65e-93) {
tmp = (x - (y / (z * 3.0))) + ((t / (3.0 * z)) / y);
} else {
tmp = (x - ((y / 3.0) / z)) + (t / ((z * 3.0) * y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= 1.65e-93: tmp = (x - (y / (z * 3.0))) + ((t / (3.0 * z)) / y) else: tmp = (x - ((y / 3.0) / z)) + (t / ((z * 3.0) * y)) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= 1.65e-93) tmp = Float64(Float64(x - Float64(y / Float64(z * 3.0))) + Float64(Float64(t / Float64(3.0 * z)) / y)); else tmp = Float64(Float64(x - Float64(Float64(y / 3.0) / z)) + Float64(t / Float64(Float64(z * 3.0) * y))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= 1.65e-93) tmp = (x - (y / (z * 3.0))) + ((t / (3.0 * z)) / y); else tmp = (x - ((y / 3.0) / z)) + (t / ((z * 3.0) * y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, 1.65e-93], N[(N[(x - N[(y / N[(z * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(t / N[(3.0 * z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(N[(x - N[(N[(y / 3.0), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision] + N[(t / N[(N[(z * 3.0), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 1.65 \cdot 10^{-93}:\\
\;\;\;\;\left(x - \frac{y}{z \cdot 3}\right) + \frac{\frac{t}{3 \cdot z}}{y}\\
\mathbf{else}:\\
\;\;\;\;\left(x - \frac{\frac{y}{3}}{z}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y}\\
\end{array}
\end{array}
if t < 1.6500000000000001e-93Initial program 95.0%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6499.8
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.8
Applied rewrites99.8%
if 1.6500000000000001e-93 < t Initial program 98.6%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6498.7
Applied rewrites98.7%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- x (/ y (* z 3.0)))))
(if (<= t 2e-93)
(+ t_1 (/ (/ t (* 3.0 z)) y))
(+ t_1 (/ t (* (* z 3.0) y))))))
double code(double x, double y, double z, double t) {
double t_1 = x - (y / (z * 3.0));
double tmp;
if (t <= 2e-93) {
tmp = t_1 + ((t / (3.0 * z)) / y);
} else {
tmp = t_1 + (t / ((z * 3.0) * y));
}
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 = x - (y / (z * 3.0d0))
if (t <= 2d-93) then
tmp = t_1 + ((t / (3.0d0 * z)) / y)
else
tmp = t_1 + (t / ((z * 3.0d0) * y))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x - (y / (z * 3.0));
double tmp;
if (t <= 2e-93) {
tmp = t_1 + ((t / (3.0 * z)) / y);
} else {
tmp = t_1 + (t / ((z * 3.0) * y));
}
return tmp;
}
def code(x, y, z, t): t_1 = x - (y / (z * 3.0)) tmp = 0 if t <= 2e-93: tmp = t_1 + ((t / (3.0 * z)) / y) else: tmp = t_1 + (t / ((z * 3.0) * y)) return tmp
function code(x, y, z, t) t_1 = Float64(x - Float64(y / Float64(z * 3.0))) tmp = 0.0 if (t <= 2e-93) tmp = Float64(t_1 + Float64(Float64(t / Float64(3.0 * z)) / y)); else tmp = Float64(t_1 + Float64(t / Float64(Float64(z * 3.0) * y))); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x - (y / (z * 3.0)); tmp = 0.0; if (t <= 2e-93) tmp = t_1 + ((t / (3.0 * z)) / y); else tmp = t_1 + (t / ((z * 3.0) * y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x - N[(y / N[(z * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, 2e-93], N[(t$95$1 + N[(N[(t / N[(3.0 * z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(t$95$1 + N[(t / N[(N[(z * 3.0), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x - \frac{y}{z \cdot 3}\\
\mathbf{if}\;t \leq 2 \cdot 10^{-93}:\\
\;\;\;\;t\_1 + \frac{\frac{t}{3 \cdot z}}{y}\\
\mathbf{else}:\\
\;\;\;\;t\_1 + \frac{t}{\left(z \cdot 3\right) \cdot y}\\
\end{array}
\end{array}
if t < 1.9999999999999998e-93Initial program 95.0%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6499.8
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.8
Applied rewrites99.8%
if 1.9999999999999998e-93 < t Initial program 98.6%
(FPCore (x y z t) :precision binary64 (if (or (<= y -1.2e-60) (not (<= y 6.2e-42))) (- x (/ (- y (/ t y)) (* 3.0 z))) (fma 0.3333333333333333 (/ (/ t z) y) x)))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1.2e-60) || !(y <= 6.2e-42)) {
tmp = x - ((y - (t / y)) / (3.0 * z));
} else {
tmp = fma(0.3333333333333333, ((t / z) / y), x);
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if ((y <= -1.2e-60) || !(y <= 6.2e-42)) tmp = Float64(x - Float64(Float64(y - Float64(t / y)) / Float64(3.0 * z))); else tmp = fma(0.3333333333333333, Float64(Float64(t / z) / y), x); end return tmp end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -1.2e-60], N[Not[LessEqual[y, 6.2e-42]], $MachinePrecision]], N[(x - N[(N[(y - N[(t / y), $MachinePrecision]), $MachinePrecision] / N[(3.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.3333333333333333 * N[(N[(t / z), $MachinePrecision] / y), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.2 \cdot 10^{-60} \lor \neg \left(y \leq 6.2 \cdot 10^{-42}\right):\\
\;\;\;\;x - \frac{y - \frac{t}{y}}{3 \cdot z}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(0.3333333333333333, \frac{\frac{t}{z}}{y}, x\right)\\
\end{array}
\end{array}
if y < -1.20000000000000005e-60 or 6.2000000000000005e-42 < y Initial program 99.1%
lift-+.f64N/A
lift--.f64N/A
associate-+l-N/A
lower--.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
lower-/.f6499.8
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.8
Applied rewrites99.8%
if -1.20000000000000005e-60 < y < 6.2000000000000005e-42Initial program 93.1%
Taylor expanded in y around 0
div-addN/A
associate-/l*N/A
associate-/r*N/A
*-commutativeN/A
associate-/l*N/A
fp-cancel-sign-sub-invN/A
distribute-lft-neg-inN/A
distribute-rgt-neg-inN/A
*-inversesN/A
metadata-evalN/A
*-commutativeN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
*-lft-identityN/A
associate-*r/N/A
times-fracN/A
lower-fma.f64N/A
lower-/.f64N/A
lower-/.f6496.7
Applied rewrites96.7%
Applied rewrites96.7%
Final simplification98.3%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- y (/ t y))))
(if (<= y -1.2e-60)
(- x (/ (/ t_1 3.0) z))
(if (<= y 6.2e-42)
(fma 0.3333333333333333 (/ (/ t z) y) x)
(- x (/ t_1 (* 3.0 z)))))))
double code(double x, double y, double z, double t) {
double t_1 = y - (t / y);
double tmp;
if (y <= -1.2e-60) {
tmp = x - ((t_1 / 3.0) / z);
} else if (y <= 6.2e-42) {
tmp = fma(0.3333333333333333, ((t / z) / y), x);
} else {
tmp = x - (t_1 / (3.0 * z));
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(y - Float64(t / y)) tmp = 0.0 if (y <= -1.2e-60) tmp = Float64(x - Float64(Float64(t_1 / 3.0) / z)); elseif (y <= 6.2e-42) tmp = fma(0.3333333333333333, Float64(Float64(t / z) / y), x); else tmp = Float64(x - Float64(t_1 / Float64(3.0 * z))); end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y - N[(t / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.2e-60], N[(x - N[(N[(t$95$1 / 3.0), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 6.2e-42], N[(0.3333333333333333 * N[(N[(t / z), $MachinePrecision] / y), $MachinePrecision] + x), $MachinePrecision], N[(x - N[(t$95$1 / N[(3.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y - \frac{t}{y}\\
\mathbf{if}\;y \leq -1.2 \cdot 10^{-60}:\\
\;\;\;\;x - \frac{\frac{t\_1}{3}}{z}\\
\mathbf{elif}\;y \leq 6.2 \cdot 10^{-42}:\\
\;\;\;\;\mathsf{fma}\left(0.3333333333333333, \frac{\frac{t}{z}}{y}, x\right)\\
\mathbf{else}:\\
\;\;\;\;x - \frac{t\_1}{3 \cdot z}\\
\end{array}
\end{array}
if y < -1.20000000000000005e-60Initial program 98.3%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6498.3
Applied rewrites98.3%
lift-+.f64N/A
lift--.f64N/A
associate-+l-N/A
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
*-commutativeN/A
lower--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lift-/.f64N/A
sub-divN/A
lift--.f64N/A
lower-/.f64N/A
lift-*.f6499.8
Applied rewrites99.8%
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6499.8
Applied rewrites99.8%
if -1.20000000000000005e-60 < y < 6.2000000000000005e-42Initial program 93.1%
Taylor expanded in y around 0
div-addN/A
associate-/l*N/A
associate-/r*N/A
*-commutativeN/A
associate-/l*N/A
fp-cancel-sign-sub-invN/A
distribute-lft-neg-inN/A
distribute-rgt-neg-inN/A
*-inversesN/A
metadata-evalN/A
*-commutativeN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
*-lft-identityN/A
associate-*r/N/A
times-fracN/A
lower-fma.f64N/A
lower-/.f64N/A
lower-/.f6496.7
Applied rewrites96.7%
Applied rewrites96.7%
if 6.2000000000000005e-42 < y Initial program 99.9%
lift-+.f64N/A
lift--.f64N/A
associate-+l-N/A
lower--.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
lower-/.f6499.9
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.9
Applied rewrites99.9%
Final simplification98.3%
(FPCore (x y z t) :precision binary64 (if (or (<= y -1.2e-60) (not (<= y 6.2e-42))) (fma (/ (- (/ t y) y) z) 0.3333333333333333 x) (fma 0.3333333333333333 (/ (/ t z) y) x)))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1.2e-60) || !(y <= 6.2e-42)) {
tmp = fma((((t / y) - y) / z), 0.3333333333333333, x);
} else {
tmp = fma(0.3333333333333333, ((t / z) / y), x);
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if ((y <= -1.2e-60) || !(y <= 6.2e-42)) tmp = fma(Float64(Float64(Float64(t / y) - y) / z), 0.3333333333333333, x); else tmp = fma(0.3333333333333333, Float64(Float64(t / z) / y), x); end return tmp end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -1.2e-60], N[Not[LessEqual[y, 6.2e-42]], $MachinePrecision]], N[(N[(N[(N[(t / y), $MachinePrecision] - y), $MachinePrecision] / z), $MachinePrecision] * 0.3333333333333333 + x), $MachinePrecision], N[(0.3333333333333333 * N[(N[(t / z), $MachinePrecision] / y), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.2 \cdot 10^{-60} \lor \neg \left(y \leq 6.2 \cdot 10^{-42}\right):\\
\;\;\;\;\mathsf{fma}\left(\frac{\frac{t}{y} - y}{z}, 0.3333333333333333, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(0.3333333333333333, \frac{\frac{t}{z}}{y}, x\right)\\
\end{array}
\end{array}
if y < -1.20000000000000005e-60 or 6.2000000000000005e-42 < y Initial program 99.1%
Taylor expanded in x around 0
Applied rewrites99.1%
if -1.20000000000000005e-60 < y < 6.2000000000000005e-42Initial program 93.1%
Taylor expanded in y around 0
div-addN/A
associate-/l*N/A
associate-/r*N/A
*-commutativeN/A
associate-/l*N/A
fp-cancel-sign-sub-invN/A
distribute-lft-neg-inN/A
distribute-rgt-neg-inN/A
*-inversesN/A
metadata-evalN/A
*-commutativeN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
*-lft-identityN/A
associate-*r/N/A
times-fracN/A
lower-fma.f64N/A
lower-/.f64N/A
lower-/.f6496.7
Applied rewrites96.7%
Applied rewrites96.7%
Final simplification98.0%
(FPCore (x y z t) :precision binary64 (if (or (<= y -800000.0) (not (<= y 1.25e+51))) (fma -0.3333333333333333 (/ y z) x) (fma 0.3333333333333333 (/ (/ t z) y) x)))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -800000.0) || !(y <= 1.25e+51)) {
tmp = fma(-0.3333333333333333, (y / z), x);
} else {
tmp = fma(0.3333333333333333, ((t / z) / y), x);
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if ((y <= -800000.0) || !(y <= 1.25e+51)) tmp = fma(-0.3333333333333333, Float64(y / z), x); else tmp = fma(0.3333333333333333, Float64(Float64(t / z) / y), x); end return tmp end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -800000.0], N[Not[LessEqual[y, 1.25e+51]], $MachinePrecision]], N[(-0.3333333333333333 * N[(y / z), $MachinePrecision] + x), $MachinePrecision], N[(0.3333333333333333 * N[(N[(t / z), $MachinePrecision] / y), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -800000 \lor \neg \left(y \leq 1.25 \cdot 10^{+51}\right):\\
\;\;\;\;\mathsf{fma}\left(-0.3333333333333333, \frac{y}{z}, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(0.3333333333333333, \frac{\frac{t}{z}}{y}, x\right)\\
\end{array}
\end{array}
if y < -8e5 or 1.25e51 < y Initial program 98.9%
Taylor expanded in y around inf
*-commutativeN/A
fp-cancel-sub-sign-invN/A
remove-double-negN/A
mul-1-negN/A
distribute-lft-neg-inN/A
distribute-neg-inN/A
mul-1-negN/A
*-commutativeN/A
associate-*r*N/A
mul-1-negN/A
distribute-rgt-neg-inN/A
distribute-lft-neg-inN/A
*-commutativeN/A
+-commutativeN/A
distribute-neg-inN/A
distribute-lft-neg-inN/A
*-commutativeN/A
distribute-lft-neg-outN/A
fp-cancel-sub-signN/A
Applied rewrites95.0%
if -8e5 < y < 1.25e51Initial program 94.5%
Taylor expanded in y around 0
div-addN/A
associate-/l*N/A
associate-/r*N/A
*-commutativeN/A
associate-/l*N/A
fp-cancel-sign-sub-invN/A
distribute-lft-neg-inN/A
distribute-rgt-neg-inN/A
*-inversesN/A
metadata-evalN/A
*-commutativeN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
*-lft-identityN/A
associate-*r/N/A
times-fracN/A
lower-fma.f64N/A
lower-/.f64N/A
lower-/.f6494.1
Applied rewrites94.1%
Applied rewrites94.2%
Final simplification94.5%
(FPCore (x y z t) :precision binary64 (if (or (<= y -800000.0) (not (<= y 1.25e+51))) (fma -0.3333333333333333 (/ y z) x) (fma (/ t (* z y)) 0.3333333333333333 x)))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -800000.0) || !(y <= 1.25e+51)) {
tmp = fma(-0.3333333333333333, (y / z), x);
} else {
tmp = fma((t / (z * y)), 0.3333333333333333, x);
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if ((y <= -800000.0) || !(y <= 1.25e+51)) tmp = fma(-0.3333333333333333, Float64(y / z), x); else tmp = fma(Float64(t / Float64(z * y)), 0.3333333333333333, x); end return tmp end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -800000.0], N[Not[LessEqual[y, 1.25e+51]], $MachinePrecision]], N[(-0.3333333333333333 * N[(y / z), $MachinePrecision] + x), $MachinePrecision], N[(N[(t / N[(z * y), $MachinePrecision]), $MachinePrecision] * 0.3333333333333333 + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -800000 \lor \neg \left(y \leq 1.25 \cdot 10^{+51}\right):\\
\;\;\;\;\mathsf{fma}\left(-0.3333333333333333, \frac{y}{z}, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t}{z \cdot y}, 0.3333333333333333, x\right)\\
\end{array}
\end{array}
if y < -8e5 or 1.25e51 < y Initial program 98.9%
Taylor expanded in y around inf
*-commutativeN/A
fp-cancel-sub-sign-invN/A
remove-double-negN/A
mul-1-negN/A
distribute-lft-neg-inN/A
distribute-neg-inN/A
mul-1-negN/A
*-commutativeN/A
associate-*r*N/A
mul-1-negN/A
distribute-rgt-neg-inN/A
distribute-lft-neg-inN/A
*-commutativeN/A
+-commutativeN/A
distribute-neg-inN/A
distribute-lft-neg-inN/A
*-commutativeN/A
distribute-lft-neg-outN/A
fp-cancel-sub-signN/A
Applied rewrites95.0%
if -8e5 < y < 1.25e51Initial program 94.5%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6499.8
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.8
Applied rewrites99.8%
Taylor expanded in y around 0
fp-cancel-sign-sub-invN/A
*-commutativeN/A
fp-cancel-sub-sign-invN/A
div-add-revN/A
associate-*l/N/A
times-fracN/A
associate-/r*N/A
associate-*r/N/A
associate-*r/N/A
distribute-neg-fracN/A
distribute-neg-frac2N/A
associate-*r/N/A
distribute-neg-frac2N/A
distribute-lft-neg-inN/A
*-commutativeN/A
distribute-frac-negN/A
remove-double-negN/A
associate-/l*N/A
*-inversesN/A
*-inversesN/A
associate-/l*N/A
remove-double-negN/A
Applied rewrites89.4%
Final simplification91.6%
(FPCore (x y z t) :precision binary64 (if (or (<= y -4e-21) (not (<= y 2.3e-74))) (fma -0.3333333333333333 (/ y z) x) (* (/ t (* z y)) 0.3333333333333333)))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -4e-21) || !(y <= 2.3e-74)) {
tmp = fma(-0.3333333333333333, (y / z), x);
} else {
tmp = (t / (z * y)) * 0.3333333333333333;
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if ((y <= -4e-21) || !(y <= 2.3e-74)) tmp = fma(-0.3333333333333333, Float64(y / z), x); else tmp = Float64(Float64(t / Float64(z * y)) * 0.3333333333333333); end return tmp end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -4e-21], N[Not[LessEqual[y, 2.3e-74]], $MachinePrecision]], N[(-0.3333333333333333 * N[(y / z), $MachinePrecision] + x), $MachinePrecision], N[(N[(t / N[(z * y), $MachinePrecision]), $MachinePrecision] * 0.3333333333333333), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4 \cdot 10^{-21} \lor \neg \left(y \leq 2.3 \cdot 10^{-74}\right):\\
\;\;\;\;\mathsf{fma}\left(-0.3333333333333333, \frac{y}{z}, x\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{t}{z \cdot y} \cdot 0.3333333333333333\\
\end{array}
\end{array}
if y < -3.99999999999999963e-21 or 2.2999999999999998e-74 < y Initial program 99.1%
Taylor expanded in y around inf
*-commutativeN/A
fp-cancel-sub-sign-invN/A
remove-double-negN/A
mul-1-negN/A
distribute-lft-neg-inN/A
distribute-neg-inN/A
mul-1-negN/A
*-commutativeN/A
associate-*r*N/A
mul-1-negN/A
distribute-rgt-neg-inN/A
distribute-lft-neg-inN/A
*-commutativeN/A
+-commutativeN/A
distribute-neg-inN/A
distribute-lft-neg-inN/A
*-commutativeN/A
distribute-lft-neg-outN/A
fp-cancel-sub-signN/A
Applied rewrites87.0%
if -3.99999999999999963e-21 < y < 2.2999999999999998e-74Initial program 92.9%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6462.5
Applied rewrites62.5%
Final simplification75.4%
(FPCore (x y z t) :precision binary64 (if (or (<= y -4e-21) (not (<= y 2.3e-74))) (fma -0.3333333333333333 (/ y z) x) (* t (/ 0.3333333333333333 (* z y)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -4e-21) || !(y <= 2.3e-74)) {
tmp = fma(-0.3333333333333333, (y / z), x);
} else {
tmp = t * (0.3333333333333333 / (z * y));
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if ((y <= -4e-21) || !(y <= 2.3e-74)) tmp = fma(-0.3333333333333333, Float64(y / z), x); else tmp = Float64(t * Float64(0.3333333333333333 / Float64(z * y))); end return tmp end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -4e-21], N[Not[LessEqual[y, 2.3e-74]], $MachinePrecision]], N[(-0.3333333333333333 * N[(y / z), $MachinePrecision] + x), $MachinePrecision], N[(t * N[(0.3333333333333333 / N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4 \cdot 10^{-21} \lor \neg \left(y \leq 2.3 \cdot 10^{-74}\right):\\
\;\;\;\;\mathsf{fma}\left(-0.3333333333333333, \frac{y}{z}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t \cdot \frac{0.3333333333333333}{z \cdot y}\\
\end{array}
\end{array}
if y < -3.99999999999999963e-21 or 2.2999999999999998e-74 < y Initial program 99.1%
Taylor expanded in y around inf
*-commutativeN/A
fp-cancel-sub-sign-invN/A
remove-double-negN/A
mul-1-negN/A
distribute-lft-neg-inN/A
distribute-neg-inN/A
mul-1-negN/A
*-commutativeN/A
associate-*r*N/A
mul-1-negN/A
distribute-rgt-neg-inN/A
distribute-lft-neg-inN/A
*-commutativeN/A
+-commutativeN/A
distribute-neg-inN/A
distribute-lft-neg-inN/A
*-commutativeN/A
distribute-lft-neg-outN/A
fp-cancel-sub-signN/A
Applied rewrites87.0%
if -3.99999999999999963e-21 < y < 2.2999999999999998e-74Initial program 92.9%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6462.5
Applied rewrites62.5%
Applied rewrites62.3%
Final simplification75.3%
(FPCore (x y z t) :precision binary64 (fma -0.3333333333333333 (/ y z) x))
double code(double x, double y, double z, double t) {
return fma(-0.3333333333333333, (y / z), x);
}
function code(x, y, z, t) return fma(-0.3333333333333333, Float64(y / z), x) end
code[x_, y_, z_, t_] := N[(-0.3333333333333333 * N[(y / z), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(-0.3333333333333333, \frac{y}{z}, x\right)
\end{array}
Initial program 96.2%
Taylor expanded in y around inf
*-commutativeN/A
fp-cancel-sub-sign-invN/A
remove-double-negN/A
mul-1-negN/A
distribute-lft-neg-inN/A
distribute-neg-inN/A
mul-1-negN/A
*-commutativeN/A
associate-*r*N/A
mul-1-negN/A
distribute-rgt-neg-inN/A
distribute-lft-neg-inN/A
*-commutativeN/A
+-commutativeN/A
distribute-neg-inN/A
distribute-lft-neg-inN/A
*-commutativeN/A
distribute-lft-neg-outN/A
fp-cancel-sub-signN/A
Applied rewrites61.9%
Final simplification61.9%
(FPCore (x y z t) :precision binary64 (* (/ y z) -0.3333333333333333))
double code(double x, double y, double z, double t) {
return (y / z) * -0.3333333333333333;
}
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 = (y / z) * (-0.3333333333333333d0)
end function
public static double code(double x, double y, double z, double t) {
return (y / z) * -0.3333333333333333;
}
def code(x, y, z, t): return (y / z) * -0.3333333333333333
function code(x, y, z, t) return Float64(Float64(y / z) * -0.3333333333333333) end
function tmp = code(x, y, z, t) tmp = (y / z) * -0.3333333333333333; end
code[x_, y_, z_, t_] := N[(N[(y / z), $MachinePrecision] * -0.3333333333333333), $MachinePrecision]
\begin{array}{l}
\\
\frac{y}{z} \cdot -0.3333333333333333
\end{array}
Initial program 96.2%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6496.2
Applied rewrites96.2%
lift-+.f64N/A
lift--.f64N/A
associate-+l-N/A
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
*-commutativeN/A
lower--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lift-/.f64N/A
sub-divN/A
lift--.f64N/A
lower-/.f64N/A
lift-*.f6493.5
Applied rewrites93.5%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6433.3
Applied rewrites33.3%
Final simplification33.3%
(FPCore (x y z t) :precision binary64 (+ (- x (/ y (* z 3.0))) (/ (/ t (* z 3.0)) y)))
double code(double x, double y, double z, double t) {
return (x - (y / (z * 3.0))) + ((t / (z * 3.0)) / 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 = (x - (y / (z * 3.0d0))) + ((t / (z * 3.0d0)) / y)
end function
public static double code(double x, double y, double z, double t) {
return (x - (y / (z * 3.0))) + ((t / (z * 3.0)) / y);
}
def code(x, y, z, t): return (x - (y / (z * 3.0))) + ((t / (z * 3.0)) / y)
function code(x, y, z, t) return Float64(Float64(x - Float64(y / Float64(z * 3.0))) + Float64(Float64(t / Float64(z * 3.0)) / y)) end
function tmp = code(x, y, z, t) tmp = (x - (y / (z * 3.0))) + ((t / (z * 3.0)) / y); end
code[x_, y_, z_, t_] := N[(N[(x - N[(y / N[(z * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(t / N[(z * 3.0), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x - \frac{y}{z \cdot 3}\right) + \frac{\frac{t}{z \cdot 3}}{y}
\end{array}
herbie shell --seed 2024350
(FPCore (x y z t)
:name "Diagrams.Solve.Polynomial:cubForm from diagrams-solve-0.1, H"
:precision binary64
:alt
(! :herbie-platform default (+ (- x (/ y (* z 3))) (/ (/ t (* z 3)) y)))
(+ (- x (/ y (* z 3.0))) (/ t (* (* z 3.0) y))))