WIP
DirectOutput framework for virtual pinball cabinets WIP
Go to:
Overview
Main Page
Related Pages
Packages
Classes
Files
File List
File Members
DoubleExtensions.cs
Go to the documentation of this file.
1
using
System
;
2
using
System
.Collections.Generic;
3
using
System
.
Linq
;
4
using
System
.Text;
5
6
10
public
static
class
DoubleExtensions
11
{
18
public
static
double
Limit(
this
double
d,
double
MinValue,
double
MaxValue)
19
{
20
if
(d < MinValue)
return
MinValue;
21
if
(d > MaxValue)
return
MaxValue;
22
return
d;
23
}
24
25
26
33
public
static
bool
IsBetween(
this
double
i,
double
MinValue,
double
MaxValue)
34
{
35
return
(i >= MinValue && i <= MaxValue);
36
}
37
38
39
45
public
static
double
Round(
this
double
d)
46
{
47
return
Math.Round(d, 0);
48
}
49
55
public
static
int
RoundToInt(
this
double
d)
56
{
57
return
(
int
)Math.Round(d, 0);
58
}
59
66
public
static
double
Round(
this
double
d,
int
Digits)
67
{
68
return
Math.Round(d, Digits.Limit(0, 15));
69
}
70
76
public
static
double
Abs(
this
double
d)
77
{
78
return
Math.Abs(d);
79
}
80
86
public
static
double
Floor(
this
double
d)
87
{
88
return
Math.Floor(d);
89
}
90
91
97
public
static
double
Ceiling(
this
double
d)
98
{
99
return
Math.Ceiling(d);
100
}
101
109
public
static
bool
IsIntegral(
this
double
d)
110
{
111
return
d == Math.Floor(d);
112
113
}
114
115
}
116
System.Linq
System
DirectOutput
Extensions
DoubleExtensions.cs
Generated on Sat Nov 19 2016 19:32:47 for WIP by
1.8.9.1