WIP
DirectOutput framework for virtual pinball cabinets WIP
Go to:
Overview
Main Page
Related Pages
Packages
Classes
Files
File List
File Members
FloatExtensions.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
floatExtensions
11
{
18
public
static
float
Limit(
this
float
d,
float
MinValue,
float
MaxValue)
19
{
20
if
(d < MinValue)
return
MinValue;
21
if
(d > MaxValue)
return
MaxValue;
22
return
d;
23
}
24
25
32
public
static
bool
IsBetween(
this
float
i,
float
MinValue,
float
MaxValue)
33
{
34
return
(i >= MinValue && i <= MaxValue);
35
}
36
42
public
static
float
Round(
this
float
d)
43
{
44
return
(
float
)Math.Round(d, 0);
45
}
46
53
public
static
float
Round(
this
float
d,
int
Digits)
54
{
55
return
(
float
)Math.Round(d, Digits.Limit(0,15));
56
}
57
63
public
static
int
RoundToInt(
this
float
d)
64
{
65
return
(
int
)Math.Round(d, 0);
66
}
67
73
public
static
float
Abs(
this
float
d)
74
{
75
return
Math.Abs(d);
76
}
77
83
public
static
float
Floor(
this
float
d)
84
{
85
return
(
float
)Math.Floor(d);
86
}
87
88
94
public
static
float
Ceiling(
this
float
d)
95
{
96
return
(
float
)Math.Ceiling(d);
97
}
98
106
public
static
bool
IsIntegral(
this
float
d)
107
{
108
return
d == Math.Floor(d);
109
110
}
111
}
112
System.Linq
System
DirectOutput
Extensions
FloatExtensions.cs
Generated on Sat Nov 19 2016 19:32:47 for WIP by
1.8.9.1