
(FPCore (x y z) :precision binary64 :pre TRUE (+ 1.0 (/ (* 4.0 (- (+ x (* y 0.75)) z)) y)))
double code(double x, double y, double z) {
return 1.0 + ((4.0 * ((x + (y * 0.75)) - z)) / y);
}
real(8) function code(x, y, z)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = 1.0d0 + ((4.0d0 * ((x + (y * 0.75d0)) - z)) / y)
end function
public static double code(double x, double y, double z) {
return 1.0 + ((4.0 * ((x + (y * 0.75)) - z)) / y);
}
def code(x, y, z): return 1.0 + ((4.0 * ((x + (y * 0.75)) - z)) / y)
function code(x, y, z) return Float64(1.0 + Float64(Float64(4.0 * Float64(Float64(x + Float64(y * 0.75)) - z)) / y)) end
function tmp = code(x, y, z) tmp = 1.0 + ((4.0 * ((x + (y * 0.75)) - z)) / y); end
code[x_, y_, z_] := N[(1.0 + N[(N[(4.0 * N[(N[(x + N[(y * 0.75), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]
f(x, y, z): x in [-inf, +inf], y in [-inf, +inf], z in [-inf, +inf] code: THEORY BEGIN f(x, y, z: real): real = (1) + (((4) * ((x + (y * (75e-2))) - z)) / y) END code
1 + \frac{4 \cdot \left(\left(x + y \cdot 0.75\right) - z\right)}{y}
Herbie found 8 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 :pre TRUE (+ 1.0 (/ (* 4.0 (- (+ x (* y 0.75)) z)) y)))
double code(double x, double y, double z) {
return 1.0 + ((4.0 * ((x + (y * 0.75)) - z)) / y);
}
real(8) function code(x, y, z)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = 1.0d0 + ((4.0d0 * ((x + (y * 0.75d0)) - z)) / y)
end function
public static double code(double x, double y, double z) {
return 1.0 + ((4.0 * ((x + (y * 0.75)) - z)) / y);
}
def code(x, y, z): return 1.0 + ((4.0 * ((x + (y * 0.75)) - z)) / y)
function code(x, y, z) return Float64(1.0 + Float64(Float64(4.0 * Float64(Float64(x + Float64(y * 0.75)) - z)) / y)) end
function tmp = code(x, y, z) tmp = 1.0 + ((4.0 * ((x + (y * 0.75)) - z)) / y); end
code[x_, y_, z_] := N[(1.0 + N[(N[(4.0 * N[(N[(x + N[(y * 0.75), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]
f(x, y, z): x in [-inf, +inf], y in [-inf, +inf], z in [-inf, +inf] code: THEORY BEGIN f(x, y, z: real): real = (1) + (((4) * ((x + (y * (75e-2))) - z)) / y) END code
1 + \frac{4 \cdot \left(\left(x + y \cdot 0.75\right) - z\right)}{y}
(FPCore (x y z) :precision binary64 :pre TRUE (fma (/ (- x z) y) 4.0 4.0))
double code(double x, double y, double z) {
return fma(((x - z) / y), 4.0, 4.0);
}
function code(x, y, z) return fma(Float64(Float64(x - z) / y), 4.0, 4.0) end
code[x_, y_, z_] := N[(N[(N[(x - z), $MachinePrecision] / y), $MachinePrecision] * 4.0 + 4.0), $MachinePrecision]
f(x, y, z): x in [-inf, +inf], y in [-inf, +inf], z in [-inf, +inf] code: THEORY BEGIN f(x, y, z: real): real = (((x - z) / y) * (4)) + (4) END code
\mathsf{fma}\left(\frac{x - z}{y}, 4, 4\right)
Initial program 99.7%
Taylor expanded in y around inf
Applied rewrites100.0%
Applied rewrites100.0%
(FPCore (x y z)
:precision binary64
:pre TRUE
(let* ((t_0 (* -4.0 (/ (- z x) y)))
(t_1 (/ (* 4.0 (- (+ x (* y 0.75)) z)) y)))
(if (<= t_1 -40000000.0)
t_0
(if (<= t_1 5.0) (+ 4.0 (* 4.0 (/ x y))) t_0))))double code(double x, double y, double z) {
double t_0 = -4.0 * ((z - x) / y);
double t_1 = (4.0 * ((x + (y * 0.75)) - z)) / y;
double tmp;
if (t_1 <= -40000000.0) {
tmp = t_0;
} else if (t_1 <= 5.0) {
tmp = 4.0 + (4.0 * (x / y));
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(x, y, z)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (-4.0d0) * ((z - x) / y)
t_1 = (4.0d0 * ((x + (y * 0.75d0)) - z)) / y
if (t_1 <= (-40000000.0d0)) then
tmp = t_0
else if (t_1 <= 5.0d0) then
tmp = 4.0d0 + (4.0d0 * (x / y))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = -4.0 * ((z - x) / y);
double t_1 = (4.0 * ((x + (y * 0.75)) - z)) / y;
double tmp;
if (t_1 <= -40000000.0) {
tmp = t_0;
} else if (t_1 <= 5.0) {
tmp = 4.0 + (4.0 * (x / y));
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = -4.0 * ((z - x) / y) t_1 = (4.0 * ((x + (y * 0.75)) - z)) / y tmp = 0 if t_1 <= -40000000.0: tmp = t_0 elif t_1 <= 5.0: tmp = 4.0 + (4.0 * (x / y)) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(-4.0 * Float64(Float64(z - x) / y)) t_1 = Float64(Float64(4.0 * Float64(Float64(x + Float64(y * 0.75)) - z)) / y) tmp = 0.0 if (t_1 <= -40000000.0) tmp = t_0; elseif (t_1 <= 5.0) tmp = Float64(4.0 + Float64(4.0 * Float64(x / y))); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = -4.0 * ((z - x) / y); t_1 = (4.0 * ((x + (y * 0.75)) - z)) / y; tmp = 0.0; if (t_1 <= -40000000.0) tmp = t_0; elseif (t_1 <= 5.0) tmp = 4.0 + (4.0 * (x / y)); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(-4.0 * N[(N[(z - x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(4.0 * N[(N[(x + N[(y * 0.75), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]}, If[LessEqual[t$95$1, -40000000.0], t$95$0, If[LessEqual[t$95$1, 5.0], N[(4.0 + N[(4.0 * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
f(x, y, z): x in [-inf, +inf], y in [-inf, +inf], z in [-inf, +inf] code: THEORY BEGIN f(x, y, z: real): real = LET t_0 = ((-4) * ((z - x) / y)) IN LET t_1 = (((4) * ((x + (y * (75e-2))) - z)) / y) IN LET tmp_1 = IF (t_1 <= (5)) THEN ((4) + ((4) * (x / y))) ELSE t_0 ENDIF IN LET tmp = IF (t_1 <= (-4e7)) THEN t_0 ELSE tmp_1 ENDIF IN tmp END code
\begin{array}{l}
t_0 := -4 \cdot \frac{z - x}{y}\\
t_1 := \frac{4 \cdot \left(\left(x + y \cdot 0.75\right) - z\right)}{y}\\
\mathbf{if}\;t\_1 \leq -40000000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;t\_1 \leq 5:\\
\;\;\;\;4 + 4 \cdot \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
if (/.f64 (*.f64 #s(literal 4 binary64) (-.f64 (+.f64 x (*.f64 y #s(literal 3/4 binary64))) z)) y) < -4e7 or 5 < (/.f64 (*.f64 #s(literal 4 binary64) (-.f64 (+.f64 x (*.f64 y #s(literal 3/4 binary64))) z)) y) Initial program 99.7%
Applied rewrites99.7%
Taylor expanded in y around 0
Applied rewrites67.0%
if -4e7 < (/.f64 (*.f64 #s(literal 4 binary64) (-.f64 (+.f64 x (*.f64 y #s(literal 3/4 binary64))) z)) y) < 5Initial program 99.7%
Taylor expanded in y around inf
Applied rewrites100.0%
Taylor expanded in x around inf
Applied rewrites67.9%
(FPCore (x y z)
:precision binary64
:pre TRUE
(let* ((t_0 (* -4.0 (/ (- z x) y)))
(t_1 (/ (* 4.0 (- (+ x (* y 0.75)) z)) y)))
(if (<= t_1 -1000000.0)
t_0
(if (<= t_1 2e+15) (+ 4.0 (* -4.0 (/ z y))) t_0))))double code(double x, double y, double z) {
double t_0 = -4.0 * ((z - x) / y);
double t_1 = (4.0 * ((x + (y * 0.75)) - z)) / y;
double tmp;
if (t_1 <= -1000000.0) {
tmp = t_0;
} else if (t_1 <= 2e+15) {
tmp = 4.0 + (-4.0 * (z / y));
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(x, y, z)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (-4.0d0) * ((z - x) / y)
t_1 = (4.0d0 * ((x + (y * 0.75d0)) - z)) / y
if (t_1 <= (-1000000.0d0)) then
tmp = t_0
else if (t_1 <= 2d+15) then
tmp = 4.0d0 + ((-4.0d0) * (z / y))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = -4.0 * ((z - x) / y);
double t_1 = (4.0 * ((x + (y * 0.75)) - z)) / y;
double tmp;
if (t_1 <= -1000000.0) {
tmp = t_0;
} else if (t_1 <= 2e+15) {
tmp = 4.0 + (-4.0 * (z / y));
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = -4.0 * ((z - x) / y) t_1 = (4.0 * ((x + (y * 0.75)) - z)) / y tmp = 0 if t_1 <= -1000000.0: tmp = t_0 elif t_1 <= 2e+15: tmp = 4.0 + (-4.0 * (z / y)) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(-4.0 * Float64(Float64(z - x) / y)) t_1 = Float64(Float64(4.0 * Float64(Float64(x + Float64(y * 0.75)) - z)) / y) tmp = 0.0 if (t_1 <= -1000000.0) tmp = t_0; elseif (t_1 <= 2e+15) tmp = Float64(4.0 + Float64(-4.0 * Float64(z / y))); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = -4.0 * ((z - x) / y); t_1 = (4.0 * ((x + (y * 0.75)) - z)) / y; tmp = 0.0; if (t_1 <= -1000000.0) tmp = t_0; elseif (t_1 <= 2e+15) tmp = 4.0 + (-4.0 * (z / y)); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(-4.0 * N[(N[(z - x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(4.0 * N[(N[(x + N[(y * 0.75), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]}, If[LessEqual[t$95$1, -1000000.0], t$95$0, If[LessEqual[t$95$1, 2e+15], N[(4.0 + N[(-4.0 * N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
f(x, y, z): x in [-inf, +inf], y in [-inf, +inf], z in [-inf, +inf] code: THEORY BEGIN f(x, y, z: real): real = LET t_0 = ((-4) * ((z - x) / y)) IN LET t_1 = (((4) * ((x + (y * (75e-2))) - z)) / y) IN LET tmp_1 = IF (t_1 <= (2e15)) THEN ((4) + ((-4) * (z / y))) ELSE t_0 ENDIF IN LET tmp = IF (t_1 <= (-1e6)) THEN t_0 ELSE tmp_1 ENDIF IN tmp END code
\begin{array}{l}
t_0 := -4 \cdot \frac{z - x}{y}\\
t_1 := \frac{4 \cdot \left(\left(x + y \cdot 0.75\right) - z\right)}{y}\\
\mathbf{if}\;t\_1 \leq -1000000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+15}:\\
\;\;\;\;4 + -4 \cdot \frac{z}{y}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
if (/.f64 (*.f64 #s(literal 4 binary64) (-.f64 (+.f64 x (*.f64 y #s(literal 3/4 binary64))) z)) y) < -1e6 or 2e15 < (/.f64 (*.f64 #s(literal 4 binary64) (-.f64 (+.f64 x (*.f64 y #s(literal 3/4 binary64))) z)) y) Initial program 99.7%
Applied rewrites99.7%
Taylor expanded in y around 0
Applied rewrites67.0%
if -1e6 < (/.f64 (*.f64 #s(literal 4 binary64) (-.f64 (+.f64 x (*.f64 y #s(literal 3/4 binary64))) z)) y) < 2e15Initial program 99.7%
Taylor expanded in y around inf
Applied rewrites100.0%
Taylor expanded in x around 0
Applied rewrites67.7%
(FPCore (x y z)
:precision binary64
:pre TRUE
(let* ((t_0 (* -4.0 (/ (- z x) y)))
(t_1 (/ (* 4.0 (- (+ x (* y 0.75)) z)) y)))
(if (<= t_1 -50.0) t_0 (if (<= t_1 5.0) 4.0 t_0))))double code(double x, double y, double z) {
double t_0 = -4.0 * ((z - x) / y);
double t_1 = (4.0 * ((x + (y * 0.75)) - z)) / y;
double tmp;
if (t_1 <= -50.0) {
tmp = t_0;
} else if (t_1 <= 5.0) {
tmp = 4.0;
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(x, y, z)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (-4.0d0) * ((z - x) / y)
t_1 = (4.0d0 * ((x + (y * 0.75d0)) - z)) / y
if (t_1 <= (-50.0d0)) then
tmp = t_0
else if (t_1 <= 5.0d0) then
tmp = 4.0d0
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = -4.0 * ((z - x) / y);
double t_1 = (4.0 * ((x + (y * 0.75)) - z)) / y;
double tmp;
if (t_1 <= -50.0) {
tmp = t_0;
} else if (t_1 <= 5.0) {
tmp = 4.0;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = -4.0 * ((z - x) / y) t_1 = (4.0 * ((x + (y * 0.75)) - z)) / y tmp = 0 if t_1 <= -50.0: tmp = t_0 elif t_1 <= 5.0: tmp = 4.0 else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(-4.0 * Float64(Float64(z - x) / y)) t_1 = Float64(Float64(4.0 * Float64(Float64(x + Float64(y * 0.75)) - z)) / y) tmp = 0.0 if (t_1 <= -50.0) tmp = t_0; elseif (t_1 <= 5.0) tmp = 4.0; else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = -4.0 * ((z - x) / y); t_1 = (4.0 * ((x + (y * 0.75)) - z)) / y; tmp = 0.0; if (t_1 <= -50.0) tmp = t_0; elseif (t_1 <= 5.0) tmp = 4.0; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(-4.0 * N[(N[(z - x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(4.0 * N[(N[(x + N[(y * 0.75), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]}, If[LessEqual[t$95$1, -50.0], t$95$0, If[LessEqual[t$95$1, 5.0], 4.0, t$95$0]]]]
f(x, y, z): x in [-inf, +inf], y in [-inf, +inf], z in [-inf, +inf] code: THEORY BEGIN f(x, y, z: real): real = LET t_0 = ((-4) * ((z - x) / y)) IN LET t_1 = (((4) * ((x + (y * (75e-2))) - z)) / y) IN LET tmp_1 = IF (t_1 <= (5)) THEN (4) ELSE t_0 ENDIF IN LET tmp = IF (t_1 <= (-50)) THEN t_0 ELSE tmp_1 ENDIF IN tmp END code
\begin{array}{l}
t_0 := -4 \cdot \frac{z - x}{y}\\
t_1 := \frac{4 \cdot \left(\left(x + y \cdot 0.75\right) - z\right)}{y}\\
\mathbf{if}\;t\_1 \leq -50:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;t\_1 \leq 5:\\
\;\;\;\;4\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
if (/.f64 (*.f64 #s(literal 4 binary64) (-.f64 (+.f64 x (*.f64 y #s(literal 3/4 binary64))) z)) y) < -50 or 5 < (/.f64 (*.f64 #s(literal 4 binary64) (-.f64 (+.f64 x (*.f64 y #s(literal 3/4 binary64))) z)) y) Initial program 99.7%
Applied rewrites99.7%
Taylor expanded in y around 0
Applied rewrites67.0%
if -50 < (/.f64 (*.f64 #s(literal 4 binary64) (-.f64 (+.f64 x (*.f64 y #s(literal 3/4 binary64))) z)) y) < 5Initial program 99.7%
Taylor expanded in y around inf
Applied rewrites34.2%
(FPCore (x y z)
:precision binary64
:pre TRUE
(let* ((t_0 (* 4.0 (/ x y)))
(t_1 (/ (* 4.0 (- (+ x (* y 0.75)) z)) y)))
(if (<= t_1 -50.0)
t_0
(if (<= t_1 5e+17)
4.0
(if (<= t_1 1e+171) t_0 (/ (fma z -4.0 y) y))))))double code(double x, double y, double z) {
double t_0 = 4.0 * (x / y);
double t_1 = (4.0 * ((x + (y * 0.75)) - z)) / y;
double tmp;
if (t_1 <= -50.0) {
tmp = t_0;
} else if (t_1 <= 5e+17) {
tmp = 4.0;
} else if (t_1 <= 1e+171) {
tmp = t_0;
} else {
tmp = fma(z, -4.0, y) / y;
}
return tmp;
}
function code(x, y, z) t_0 = Float64(4.0 * Float64(x / y)) t_1 = Float64(Float64(4.0 * Float64(Float64(x + Float64(y * 0.75)) - z)) / y) tmp = 0.0 if (t_1 <= -50.0) tmp = t_0; elseif (t_1 <= 5e+17) tmp = 4.0; elseif (t_1 <= 1e+171) tmp = t_0; else tmp = Float64(fma(z, -4.0, y) / y); end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(4.0 * N[(x / y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(4.0 * N[(N[(x + N[(y * 0.75), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]}, If[LessEqual[t$95$1, -50.0], t$95$0, If[LessEqual[t$95$1, 5e+17], 4.0, If[LessEqual[t$95$1, 1e+171], t$95$0, N[(N[(z * -4.0 + y), $MachinePrecision] / y), $MachinePrecision]]]]]]
f(x, y, z): x in [-inf, +inf], y in [-inf, +inf], z in [-inf, +inf] code: THEORY BEGIN f(x, y, z: real): real = LET t_0 = ((4) * (x / y)) IN LET t_1 = (((4) * ((x + (y * (75e-2))) - z)) / y) IN LET tmp_2 = IF (t_1 <= (999999999999999953972206729656870211732987713739100709830741553196290713284945813208338477706166412373726001850053663010587168093173889073910282723323583537144858509574144)) THEN t_0 ELSE (((z * (-4)) + y) / y) ENDIF IN LET tmp_1 = IF (t_1 <= (5e17)) THEN (4) ELSE tmp_2 ENDIF IN LET tmp = IF (t_1 <= (-50)) THEN t_0 ELSE tmp_1 ENDIF IN tmp END code
\begin{array}{l}
t_0 := 4 \cdot \frac{x}{y}\\
t_1 := \frac{4 \cdot \left(\left(x + y \cdot 0.75\right) - z\right)}{y}\\
\mathbf{if}\;t\_1 \leq -50:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+17}:\\
\;\;\;\;4\\
\mathbf{elif}\;t\_1 \leq 10^{+171}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(z, -4, y\right)}{y}\\
\end{array}
if (/.f64 (*.f64 #s(literal 4 binary64) (-.f64 (+.f64 x (*.f64 y #s(literal 3/4 binary64))) z)) y) < -50 or 5e17 < (/.f64 (*.f64 #s(literal 4 binary64) (-.f64 (+.f64 x (*.f64 y #s(literal 3/4 binary64))) z)) y) < 9.9999999999999995e170Initial program 99.7%
Applied rewrites99.7%
Taylor expanded in y around 0
Applied rewrites67.0%
Applied rewrites66.9%
Taylor expanded in x around inf
Applied rewrites35.7%
if -50 < (/.f64 (*.f64 #s(literal 4 binary64) (-.f64 (+.f64 x (*.f64 y #s(literal 3/4 binary64))) z)) y) < 5e17Initial program 99.7%
Taylor expanded in y around inf
Applied rewrites34.2%
if 9.9999999999999995e170 < (/.f64 (*.f64 #s(literal 4 binary64) (-.f64 (+.f64 x (*.f64 y #s(literal 3/4 binary64))) z)) y) Initial program 99.7%
Applied rewrites99.7%
Taylor expanded in y around 0
Applied rewrites71.3%
Taylor expanded in x around 0
Applied rewrites40.1%
Applied rewrites40.1%
(FPCore (x y z)
:precision binary64
:pre TRUE
(let* ((t_0 (* 4.0 (/ x y)))
(t_1 (/ (* 4.0 (- (+ x (* y 0.75)) z)) y)))
(if (<= t_1 -50.0)
t_0
(if (<= t_1 5e+17)
4.0
(if (<= t_1 1e+171) t_0 (* -4.0 (/ z y)))))))double code(double x, double y, double z) {
double t_0 = 4.0 * (x / y);
double t_1 = (4.0 * ((x + (y * 0.75)) - z)) / y;
double tmp;
if (t_1 <= -50.0) {
tmp = t_0;
} else if (t_1 <= 5e+17) {
tmp = 4.0;
} else if (t_1 <= 1e+171) {
tmp = t_0;
} else {
tmp = -4.0 * (z / y);
}
return tmp;
}
real(8) function code(x, y, z)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = 4.0d0 * (x / y)
t_1 = (4.0d0 * ((x + (y * 0.75d0)) - z)) / y
if (t_1 <= (-50.0d0)) then
tmp = t_0
else if (t_1 <= 5d+17) then
tmp = 4.0d0
else if (t_1 <= 1d+171) then
tmp = t_0
else
tmp = (-4.0d0) * (z / y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = 4.0 * (x / y);
double t_1 = (4.0 * ((x + (y * 0.75)) - z)) / y;
double tmp;
if (t_1 <= -50.0) {
tmp = t_0;
} else if (t_1 <= 5e+17) {
tmp = 4.0;
} else if (t_1 <= 1e+171) {
tmp = t_0;
} else {
tmp = -4.0 * (z / y);
}
return tmp;
}
def code(x, y, z): t_0 = 4.0 * (x / y) t_1 = (4.0 * ((x + (y * 0.75)) - z)) / y tmp = 0 if t_1 <= -50.0: tmp = t_0 elif t_1 <= 5e+17: tmp = 4.0 elif t_1 <= 1e+171: tmp = t_0 else: tmp = -4.0 * (z / y) return tmp
function code(x, y, z) t_0 = Float64(4.0 * Float64(x / y)) t_1 = Float64(Float64(4.0 * Float64(Float64(x + Float64(y * 0.75)) - z)) / y) tmp = 0.0 if (t_1 <= -50.0) tmp = t_0; elseif (t_1 <= 5e+17) tmp = 4.0; elseif (t_1 <= 1e+171) tmp = t_0; else tmp = Float64(-4.0 * Float64(z / y)); end return tmp end
function tmp_2 = code(x, y, z) t_0 = 4.0 * (x / y); t_1 = (4.0 * ((x + (y * 0.75)) - z)) / y; tmp = 0.0; if (t_1 <= -50.0) tmp = t_0; elseif (t_1 <= 5e+17) tmp = 4.0; elseif (t_1 <= 1e+171) tmp = t_0; else tmp = -4.0 * (z / y); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(4.0 * N[(x / y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(4.0 * N[(N[(x + N[(y * 0.75), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]}, If[LessEqual[t$95$1, -50.0], t$95$0, If[LessEqual[t$95$1, 5e+17], 4.0, If[LessEqual[t$95$1, 1e+171], t$95$0, N[(-4.0 * N[(z / y), $MachinePrecision]), $MachinePrecision]]]]]]
f(x, y, z): x in [-inf, +inf], y in [-inf, +inf], z in [-inf, +inf] code: THEORY BEGIN f(x, y, z: real): real = LET t_0 = ((4) * (x / y)) IN LET t_1 = (((4) * ((x + (y * (75e-2))) - z)) / y) IN LET tmp_2 = IF (t_1 <= (999999999999999953972206729656870211732987713739100709830741553196290713284945813208338477706166412373726001850053663010587168093173889073910282723323583537144858509574144)) THEN t_0 ELSE ((-4) * (z / y)) ENDIF IN LET tmp_1 = IF (t_1 <= (5e17)) THEN (4) ELSE tmp_2 ENDIF IN LET tmp = IF (t_1 <= (-50)) THEN t_0 ELSE tmp_1 ENDIF IN tmp END code
\begin{array}{l}
t_0 := 4 \cdot \frac{x}{y}\\
t_1 := \frac{4 \cdot \left(\left(x + y \cdot 0.75\right) - z\right)}{y}\\
\mathbf{if}\;t\_1 \leq -50:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+17}:\\
\;\;\;\;4\\
\mathbf{elif}\;t\_1 \leq 10^{+171}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;-4 \cdot \frac{z}{y}\\
\end{array}
if (/.f64 (*.f64 #s(literal 4 binary64) (-.f64 (+.f64 x (*.f64 y #s(literal 3/4 binary64))) z)) y) < -50 or 5e17 < (/.f64 (*.f64 #s(literal 4 binary64) (-.f64 (+.f64 x (*.f64 y #s(literal 3/4 binary64))) z)) y) < 9.9999999999999995e170Initial program 99.7%
Applied rewrites99.7%
Taylor expanded in y around 0
Applied rewrites67.0%
Applied rewrites66.9%
Taylor expanded in x around inf
Applied rewrites35.7%
if -50 < (/.f64 (*.f64 #s(literal 4 binary64) (-.f64 (+.f64 x (*.f64 y #s(literal 3/4 binary64))) z)) y) < 5e17Initial program 99.7%
Taylor expanded in y around inf
Applied rewrites34.2%
if 9.9999999999999995e170 < (/.f64 (*.f64 #s(literal 4 binary64) (-.f64 (+.f64 x (*.f64 y #s(literal 3/4 binary64))) z)) y) Initial program 99.7%
Applied rewrites99.7%
Taylor expanded in y around 0
Applied rewrites67.0%
Taylor expanded in x around 0
Applied rewrites35.5%
(FPCore (x y z)
:precision binary64
:pre TRUE
(let* ((t_0 (* 4.0 (/ x y)))
(t_1 (/ (* 4.0 (- (+ x (* y 0.75)) z)) y)))
(if (<= t_1 -50.0) t_0 (if (<= t_1 5e+17) 4.0 t_0))))double code(double x, double y, double z) {
double t_0 = 4.0 * (x / y);
double t_1 = (4.0 * ((x + (y * 0.75)) - z)) / y;
double tmp;
if (t_1 <= -50.0) {
tmp = t_0;
} else if (t_1 <= 5e+17) {
tmp = 4.0;
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(x, y, z)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = 4.0d0 * (x / y)
t_1 = (4.0d0 * ((x + (y * 0.75d0)) - z)) / y
if (t_1 <= (-50.0d0)) then
tmp = t_0
else if (t_1 <= 5d+17) then
tmp = 4.0d0
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = 4.0 * (x / y);
double t_1 = (4.0 * ((x + (y * 0.75)) - z)) / y;
double tmp;
if (t_1 <= -50.0) {
tmp = t_0;
} else if (t_1 <= 5e+17) {
tmp = 4.0;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = 4.0 * (x / y) t_1 = (4.0 * ((x + (y * 0.75)) - z)) / y tmp = 0 if t_1 <= -50.0: tmp = t_0 elif t_1 <= 5e+17: tmp = 4.0 else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(4.0 * Float64(x / y)) t_1 = Float64(Float64(4.0 * Float64(Float64(x + Float64(y * 0.75)) - z)) / y) tmp = 0.0 if (t_1 <= -50.0) tmp = t_0; elseif (t_1 <= 5e+17) tmp = 4.0; else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = 4.0 * (x / y); t_1 = (4.0 * ((x + (y * 0.75)) - z)) / y; tmp = 0.0; if (t_1 <= -50.0) tmp = t_0; elseif (t_1 <= 5e+17) tmp = 4.0; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(4.0 * N[(x / y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(4.0 * N[(N[(x + N[(y * 0.75), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]}, If[LessEqual[t$95$1, -50.0], t$95$0, If[LessEqual[t$95$1, 5e+17], 4.0, t$95$0]]]]
f(x, y, z): x in [-inf, +inf], y in [-inf, +inf], z in [-inf, +inf] code: THEORY BEGIN f(x, y, z: real): real = LET t_0 = ((4) * (x / y)) IN LET t_1 = (((4) * ((x + (y * (75e-2))) - z)) / y) IN LET tmp_1 = IF (t_1 <= (5e17)) THEN (4) ELSE t_0 ENDIF IN LET tmp = IF (t_1 <= (-50)) THEN t_0 ELSE tmp_1 ENDIF IN tmp END code
\begin{array}{l}
t_0 := 4 \cdot \frac{x}{y}\\
t_1 := \frac{4 \cdot \left(\left(x + y \cdot 0.75\right) - z\right)}{y}\\
\mathbf{if}\;t\_1 \leq -50:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+17}:\\
\;\;\;\;4\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
if (/.f64 (*.f64 #s(literal 4 binary64) (-.f64 (+.f64 x (*.f64 y #s(literal 3/4 binary64))) z)) y) < -50 or 5e17 < (/.f64 (*.f64 #s(literal 4 binary64) (-.f64 (+.f64 x (*.f64 y #s(literal 3/4 binary64))) z)) y) Initial program 99.7%
Applied rewrites99.7%
Taylor expanded in y around 0
Applied rewrites67.0%
Applied rewrites66.9%
Taylor expanded in x around inf
Applied rewrites35.7%
if -50 < (/.f64 (*.f64 #s(literal 4 binary64) (-.f64 (+.f64 x (*.f64 y #s(literal 3/4 binary64))) z)) y) < 5e17Initial program 99.7%
Taylor expanded in y around inf
Applied rewrites34.2%
(FPCore (x y z) :precision binary64 :pre TRUE 4.0)
double code(double x, double y, double z) {
return 4.0;
}
real(8) function code(x, y, z)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = 4.0d0
end function
public static double code(double x, double y, double z) {
return 4.0;
}
def code(x, y, z): return 4.0
function code(x, y, z) return 4.0 end
function tmp = code(x, y, z) tmp = 4.0; end
code[x_, y_, z_] := 4.0
f(x, y, z): x in [-inf, +inf], y in [-inf, +inf], z in [-inf, +inf] code: THEORY BEGIN f(x, y, z: real): real = 4 END code
4
Initial program 99.7%
Taylor expanded in y around inf
Applied rewrites34.2%
herbie shell --seed 2026092
(FPCore (x y z)
:name "Data.Array.Repa.Algorithms.ColorRamp:rampColorHotToCold from repa-algorithms-3.4.0.1, A"
:precision binary64
(+ 1.0 (/ (* 4.0 (- (+ x (* y 0.75)) z)) y)))