Skip to content

Commit 2f6549c

Browse files
committed
sign() for f and d
1 parent bee0c4e commit 2f6549c

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

kit/kit.h

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1102,6 +1102,24 @@ namespace kit
11021102
return -1;
11031103
return 0;
11041104
}
1105+
inline float sign(float v)
1106+
{
1107+
if(v > 0.0f)
1108+
return 1.0f;
1109+
else if(v < 0.0f)
1110+
return -1.0f;
1111+
return 0.0f;
1112+
1113+
}
1114+
inline double sign(double v)
1115+
{
1116+
if(v > 0.0)
1117+
return 1.0;
1118+
else if(v < 0.0)
1119+
return -1.0;
1120+
return 0.0;
1121+
1122+
}
11051123

11061124
template<class T>
11071125
T mix(T a, T b, float t) {

0 commit comments

Comments
 (0)