Skip to content

Commit

Permalink
Rename some vars
Browse files Browse the repository at this point in the history
  • Loading branch information
dzibma committed Jul 5, 2015
1 parent 7364c1f commit dafc7e3
Showing 2 changed files with 30 additions and 30 deletions.
30 changes: 15 additions & 15 deletions FuzzyMath/Functions/cos.cs
Original file line number Diff line number Diff line change
@@ -14,43 +14,43 @@ public static FuzzyNumber Cos(FuzzyNumber X)
return FuzzyNumber.Map(X, x => Cos(x));
}

public static Interval Cos(Interval interval)
public static Interval Cos(Interval x)
{
double a, b, x;
x = Math.Floor(interval.A / Math.PI) * Math.PI;
double a, b, extreme;
extreme = Math.Floor(x.A / Math.PI) * Math.PI;

if (interval.Contains(x))
if (x.Contains(extreme))
{
a = Math.Cos(x);
a = Math.Cos(extreme);
}
else
{
x += Math.PI;
extreme += Math.PI;

if (interval.Contains(x))
if (x.Contains(extreme))
{
a = Math.Cos(x);
a = Math.Cos(extreme);
}
else
{
a = Math.Cos(interval.A);
b = Math.Cos(interval.B);
a = Math.Cos(x.A);
b = Math.Cos(x.B);

return b > a ? new Interval(a, b) : new Interval(b, a);
}
}

x += Math.PI;
extreme += Math.PI;

if (interval.Contains(x))
if (x.Contains(extreme))
{
b = Math.Sin(x);
b = Math.Sin(extreme);
}
else
{
b = a > 0
? Math.Min(Math.Cos(interval.A), Math.Cos(interval.B))
: Math.Max(Math.Cos(interval.A), Math.Cos(interval.B));
? Math.Min(Math.Cos(x.A), Math.Cos(x.B))
: Math.Max(Math.Cos(x.A), Math.Cos(x.B));
}

return b > a ? new Interval(a, b) : new Interval(b, a);
30 changes: 15 additions & 15 deletions FuzzyMath/Functions/sin.cs
Original file line number Diff line number Diff line change
@@ -14,43 +14,43 @@ public static FuzzyNumber Sin(FuzzyNumber X)
return FuzzyNumber.Map(X, x => Sin(x));
}

public static Interval Sin(Interval interval)
public static Interval Sin(Interval x)
{
double a, b, x;
x = Math.Floor(interval.A / Math.PI) * Math.PI + Math.PI / 2;
double a, b, extreme;
extreme = Math.Floor(x.A / Math.PI) * Math.PI + Math.PI / 2;

if (interval.Contains(x))
if (x.Contains(extreme))
{
a = Math.Sin(x);
a = Math.Sin(extreme);
}
else
{
x += Math.PI;
extreme += Math.PI;

if (interval.Contains(x))
if (x.Contains(extreme))
{
a = Math.Sin(x);
a = Math.Sin(extreme);
}
else
{
a = Math.Sin(interval.A);
b = Math.Sin(interval.B);
a = Math.Sin(x.A);
b = Math.Sin(x.B);

return b > a ? new Interval(a, b) : new Interval(b, a);
}
}

x += Math.PI;
extreme += Math.PI;

if (interval.Contains(x))
if (x.Contains(extreme))
{
b = Math.Sin(x);
b = Math.Sin(extreme);
}
else
{
b = a > 0
? Math.Min(Math.Sin(interval.A), Math.Sin(interval.B))
: Math.Max(Math.Sin(interval.A), Math.Sin(interval.B));
? Math.Min(Math.Sin(x.A), Math.Sin(x.B))
: Math.Max(Math.Sin(x.A), Math.Sin(x.B));
}

return b > a ? new Interval(a, b) : new Interval(b, a);

0 comments on commit dafc7e3

Please sign in to comment.