File: StormMath.h

package info (click to toggle)
storm-lang 0.7.4-1
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 52,004 kB
  • sloc: ansic: 261,462; cpp: 140,405; sh: 14,891; perl: 9,846; python: 2,525; lisp: 2,504; asm: 860; makefile: 678; pascal: 70; java: 52; xml: 37; awk: 12
file content (37 lines) | stat: -rw-r--r-- 988 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#pragma once
#include "Types.h"

namespace storm {
	STORM_PKG(core);

	/**
	 * Mathematical functions for the built-in floating point types. We don't expect users to
	 * include this header, as these functions are usually already present from other headers, but
	 * Storm needs them.
	 */

	// Square root.
	Float STORM_FN sqrt(Float v);
	Double STORM_FN sqrt(Double v);

	// Power.
	Float STORM_FN pow(Float base, Float exp);
	Double STORM_FN pow(Double base, Double exp);

	// Absolute value.
	Int STORM_FN abs(Int a);
	Long STORM_FN abs(Long a);
	Float STORM_FN abs(Float a);
	Double STORM_FN abs(Double a);

	// Clamp values.
	Byte STORM_FN clamp(Byte v, Byte min, Byte max);
	Int STORM_FN clamp(Int v, Int min, Int max);
	Nat STORM_FN clamp(Nat v, Nat min, Nat max);
	Long STORM_FN clamp(Long v, Long min, Long max);
	Word STORM_FN clamp(Word v, Word min, Word max);
	Float STORM_FN clamp(Float v, Float min, Float max);
	Double STORM_FN clamp(Double v, Double min, Double max);

}