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
44
public
static
double
Round(
this
double
d)
45
{
46
return
Math.Round(d, 0);
47
}
48
54
public
static
int
RoundToInt(
this
double
d)
55
{
56
return
(
int
)Math.Round(d, 0);
57
}
58
65
public
static
double
Round(
this
double
d,
int
Digits)
66
{
67
return
Math.Round(d, Digits.Limit(0, 15));
68
}
69
75
public
static
double
Abs(
this
double
d)
76
{
77
return
Math.Abs(d);
78
}
79
85
public
static
double
Floor(
this
double
d)
86
{
87
return
Math.Floor(d);
88
}
89
90
96
public
static
double
Ceiling(
this
double
d)
97
{
98
return
Math.Ceiling(d);
99
}
100
108
public
static
bool
IsIntegral(
this
double
d)
109
{
110
return
d == Math.Floor(d);
111
112
}
113
}
114
System.Linq
System
Extensions
DoubleExtensions.cs
Generated on Sat Nov 19 2016 19:32:47 for WIP by
1.8.9.1