
(FPCore (z1 z0) :precision binary64 (sin (* z1 (- z0 1.0))))
double code(double z1, double z0) {
return sin((z1 * (z0 - 1.0)));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(z1, z0)
use fmin_fmax_functions
real(8), intent (in) :: z1
real(8), intent (in) :: z0
code = sin((z1 * (z0 - 1.0d0)))
end function
public static double code(double z1, double z0) {
return Math.sin((z1 * (z0 - 1.0)));
}
def code(z1, z0): return math.sin((z1 * (z0 - 1.0)))
function code(z1, z0) return sin(Float64(z1 * Float64(z0 - 1.0))) end
function tmp = code(z1, z0) tmp = sin((z1 * (z0 - 1.0))); end
code[z1_, z0_] := N[Sin[N[(z1 * N[(z0 - 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\sin \left(z1 \cdot \left(z0 - 1\right)\right)
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (z1 z0) :precision binary64 (sin (* z1 (- z0 1.0))))
double code(double z1, double z0) {
return sin((z1 * (z0 - 1.0)));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(z1, z0)
use fmin_fmax_functions
real(8), intent (in) :: z1
real(8), intent (in) :: z0
code = sin((z1 * (z0 - 1.0d0)))
end function
public static double code(double z1, double z0) {
return Math.sin((z1 * (z0 - 1.0)));
}
def code(z1, z0): return math.sin((z1 * (z0 - 1.0)))
function code(z1, z0) return sin(Float64(z1 * Float64(z0 - 1.0))) end
function tmp = code(z1, z0) tmp = sin((z1 * (z0 - 1.0))); end
code[z1_, z0_] := N[Sin[N[(z1 * N[(z0 - 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\sin \left(z1 \cdot \left(z0 - 1\right)\right)
(FPCore (z1 z0)
:precision binary64
(if (<= (sin (* z1 (- z0 1.0))) 0.999)
(-
(* (sin (* z1 z0)) (cos z1))
(*
(sin
(*
(+ 1.0 (/ (/ (* (* z0 z1) 2.0) (cbrt (* PI PI))) (cbrt PI)))
(* 0.5 PI)))
(sin z1)))
(sin (* z1 (/ (- (- 0.25 z0) 0.25) (+ (- z0 0.5) 0.5))))))double code(double z1, double z0) {
double tmp;
if (sin((z1 * (z0 - 1.0))) <= 0.999) {
tmp = (sin((z1 * z0)) * cos(z1)) - (sin(((1.0 + ((((z0 * z1) * 2.0) / cbrt((((double) M_PI) * ((double) M_PI)))) / cbrt(((double) M_PI)))) * (0.5 * ((double) M_PI)))) * sin(z1));
} else {
tmp = sin((z1 * (((0.25 - z0) - 0.25) / ((z0 - 0.5) + 0.5))));
}
return tmp;
}
public static double code(double z1, double z0) {
double tmp;
if (Math.sin((z1 * (z0 - 1.0))) <= 0.999) {
tmp = (Math.sin((z1 * z0)) * Math.cos(z1)) - (Math.sin(((1.0 + ((((z0 * z1) * 2.0) / Math.cbrt((Math.PI * Math.PI))) / Math.cbrt(Math.PI))) * (0.5 * Math.PI))) * Math.sin(z1));
} else {
tmp = Math.sin((z1 * (((0.25 - z0) - 0.25) / ((z0 - 0.5) + 0.5))));
}
return tmp;
}
function code(z1, z0) tmp = 0.0 if (sin(Float64(z1 * Float64(z0 - 1.0))) <= 0.999) tmp = Float64(Float64(sin(Float64(z1 * z0)) * cos(z1)) - Float64(sin(Float64(Float64(1.0 + Float64(Float64(Float64(Float64(z0 * z1) * 2.0) / cbrt(Float64(pi * pi))) / cbrt(pi))) * Float64(0.5 * pi))) * sin(z1))); else tmp = sin(Float64(z1 * Float64(Float64(Float64(0.25 - z0) - 0.25) / Float64(Float64(z0 - 0.5) + 0.5)))); end return tmp end
code[z1_, z0_] := If[LessEqual[N[Sin[N[(z1 * N[(z0 - 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 0.999], N[(N[(N[Sin[N[(z1 * z0), $MachinePrecision]], $MachinePrecision] * N[Cos[z1], $MachinePrecision]), $MachinePrecision] - N[(N[Sin[N[(N[(1.0 + N[(N[(N[(N[(z0 * z1), $MachinePrecision] * 2.0), $MachinePrecision] / N[Power[N[(Pi * Pi), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision] / N[Power[Pi, 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(0.5 * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sin[z1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[N[(z1 * N[(N[(N[(0.25 - z0), $MachinePrecision] - 0.25), $MachinePrecision] / N[(N[(z0 - 0.5), $MachinePrecision] + 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;\sin \left(z1 \cdot \left(z0 - 1\right)\right) \leq 0.999:\\
\;\;\;\;\sin \left(z1 \cdot z0\right) \cdot \cos z1 - \sin \left(\left(1 + \frac{\frac{\left(z0 \cdot z1\right) \cdot 2}{\sqrt[3]{\pi \cdot \pi}}}{\sqrt[3]{\pi}}\right) \cdot \left(0.5 \cdot \pi\right)\right) \cdot \sin z1\\
\mathbf{else}:\\
\;\;\;\;\sin \left(z1 \cdot \frac{\left(0.25 - z0\right) - 0.25}{\left(z0 - 0.5\right) + 0.5}\right)\\
\end{array}
if (sin.f64 (*.f64 z1 (-.f64 z0 #s(literal 1 binary64)))) < 0.999Initial program 53.8%
Applied rewrites54.9%
lift-cos.f64N/A
sin-+PI/2-revN/A
lower-sin.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift-PI.f64N/A
mult-flipN/A
metadata-evalN/A
lower-*.f6454.8%
lift-*.f64N/A
*-commutativeN/A
lift-*.f6454.8%
Applied rewrites54.8%
lift-+.f64N/A
sum-to-multN/A
lift-*.f64N/A
metadata-evalN/A
mult-flipN/A
lift-PI.f64N/A
lower-unsound-*.f64N/A
lower-unsound-+.f64N/A
lift-*.f64N/A
metadata-evalN/A
mult-flipN/A
lift-PI.f64N/A
lower-unsound-/.f64N/A
lift-PI.f64N/A
mult-flipN/A
metadata-evalN/A
*-commutativeN/A
lower-*.f64N/A
lift-PI.f64N/A
mult-flipN/A
metadata-evalN/A
*-commutativeN/A
lower-*.f6454.8%
Applied rewrites54.8%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lift-PI.f64N/A
add-cube-cbrtN/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites54.8%
if 0.999 < (sin.f64 (*.f64 z1 (-.f64 z0 #s(literal 1 binary64)))) Initial program 53.8%
lift--.f64N/A
*-inversesN/A
1-expN/A
metadata-evalN/A
1-expN/A
div-addN/A
associate--r+N/A
flip--N/A
lower-unsound-/.f64N/A
Applied rewrites12.4%
Taylor expanded in z0 around 0
metadata-evalN/A
lower-+.f64N/A
metadata-evalN/A
lower-*.f644.6%
Applied rewrites4.6%
lift-+.f64N/A
metadata-evalN/A
lift-*.f64N/A
lift-*.f64N/A
mul-1-negN/A
sub-flip-reverseN/A
lower--.f644.6%
lift-*.f64N/A
metadata-eval4.6%
metadata-evalN/A
metadata-evalN/A
Applied rewrites4.6%
(FPCore (z1 z0)
:precision binary64
(let* ((t_0 (* (fabs z1) z0)))
(*
(copysign 1.0 z1)
(if (<= (sin (* (fabs z1) (- z0 1.0))) 0.8)
(- (* (sin t_0) (cos (fabs z1))) (* (cos t_0) (sin (fabs z1))))
(sin (* (fabs z1) -1.0))))))double code(double z1, double z0) {
double t_0 = fabs(z1) * z0;
double tmp;
if (sin((fabs(z1) * (z0 - 1.0))) <= 0.8) {
tmp = (sin(t_0) * cos(fabs(z1))) - (cos(t_0) * sin(fabs(z1)));
} else {
tmp = sin((fabs(z1) * -1.0));
}
return copysign(1.0, z1) * tmp;
}
public static double code(double z1, double z0) {
double t_0 = Math.abs(z1) * z0;
double tmp;
if (Math.sin((Math.abs(z1) * (z0 - 1.0))) <= 0.8) {
tmp = (Math.sin(t_0) * Math.cos(Math.abs(z1))) - (Math.cos(t_0) * Math.sin(Math.abs(z1)));
} else {
tmp = Math.sin((Math.abs(z1) * -1.0));
}
return Math.copySign(1.0, z1) * tmp;
}
def code(z1, z0): t_0 = math.fabs(z1) * z0 tmp = 0 if math.sin((math.fabs(z1) * (z0 - 1.0))) <= 0.8: tmp = (math.sin(t_0) * math.cos(math.fabs(z1))) - (math.cos(t_0) * math.sin(math.fabs(z1))) else: tmp = math.sin((math.fabs(z1) * -1.0)) return math.copysign(1.0, z1) * tmp
function code(z1, z0) t_0 = Float64(abs(z1) * z0) tmp = 0.0 if (sin(Float64(abs(z1) * Float64(z0 - 1.0))) <= 0.8) tmp = Float64(Float64(sin(t_0) * cos(abs(z1))) - Float64(cos(t_0) * sin(abs(z1)))); else tmp = sin(Float64(abs(z1) * -1.0)); end return Float64(copysign(1.0, z1) * tmp) end
function tmp_2 = code(z1, z0) t_0 = abs(z1) * z0; tmp = 0.0; if (sin((abs(z1) * (z0 - 1.0))) <= 0.8) tmp = (sin(t_0) * cos(abs(z1))) - (cos(t_0) * sin(abs(z1))); else tmp = sin((abs(z1) * -1.0)); end tmp_2 = (sign(z1) * abs(1.0)) * tmp; end
code[z1_, z0_] := Block[{t$95$0 = N[(N[Abs[z1], $MachinePrecision] * z0), $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z1]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[Sin[N[(N[Abs[z1], $MachinePrecision] * N[(z0 - 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 0.8], N[(N[(N[Sin[t$95$0], $MachinePrecision] * N[Cos[N[Abs[z1], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(N[Cos[t$95$0], $MachinePrecision] * N[Sin[N[Abs[z1], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[N[(N[Abs[z1], $MachinePrecision] * -1.0), $MachinePrecision]], $MachinePrecision]]), $MachinePrecision]]
\begin{array}{l}
t_0 := \left|z1\right| \cdot z0\\
\mathsf{copysign}\left(1, z1\right) \cdot \begin{array}{l}
\mathbf{if}\;\sin \left(\left|z1\right| \cdot \left(z0 - 1\right)\right) \leq 0.8:\\
\;\;\;\;\sin t\_0 \cdot \cos \left(\left|z1\right|\right) - \cos t\_0 \cdot \sin \left(\left|z1\right|\right)\\
\mathbf{else}:\\
\;\;\;\;\sin \left(\left|z1\right| \cdot -1\right)\\
\end{array}
\end{array}
if (sin.f64 (*.f64 z1 (-.f64 z0 #s(literal 1 binary64)))) < 0.80000000000000004Initial program 53.8%
Applied rewrites54.9%
if 0.80000000000000004 < (sin.f64 (*.f64 z1 (-.f64 z0 #s(literal 1 binary64)))) Initial program 53.8%
Taylor expanded in z0 around 0
Applied rewrites41.2%
(FPCore (z1 z0)
:precision binary64
(let* ((t_0 (/ (- E) z0)))
(*
(copysign 1.0 z1)
(if (<= (sin (* (fabs z1) (- z0 1.0))) 0.995)
(sin (* (fabs z1) (/ (* z0 (* (+ 1.0 (/ E t_0)) t_0)) E)))
(+
(* (cos (fabs z1)) (sin PI))
(* (cos PI) (sin (- PI (fabs z1)))))))))double code(double z1, double z0) {
double t_0 = -((double) M_E) / z0;
double tmp;
if (sin((fabs(z1) * (z0 - 1.0))) <= 0.995) {
tmp = sin((fabs(z1) * ((z0 * ((1.0 + (((double) M_E) / t_0)) * t_0)) / ((double) M_E))));
} else {
tmp = (cos(fabs(z1)) * sin(((double) M_PI))) + (cos(((double) M_PI)) * sin((((double) M_PI) - fabs(z1))));
}
return copysign(1.0, z1) * tmp;
}
public static double code(double z1, double z0) {
double t_0 = -Math.E / z0;
double tmp;
if (Math.sin((Math.abs(z1) * (z0 - 1.0))) <= 0.995) {
tmp = Math.sin((Math.abs(z1) * ((z0 * ((1.0 + (Math.E / t_0)) * t_0)) / Math.E)));
} else {
tmp = (Math.cos(Math.abs(z1)) * Math.sin(Math.PI)) + (Math.cos(Math.PI) * Math.sin((Math.PI - Math.abs(z1))));
}
return Math.copySign(1.0, z1) * tmp;
}
def code(z1, z0): t_0 = -math.e / z0 tmp = 0 if math.sin((math.fabs(z1) * (z0 - 1.0))) <= 0.995: tmp = math.sin((math.fabs(z1) * ((z0 * ((1.0 + (math.e / t_0)) * t_0)) / math.e))) else: tmp = (math.cos(math.fabs(z1)) * math.sin(math.pi)) + (math.cos(math.pi) * math.sin((math.pi - math.fabs(z1)))) return math.copysign(1.0, z1) * tmp
function code(z1, z0) t_0 = Float64(Float64(-exp(1)) / z0) tmp = 0.0 if (sin(Float64(abs(z1) * Float64(z0 - 1.0))) <= 0.995) tmp = sin(Float64(abs(z1) * Float64(Float64(z0 * Float64(Float64(1.0 + Float64(exp(1) / t_0)) * t_0)) / exp(1)))); else tmp = Float64(Float64(cos(abs(z1)) * sin(pi)) + Float64(cos(pi) * sin(Float64(pi - abs(z1))))); end return Float64(copysign(1.0, z1) * tmp) end
function tmp_2 = code(z1, z0) t_0 = -2.71828182845904523536 / z0; tmp = 0.0; if (sin((abs(z1) * (z0 - 1.0))) <= 0.995) tmp = sin((abs(z1) * ((z0 * ((1.0 + (2.71828182845904523536 / t_0)) * t_0)) / 2.71828182845904523536))); else tmp = (cos(abs(z1)) * sin(pi)) + (cos(pi) * sin((pi - abs(z1)))); end tmp_2 = (sign(z1) * abs(1.0)) * tmp; end
code[z1_, z0_] := Block[{t$95$0 = N[((-E) / z0), $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z1]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[Sin[N[(N[Abs[z1], $MachinePrecision] * N[(z0 - 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 0.995], N[Sin[N[(N[Abs[z1], $MachinePrecision] * N[(N[(z0 * N[(N[(1.0 + N[(E / t$95$0), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision] / E), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(N[(N[Cos[N[Abs[z1], $MachinePrecision]], $MachinePrecision] * N[Sin[Pi], $MachinePrecision]), $MachinePrecision] + N[(N[Cos[Pi], $MachinePrecision] * N[Sin[N[(Pi - N[Abs[z1], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]]
\begin{array}{l}
t_0 := \frac{-e}{z0}\\
\mathsf{copysign}\left(1, z1\right) \cdot \begin{array}{l}
\mathbf{if}\;\sin \left(\left|z1\right| \cdot \left(z0 - 1\right)\right) \leq 0.995:\\
\;\;\;\;\sin \left(\left|z1\right| \cdot \frac{z0 \cdot \left(\left(1 + \frac{e}{t\_0}\right) \cdot t\_0\right)}{e}\right)\\
\mathbf{else}:\\
\;\;\;\;\cos \left(\left|z1\right|\right) \cdot \sin \pi + \cos \pi \cdot \sin \left(\pi - \left|z1\right|\right)\\
\end{array}
\end{array}
if (sin.f64 (*.f64 z1 (-.f64 z0 #s(literal 1 binary64)))) < 0.995Initial program 53.8%
lift--.f64N/A
sub-negate-revN/A
sub-flipN/A
add-flipN/A
sub-negateN/A
remove-double-negN/A
1-expN/A
metadata-evalN/A
exp-diffN/A
sub-to-fractionN/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
exp-1-eN/A
lower-E.f64N/A
exp-1-eN/A
lower-E.f64N/A
exp-1-eN/A
lower-E.f6453.8%
Applied rewrites53.8%
Taylor expanded in z0 around inf
lower-*.f64N/A
lower-+.f64N/A
lower-E.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-E.f6453.3%
Applied rewrites53.3%
lift-+.f64N/A
+-commutativeN/A
sum-to-multN/A
lower-unsound-*.f64N/A
lower-unsound-+.f64N/A
lower-unsound-/.f6453.3%
lift-*.f64N/A
mul-1-negN/A
lift-/.f64N/A
distribute-neg-fracN/A
lower-/.f64N/A
lower-neg.f6453.3%
lift-*.f64N/A
mul-1-negN/A
lift-/.f64N/A
distribute-neg-fracN/A
lower-/.f64N/A
lower-neg.f6453.3%
Applied rewrites53.3%
if 0.995 < (sin.f64 (*.f64 z1 (-.f64 z0 #s(literal 1 binary64)))) Initial program 53.8%
lift-sin.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
sub-negate-revN/A
distribute-lft-neg-outN/A
sin-negN/A
sin-+PI-revN/A
sin-sumN/A
lower-+.f64N/A
Applied rewrites18.9%
lift-sin.f64N/A
lift-*.f64N/A
lift--.f64N/A
sub-negate-revN/A
distribute-rgt-neg-outN/A
sub-negate-revN/A
lift--.f64N/A
distribute-rgt-neg-outN/A
lift-*.f64N/A
sin-negN/A
sin-neg-revN/A
sin-+PIN/A
lift-PI.f64N/A
sin-sum-revN/A
lift-sin.f64N/A
lift-cos.f64N/A
lift-*.f64N/A
lift-cos.f64N/A
Applied rewrites8.8%
Taylor expanded in z0 around 0
lower-+.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f64N/A
lower-PI.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-PI.f64N/A
lower-sin.f64N/A
lower--.f64N/A
lower-PI.f647.8%
Applied rewrites7.8%
(FPCore (z1 z0)
:precision binary64
(let* ((t_0 (/ (- E) z0)))
(*
(copysign 1.0 z1)
(if (<= (sin (* (fabs z1) (- z0 1.0))) 0.999)
(sin (* (fabs z1) (/ (* z0 (* (+ 1.0 (/ E t_0)) t_0)) E)))
(sin
(* (fabs z1) (/ (- (- 0.25 z0) 0.25) (+ (- z0 0.5) 0.5))))))))double code(double z1, double z0) {
double t_0 = -((double) M_E) / z0;
double tmp;
if (sin((fabs(z1) * (z0 - 1.0))) <= 0.999) {
tmp = sin((fabs(z1) * ((z0 * ((1.0 + (((double) M_E) / t_0)) * t_0)) / ((double) M_E))));
} else {
tmp = sin((fabs(z1) * (((0.25 - z0) - 0.25) / ((z0 - 0.5) + 0.5))));
}
return copysign(1.0, z1) * tmp;
}
public static double code(double z1, double z0) {
double t_0 = -Math.E / z0;
double tmp;
if (Math.sin((Math.abs(z1) * (z0 - 1.0))) <= 0.999) {
tmp = Math.sin((Math.abs(z1) * ((z0 * ((1.0 + (Math.E / t_0)) * t_0)) / Math.E)));
} else {
tmp = Math.sin((Math.abs(z1) * (((0.25 - z0) - 0.25) / ((z0 - 0.5) + 0.5))));
}
return Math.copySign(1.0, z1) * tmp;
}
def code(z1, z0): t_0 = -math.e / z0 tmp = 0 if math.sin((math.fabs(z1) * (z0 - 1.0))) <= 0.999: tmp = math.sin((math.fabs(z1) * ((z0 * ((1.0 + (math.e / t_0)) * t_0)) / math.e))) else: tmp = math.sin((math.fabs(z1) * (((0.25 - z0) - 0.25) / ((z0 - 0.5) + 0.5)))) return math.copysign(1.0, z1) * tmp
function code(z1, z0) t_0 = Float64(Float64(-exp(1)) / z0) tmp = 0.0 if (sin(Float64(abs(z1) * Float64(z0 - 1.0))) <= 0.999) tmp = sin(Float64(abs(z1) * Float64(Float64(z0 * Float64(Float64(1.0 + Float64(exp(1) / t_0)) * t_0)) / exp(1)))); else tmp = sin(Float64(abs(z1) * Float64(Float64(Float64(0.25 - z0) - 0.25) / Float64(Float64(z0 - 0.5) + 0.5)))); end return Float64(copysign(1.0, z1) * tmp) end
function tmp_2 = code(z1, z0) t_0 = -2.71828182845904523536 / z0; tmp = 0.0; if (sin((abs(z1) * (z0 - 1.0))) <= 0.999) tmp = sin((abs(z1) * ((z0 * ((1.0 + (2.71828182845904523536 / t_0)) * t_0)) / 2.71828182845904523536))); else tmp = sin((abs(z1) * (((0.25 - z0) - 0.25) / ((z0 - 0.5) + 0.5)))); end tmp_2 = (sign(z1) * abs(1.0)) * tmp; end
code[z1_, z0_] := Block[{t$95$0 = N[((-E) / z0), $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z1]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[Sin[N[(N[Abs[z1], $MachinePrecision] * N[(z0 - 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 0.999], N[Sin[N[(N[Abs[z1], $MachinePrecision] * N[(N[(z0 * N[(N[(1.0 + N[(E / t$95$0), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision] / E), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Sin[N[(N[Abs[z1], $MachinePrecision] * N[(N[(N[(0.25 - z0), $MachinePrecision] - 0.25), $MachinePrecision] / N[(N[(z0 - 0.5), $MachinePrecision] + 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]), $MachinePrecision]]
\begin{array}{l}
t_0 := \frac{-e}{z0}\\
\mathsf{copysign}\left(1, z1\right) \cdot \begin{array}{l}
\mathbf{if}\;\sin \left(\left|z1\right| \cdot \left(z0 - 1\right)\right) \leq 0.999:\\
\;\;\;\;\sin \left(\left|z1\right| \cdot \frac{z0 \cdot \left(\left(1 + \frac{e}{t\_0}\right) \cdot t\_0\right)}{e}\right)\\
\mathbf{else}:\\
\;\;\;\;\sin \left(\left|z1\right| \cdot \frac{\left(0.25 - z0\right) - 0.25}{\left(z0 - 0.5\right) + 0.5}\right)\\
\end{array}
\end{array}
if (sin.f64 (*.f64 z1 (-.f64 z0 #s(literal 1 binary64)))) < 0.999Initial program 53.8%
lift--.f64N/A
sub-negate-revN/A
sub-flipN/A
add-flipN/A
sub-negateN/A
remove-double-negN/A
1-expN/A
metadata-evalN/A
exp-diffN/A
sub-to-fractionN/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
exp-1-eN/A
lower-E.f64N/A
exp-1-eN/A
lower-E.f64N/A
exp-1-eN/A
lower-E.f6453.8%
Applied rewrites53.8%
Taylor expanded in z0 around inf
lower-*.f64N/A
lower-+.f64N/A
lower-E.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-E.f6453.3%
Applied rewrites53.3%
lift-+.f64N/A
+-commutativeN/A
sum-to-multN/A
lower-unsound-*.f64N/A
lower-unsound-+.f64N/A
lower-unsound-/.f6453.3%
lift-*.f64N/A
mul-1-negN/A
lift-/.f64N/A
distribute-neg-fracN/A
lower-/.f64N/A
lower-neg.f6453.3%
lift-*.f64N/A
mul-1-negN/A
lift-/.f64N/A
distribute-neg-fracN/A
lower-/.f64N/A
lower-neg.f6453.3%
Applied rewrites53.3%
if 0.999 < (sin.f64 (*.f64 z1 (-.f64 z0 #s(literal 1 binary64)))) Initial program 53.8%
lift--.f64N/A
*-inversesN/A
1-expN/A
metadata-evalN/A
1-expN/A
div-addN/A
associate--r+N/A
flip--N/A
lower-unsound-/.f64N/A
Applied rewrites12.4%
Taylor expanded in z0 around 0
metadata-evalN/A
lower-+.f64N/A
metadata-evalN/A
lower-*.f644.6%
Applied rewrites4.6%
lift-+.f64N/A
metadata-evalN/A
lift-*.f64N/A
lift-*.f64N/A
mul-1-negN/A
sub-flip-reverseN/A
lower--.f644.6%
lift-*.f64N/A
metadata-eval4.6%
metadata-evalN/A
metadata-evalN/A
Applied rewrites4.6%
(FPCore (z1 z0) :precision binary64 (* (copysign 1.0 z1) (if (<= (sin (* (fabs z1) (- z0 1.0))) 0.999) (sin (* (fabs z1) (/ (* z0 (+ E (* -1.0 (/ E z0)))) E))) (sin (* (fabs z1) (/ (- (- 0.25 z0) 0.25) (+ (- z0 0.5) 0.5)))))))
double code(double z1, double z0) {
double tmp;
if (sin((fabs(z1) * (z0 - 1.0))) <= 0.999) {
tmp = sin((fabs(z1) * ((z0 * (((double) M_E) + (-1.0 * (((double) M_E) / z0)))) / ((double) M_E))));
} else {
tmp = sin((fabs(z1) * (((0.25 - z0) - 0.25) / ((z0 - 0.5) + 0.5))));
}
return copysign(1.0, z1) * tmp;
}
public static double code(double z1, double z0) {
double tmp;
if (Math.sin((Math.abs(z1) * (z0 - 1.0))) <= 0.999) {
tmp = Math.sin((Math.abs(z1) * ((z0 * (Math.E + (-1.0 * (Math.E / z0)))) / Math.E)));
} else {
tmp = Math.sin((Math.abs(z1) * (((0.25 - z0) - 0.25) / ((z0 - 0.5) + 0.5))));
}
return Math.copySign(1.0, z1) * tmp;
}
def code(z1, z0): tmp = 0 if math.sin((math.fabs(z1) * (z0 - 1.0))) <= 0.999: tmp = math.sin((math.fabs(z1) * ((z0 * (math.e + (-1.0 * (math.e / z0)))) / math.e))) else: tmp = math.sin((math.fabs(z1) * (((0.25 - z0) - 0.25) / ((z0 - 0.5) + 0.5)))) return math.copysign(1.0, z1) * tmp
function code(z1, z0) tmp = 0.0 if (sin(Float64(abs(z1) * Float64(z0 - 1.0))) <= 0.999) tmp = sin(Float64(abs(z1) * Float64(Float64(z0 * Float64(exp(1) + Float64(-1.0 * Float64(exp(1) / z0)))) / exp(1)))); else tmp = sin(Float64(abs(z1) * Float64(Float64(Float64(0.25 - z0) - 0.25) / Float64(Float64(z0 - 0.5) + 0.5)))); end return Float64(copysign(1.0, z1) * tmp) end
function tmp_2 = code(z1, z0) tmp = 0.0; if (sin((abs(z1) * (z0 - 1.0))) <= 0.999) tmp = sin((abs(z1) * ((z0 * (2.71828182845904523536 + (-1.0 * (2.71828182845904523536 / z0)))) / 2.71828182845904523536))); else tmp = sin((abs(z1) * (((0.25 - z0) - 0.25) / ((z0 - 0.5) + 0.5)))); end tmp_2 = (sign(z1) * abs(1.0)) * tmp; end
code[z1_, z0_] := N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z1]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[Sin[N[(N[Abs[z1], $MachinePrecision] * N[(z0 - 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 0.999], N[Sin[N[(N[Abs[z1], $MachinePrecision] * N[(N[(z0 * N[(E + N[(-1.0 * N[(E / z0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / E), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Sin[N[(N[Abs[z1], $MachinePrecision] * N[(N[(N[(0.25 - z0), $MachinePrecision] - 0.25), $MachinePrecision] / N[(N[(z0 - 0.5), $MachinePrecision] + 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]), $MachinePrecision]
\mathsf{copysign}\left(1, z1\right) \cdot \begin{array}{l}
\mathbf{if}\;\sin \left(\left|z1\right| \cdot \left(z0 - 1\right)\right) \leq 0.999:\\
\;\;\;\;\sin \left(\left|z1\right| \cdot \frac{z0 \cdot \left(e + -1 \cdot \frac{e}{z0}\right)}{e}\right)\\
\mathbf{else}:\\
\;\;\;\;\sin \left(\left|z1\right| \cdot \frac{\left(0.25 - z0\right) - 0.25}{\left(z0 - 0.5\right) + 0.5}\right)\\
\end{array}
if (sin.f64 (*.f64 z1 (-.f64 z0 #s(literal 1 binary64)))) < 0.999Initial program 53.8%
lift--.f64N/A
sub-negate-revN/A
sub-flipN/A
add-flipN/A
sub-negateN/A
remove-double-negN/A
1-expN/A
metadata-evalN/A
exp-diffN/A
sub-to-fractionN/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
exp-1-eN/A
lower-E.f64N/A
exp-1-eN/A
lower-E.f64N/A
exp-1-eN/A
lower-E.f6453.8%
Applied rewrites53.8%
Taylor expanded in z0 around inf
lower-*.f64N/A
lower-+.f64N/A
lower-E.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-E.f6453.3%
Applied rewrites53.3%
if 0.999 < (sin.f64 (*.f64 z1 (-.f64 z0 #s(literal 1 binary64)))) Initial program 53.8%
lift--.f64N/A
*-inversesN/A
1-expN/A
metadata-evalN/A
1-expN/A
div-addN/A
associate--r+N/A
flip--N/A
lower-unsound-/.f64N/A
Applied rewrites12.4%
Taylor expanded in z0 around 0
metadata-evalN/A
lower-+.f64N/A
metadata-evalN/A
lower-*.f644.6%
Applied rewrites4.6%
lift-+.f64N/A
metadata-evalN/A
lift-*.f64N/A
lift-*.f64N/A
mul-1-negN/A
sub-flip-reverseN/A
lower--.f644.6%
lift-*.f64N/A
metadata-eval4.6%
metadata-evalN/A
metadata-evalN/A
Applied rewrites4.6%
(FPCore (z1 z0) :precision binary64 (* (copysign 1.0 z1) (if (<= (sin (* (fabs z1) (- z0 1.0))) 0.999) (sin (* (fabs z1) (/ (- (* z0 E) E) E))) (sin (* (fabs z1) -1.0)))))
double code(double z1, double z0) {
double tmp;
if (sin((fabs(z1) * (z0 - 1.0))) <= 0.999) {
tmp = sin((fabs(z1) * (((z0 * ((double) M_E)) - ((double) M_E)) / ((double) M_E))));
} else {
tmp = sin((fabs(z1) * -1.0));
}
return copysign(1.0, z1) * tmp;
}
public static double code(double z1, double z0) {
double tmp;
if (Math.sin((Math.abs(z1) * (z0 - 1.0))) <= 0.999) {
tmp = Math.sin((Math.abs(z1) * (((z0 * Math.E) - Math.E) / Math.E)));
} else {
tmp = Math.sin((Math.abs(z1) * -1.0));
}
return Math.copySign(1.0, z1) * tmp;
}
def code(z1, z0): tmp = 0 if math.sin((math.fabs(z1) * (z0 - 1.0))) <= 0.999: tmp = math.sin((math.fabs(z1) * (((z0 * math.e) - math.e) / math.e))) else: tmp = math.sin((math.fabs(z1) * -1.0)) return math.copysign(1.0, z1) * tmp
function code(z1, z0) tmp = 0.0 if (sin(Float64(abs(z1) * Float64(z0 - 1.0))) <= 0.999) tmp = sin(Float64(abs(z1) * Float64(Float64(Float64(z0 * exp(1)) - exp(1)) / exp(1)))); else tmp = sin(Float64(abs(z1) * -1.0)); end return Float64(copysign(1.0, z1) * tmp) end
function tmp_2 = code(z1, z0) tmp = 0.0; if (sin((abs(z1) * (z0 - 1.0))) <= 0.999) tmp = sin((abs(z1) * (((z0 * 2.71828182845904523536) - 2.71828182845904523536) / 2.71828182845904523536))); else tmp = sin((abs(z1) * -1.0)); end tmp_2 = (sign(z1) * abs(1.0)) * tmp; end
code[z1_, z0_] := N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z1]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[Sin[N[(N[Abs[z1], $MachinePrecision] * N[(z0 - 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 0.999], N[Sin[N[(N[Abs[z1], $MachinePrecision] * N[(N[(N[(z0 * E), $MachinePrecision] - E), $MachinePrecision] / E), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Sin[N[(N[Abs[z1], $MachinePrecision] * -1.0), $MachinePrecision]], $MachinePrecision]]), $MachinePrecision]
\mathsf{copysign}\left(1, z1\right) \cdot \begin{array}{l}
\mathbf{if}\;\sin \left(\left|z1\right| \cdot \left(z0 - 1\right)\right) \leq 0.999:\\
\;\;\;\;\sin \left(\left|z1\right| \cdot \frac{z0 \cdot e - e}{e}\right)\\
\mathbf{else}:\\
\;\;\;\;\sin \left(\left|z1\right| \cdot -1\right)\\
\end{array}
if (sin.f64 (*.f64 z1 (-.f64 z0 #s(literal 1 binary64)))) < 0.999Initial program 53.8%
lift--.f64N/A
sub-negate-revN/A
sub-flipN/A
add-flipN/A
sub-negateN/A
remove-double-negN/A
1-expN/A
metadata-evalN/A
exp-diffN/A
sub-to-fractionN/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
exp-1-eN/A
lower-E.f64N/A
exp-1-eN/A
lower-E.f64N/A
exp-1-eN/A
lower-E.f6453.8%
Applied rewrites53.8%
if 0.999 < (sin.f64 (*.f64 z1 (-.f64 z0 #s(literal 1 binary64)))) Initial program 53.8%
Taylor expanded in z0 around 0
Applied rewrites41.2%
(FPCore (z1 z0) :precision binary64 (* (copysign 1.0 z1) (if (<= (sin (* (fabs z1) (- z0 1.0))) 0.999) (sin (* (fabs z1) (/ (- (* z0 E) E) E))) (sin (* (fabs z1) (/ (- (- 0.25 z0) 0.25) (+ (- z0 0.5) 0.5)))))))
double code(double z1, double z0) {
double tmp;
if (sin((fabs(z1) * (z0 - 1.0))) <= 0.999) {
tmp = sin((fabs(z1) * (((z0 * ((double) M_E)) - ((double) M_E)) / ((double) M_E))));
} else {
tmp = sin((fabs(z1) * (((0.25 - z0) - 0.25) / ((z0 - 0.5) + 0.5))));
}
return copysign(1.0, z1) * tmp;
}
public static double code(double z1, double z0) {
double tmp;
if (Math.sin((Math.abs(z1) * (z0 - 1.0))) <= 0.999) {
tmp = Math.sin((Math.abs(z1) * (((z0 * Math.E) - Math.E) / Math.E)));
} else {
tmp = Math.sin((Math.abs(z1) * (((0.25 - z0) - 0.25) / ((z0 - 0.5) + 0.5))));
}
return Math.copySign(1.0, z1) * tmp;
}
def code(z1, z0): tmp = 0 if math.sin((math.fabs(z1) * (z0 - 1.0))) <= 0.999: tmp = math.sin((math.fabs(z1) * (((z0 * math.e) - math.e) / math.e))) else: tmp = math.sin((math.fabs(z1) * (((0.25 - z0) - 0.25) / ((z0 - 0.5) + 0.5)))) return math.copysign(1.0, z1) * tmp
function code(z1, z0) tmp = 0.0 if (sin(Float64(abs(z1) * Float64(z0 - 1.0))) <= 0.999) tmp = sin(Float64(abs(z1) * Float64(Float64(Float64(z0 * exp(1)) - exp(1)) / exp(1)))); else tmp = sin(Float64(abs(z1) * Float64(Float64(Float64(0.25 - z0) - 0.25) / Float64(Float64(z0 - 0.5) + 0.5)))); end return Float64(copysign(1.0, z1) * tmp) end
function tmp_2 = code(z1, z0) tmp = 0.0; if (sin((abs(z1) * (z0 - 1.0))) <= 0.999) tmp = sin((abs(z1) * (((z0 * 2.71828182845904523536) - 2.71828182845904523536) / 2.71828182845904523536))); else tmp = sin((abs(z1) * (((0.25 - z0) - 0.25) / ((z0 - 0.5) + 0.5)))); end tmp_2 = (sign(z1) * abs(1.0)) * tmp; end
code[z1_, z0_] := N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z1]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[Sin[N[(N[Abs[z1], $MachinePrecision] * N[(z0 - 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 0.999], N[Sin[N[(N[Abs[z1], $MachinePrecision] * N[(N[(N[(z0 * E), $MachinePrecision] - E), $MachinePrecision] / E), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Sin[N[(N[Abs[z1], $MachinePrecision] * N[(N[(N[(0.25 - z0), $MachinePrecision] - 0.25), $MachinePrecision] / N[(N[(z0 - 0.5), $MachinePrecision] + 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]), $MachinePrecision]
\mathsf{copysign}\left(1, z1\right) \cdot \begin{array}{l}
\mathbf{if}\;\sin \left(\left|z1\right| \cdot \left(z0 - 1\right)\right) \leq 0.999:\\
\;\;\;\;\sin \left(\left|z1\right| \cdot \frac{z0 \cdot e - e}{e}\right)\\
\mathbf{else}:\\
\;\;\;\;\sin \left(\left|z1\right| \cdot \frac{\left(0.25 - z0\right) - 0.25}{\left(z0 - 0.5\right) + 0.5}\right)\\
\end{array}
if (sin.f64 (*.f64 z1 (-.f64 z0 #s(literal 1 binary64)))) < 0.999Initial program 53.8%
lift--.f64N/A
sub-negate-revN/A
sub-flipN/A
add-flipN/A
sub-negateN/A
remove-double-negN/A
1-expN/A
metadata-evalN/A
exp-diffN/A
sub-to-fractionN/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
exp-1-eN/A
lower-E.f64N/A
exp-1-eN/A
lower-E.f64N/A
exp-1-eN/A
lower-E.f6453.8%
Applied rewrites53.8%
if 0.999 < (sin.f64 (*.f64 z1 (-.f64 z0 #s(literal 1 binary64)))) Initial program 53.8%
lift--.f64N/A
*-inversesN/A
1-expN/A
metadata-evalN/A
1-expN/A
div-addN/A
associate--r+N/A
flip--N/A
lower-unsound-/.f64N/A
Applied rewrites12.4%
Taylor expanded in z0 around 0
metadata-evalN/A
lower-+.f64N/A
metadata-evalN/A
lower-*.f644.6%
Applied rewrites4.6%
lift-+.f64N/A
metadata-evalN/A
lift-*.f64N/A
lift-*.f64N/A
mul-1-negN/A
sub-flip-reverseN/A
lower--.f644.6%
lift-*.f64N/A
metadata-eval4.6%
metadata-evalN/A
metadata-evalN/A
Applied rewrites4.6%
(FPCore (z1 z0) :precision binary64 (let* ((t_0 (sin (* (fabs z1) (- z0 1.0))))) (* (copysign 1.0 z1) (if (<= t_0 0.999) t_0 (sin (* (fabs z1) -1.0))))))
double code(double z1, double z0) {
double t_0 = sin((fabs(z1) * (z0 - 1.0)));
double tmp;
if (t_0 <= 0.999) {
tmp = t_0;
} else {
tmp = sin((fabs(z1) * -1.0));
}
return copysign(1.0, z1) * tmp;
}
public static double code(double z1, double z0) {
double t_0 = Math.sin((Math.abs(z1) * (z0 - 1.0)));
double tmp;
if (t_0 <= 0.999) {
tmp = t_0;
} else {
tmp = Math.sin((Math.abs(z1) * -1.0));
}
return Math.copySign(1.0, z1) * tmp;
}
def code(z1, z0): t_0 = math.sin((math.fabs(z1) * (z0 - 1.0))) tmp = 0 if t_0 <= 0.999: tmp = t_0 else: tmp = math.sin((math.fabs(z1) * -1.0)) return math.copysign(1.0, z1) * tmp
function code(z1, z0) t_0 = sin(Float64(abs(z1) * Float64(z0 - 1.0))) tmp = 0.0 if (t_0 <= 0.999) tmp = t_0; else tmp = sin(Float64(abs(z1) * -1.0)); end return Float64(copysign(1.0, z1) * tmp) end
function tmp_2 = code(z1, z0) t_0 = sin((abs(z1) * (z0 - 1.0))); tmp = 0.0; if (t_0 <= 0.999) tmp = t_0; else tmp = sin((abs(z1) * -1.0)); end tmp_2 = (sign(z1) * abs(1.0)) * tmp; end
code[z1_, z0_] := Block[{t$95$0 = N[Sin[N[(N[Abs[z1], $MachinePrecision] * N[(z0 - 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z1]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[t$95$0, 0.999], t$95$0, N[Sin[N[(N[Abs[z1], $MachinePrecision] * -1.0), $MachinePrecision]], $MachinePrecision]]), $MachinePrecision]]
\begin{array}{l}
t_0 := \sin \left(\left|z1\right| \cdot \left(z0 - 1\right)\right)\\
\mathsf{copysign}\left(1, z1\right) \cdot \begin{array}{l}
\mathbf{if}\;t\_0 \leq 0.999:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\sin \left(\left|z1\right| \cdot -1\right)\\
\end{array}
\end{array}
if (sin.f64 (*.f64 z1 (-.f64 z0 #s(literal 1 binary64)))) < 0.999Initial program 53.8%
if 0.999 < (sin.f64 (*.f64 z1 (-.f64 z0 #s(literal 1 binary64)))) Initial program 53.8%
Taylor expanded in z0 around 0
Applied rewrites41.2%
(FPCore (z1 z0) :precision binary64 (* (copysign 1.0 z1) (if (<= (fabs z1) 3.5e-44) (* (fabs z1) (- z0 1.0)) (sin (* (fabs z1) -1.0)))))
double code(double z1, double z0) {
double tmp;
if (fabs(z1) <= 3.5e-44) {
tmp = fabs(z1) * (z0 - 1.0);
} else {
tmp = sin((fabs(z1) * -1.0));
}
return copysign(1.0, z1) * tmp;
}
public static double code(double z1, double z0) {
double tmp;
if (Math.abs(z1) <= 3.5e-44) {
tmp = Math.abs(z1) * (z0 - 1.0);
} else {
tmp = Math.sin((Math.abs(z1) * -1.0));
}
return Math.copySign(1.0, z1) * tmp;
}
def code(z1, z0): tmp = 0 if math.fabs(z1) <= 3.5e-44: tmp = math.fabs(z1) * (z0 - 1.0) else: tmp = math.sin((math.fabs(z1) * -1.0)) return math.copysign(1.0, z1) * tmp
function code(z1, z0) tmp = 0.0 if (abs(z1) <= 3.5e-44) tmp = Float64(abs(z1) * Float64(z0 - 1.0)); else tmp = sin(Float64(abs(z1) * -1.0)); end return Float64(copysign(1.0, z1) * tmp) end
function tmp_2 = code(z1, z0) tmp = 0.0; if (abs(z1) <= 3.5e-44) tmp = abs(z1) * (z0 - 1.0); else tmp = sin((abs(z1) * -1.0)); end tmp_2 = (sign(z1) * abs(1.0)) * tmp; end
code[z1_, z0_] := N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z1]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[Abs[z1], $MachinePrecision], 3.5e-44], N[(N[Abs[z1], $MachinePrecision] * N[(z0 - 1.0), $MachinePrecision]), $MachinePrecision], N[Sin[N[(N[Abs[z1], $MachinePrecision] * -1.0), $MachinePrecision]], $MachinePrecision]]), $MachinePrecision]
\mathsf{copysign}\left(1, z1\right) \cdot \begin{array}{l}
\mathbf{if}\;\left|z1\right| \leq 3.5 \cdot 10^{-44}:\\
\;\;\;\;\left|z1\right| \cdot \left(z0 - 1\right)\\
\mathbf{else}:\\
\;\;\;\;\sin \left(\left|z1\right| \cdot -1\right)\\
\end{array}
if z1 < 3.4999999999999998e-44Initial program 53.8%
Applied rewrites54.9%
Taylor expanded in z1 around 0
lower-*.f64N/A
lower--.f6438.9%
Applied rewrites38.9%
if 3.4999999999999998e-44 < z1 Initial program 53.8%
Taylor expanded in z0 around 0
Applied rewrites41.2%
(FPCore (z1 z0) :precision binary64 (* (copysign 1.0 z1) (if (<= (fabs z1) 0.0019) (* (fabs z1) (- z0 1.0)) (sin (* z0 (fabs z1))))))
double code(double z1, double z0) {
double tmp;
if (fabs(z1) <= 0.0019) {
tmp = fabs(z1) * (z0 - 1.0);
} else {
tmp = sin((z0 * fabs(z1)));
}
return copysign(1.0, z1) * tmp;
}
public static double code(double z1, double z0) {
double tmp;
if (Math.abs(z1) <= 0.0019) {
tmp = Math.abs(z1) * (z0 - 1.0);
} else {
tmp = Math.sin((z0 * Math.abs(z1)));
}
return Math.copySign(1.0, z1) * tmp;
}
def code(z1, z0): tmp = 0 if math.fabs(z1) <= 0.0019: tmp = math.fabs(z1) * (z0 - 1.0) else: tmp = math.sin((z0 * math.fabs(z1))) return math.copysign(1.0, z1) * tmp
function code(z1, z0) tmp = 0.0 if (abs(z1) <= 0.0019) tmp = Float64(abs(z1) * Float64(z0 - 1.0)); else tmp = sin(Float64(z0 * abs(z1))); end return Float64(copysign(1.0, z1) * tmp) end
function tmp_2 = code(z1, z0) tmp = 0.0; if (abs(z1) <= 0.0019) tmp = abs(z1) * (z0 - 1.0); else tmp = sin((z0 * abs(z1))); end tmp_2 = (sign(z1) * abs(1.0)) * tmp; end
code[z1_, z0_] := N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z1]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[Abs[z1], $MachinePrecision], 0.0019], N[(N[Abs[z1], $MachinePrecision] * N[(z0 - 1.0), $MachinePrecision]), $MachinePrecision], N[Sin[N[(z0 * N[Abs[z1], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]), $MachinePrecision]
\mathsf{copysign}\left(1, z1\right) \cdot \begin{array}{l}
\mathbf{if}\;\left|z1\right| \leq 0.0019:\\
\;\;\;\;\left|z1\right| \cdot \left(z0 - 1\right)\\
\mathbf{else}:\\
\;\;\;\;\sin \left(z0 \cdot \left|z1\right|\right)\\
\end{array}
if z1 < 0.0019Initial program 53.8%
Applied rewrites54.9%
Taylor expanded in z1 around 0
lower-*.f64N/A
lower--.f6438.9%
Applied rewrites38.9%
if 0.0019 < z1 Initial program 53.8%
Taylor expanded in z0 around inf
lower-*.f6418.6%
Applied rewrites18.6%
(FPCore (z1 z0) :precision binary64 (* z1 (- z0 1.0)))
double code(double z1, double z0) {
return z1 * (z0 - 1.0);
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(z1, z0)
use fmin_fmax_functions
real(8), intent (in) :: z1
real(8), intent (in) :: z0
code = z1 * (z0 - 1.0d0)
end function
public static double code(double z1, double z0) {
return z1 * (z0 - 1.0);
}
def code(z1, z0): return z1 * (z0 - 1.0)
function code(z1, z0) return Float64(z1 * Float64(z0 - 1.0)) end
function tmp = code(z1, z0) tmp = z1 * (z0 - 1.0); end
code[z1_, z0_] := N[(z1 * N[(z0 - 1.0), $MachinePrecision]), $MachinePrecision]
z1 \cdot \left(z0 - 1\right)
Initial program 53.8%
Applied rewrites54.9%
Taylor expanded in z1 around 0
lower-*.f64N/A
lower--.f6438.9%
Applied rewrites38.9%
(FPCore (z1 z0) :precision binary64 (* z1 -1.0))
double code(double z1, double z0) {
return z1 * -1.0;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(z1, z0)
use fmin_fmax_functions
real(8), intent (in) :: z1
real(8), intent (in) :: z0
code = z1 * (-1.0d0)
end function
public static double code(double z1, double z0) {
return z1 * -1.0;
}
def code(z1, z0): return z1 * -1.0
function code(z1, z0) return Float64(z1 * -1.0) end
function tmp = code(z1, z0) tmp = z1 * -1.0; end
code[z1_, z0_] := N[(z1 * -1.0), $MachinePrecision]
z1 \cdot -1
Initial program 53.8%
Applied rewrites54.9%
Taylor expanded in z1 around 0
lower-*.f64N/A
lower--.f6438.9%
Applied rewrites38.9%
Taylor expanded in z0 around 0
Applied rewrites27.0%
herbie shell --seed 2025250
(FPCore (z1 z0)
:name "(sin (* z1 (- z0 1)))"
:precision binary64
(sin (* z1 (- z0 1.0))))