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
31
public
static
bool
IsBetween(
this
float
i,
float
MinValue,
float
MaxValue)
32
{
33
return
(i >= MinValue && i <= MaxValue);
34
}
35
41
public
static
float
Round(
this
float
d)
42
{
43
return
(
float
)Math.Round(d, 0);
44
}
45
52
public
static
float
Round(
this
float
d,
int
Digits)
53
{
54
return
(
float
)Math.Round(d, Digits.Limit(0, 15));
55
}
56
62
public
static
int
RoundToInt(
this
float
d)
63
{
64
return
(
int
)Math.Round(d, 0);
65
}
66
72
public
static
float
Abs(
this
float
d)
73
{
74
return
Math.Abs(d);
75
}
76
82
public
static
float
Floor(
this
float
d)
83
{
84
return
(
float
)Math.Floor(d);
85
}
86
87
93
public
static
float
Ceiling(
this
float
d)
94
{
95
return
(
float
)Math.Ceiling(d);
96
}
97
105
public
static
bool
IsIntegral(
this
float
d)
106
{
107
return
d == Math.Floor(d);
108
109
}
110
}
111
System.Linq
System
Extensions
FloatExtensions.cs
Generated on Sat Nov 19 2016 19:32:47 for WIP by
1.8.9.1