Awesome Contents

# Fun with Fixed Point Math

Fun with Fixed Point Math ⚠ Click here to regain focus ⚠
?
?

## Global Keys

W, A, P / S, D, N Jump to previous / next marker
z Toggle filter mode V Revert filter to original state

q Quotes r References f Filter c Credits

a
w
s
d
h j k l

## Quotes, References and Credits Menus

o Open URL (in new tab)

x, Space Toggle category and focus next
X, ShiftSpace Toggle category and focus previous
v Invert topics / media as per focus

Enter Open URL (in new tab)
0:09Recap and set the stage for the day
0:09Recap and set the stage for the day
0:09Recap and set the stage for the day
1:03Don the thinking cap
1:03Don the thinking cap
1:03Don the thinking cap
1:38Working through the cycles-per-second formula for measure_cpu_freq()
1:38Working through the cycles-per-second formula for measure_cpu_freq()
1:38Working through the cycles-per-second formula for measure_cpu_freq()
16:12Check our formula with the one in measure_cpu_freq()
16:12Check our formula with the one in measure_cpu_freq()
16:12Check our formula with the one in measure_cpu_freq()
18:46Reverse engineer the cycles-per-second formula
18:46Reverse engineer the cycles-per-second formula
18:46Reverse engineer the cycles-per-second formula
20:22 They are basically doing fixed point math
20:22 They are basically doing fixed point math
20:22 They are basically doing fixed point math
21:02Computing the decimal portion of a real number in fixed point mathematics
21:02Computing the decimal portion of a real number in fixed point mathematics
21:02Computing the decimal portion of a real number in fixed point mathematics
21:58 Instead of doing float x = 3.14, you do int x = 314 and the point is implicit
21:58 Instead of doing float x = 3.14, you do int x = 314 and the point is implicit
21:58 Instead of doing float x = 3.14, you do int x = 314 and the point is implicit
23:22 Notice that in one part you have / and then you have another part that is nearly equal but uses %
23:22 Notice that in one part you have / and then you have another part that is nearly equal but uses %
23:22 Notice that in one part you have / and then you have another part that is nearly equal but uses %
25:37Determine to work through an example on the whiteboard
25:37Determine to work through an example on the whiteboard
25:37Determine to work through an example on the whiteboard
26:34 Use a spreadsheet or C program, to make it easier to compute other values
26:34 Use a spreadsheet or C program, to make it easier to compute other values
26:34 Use a spreadsheet or C program, to make it easier to compute other values
27:06Plug some example values into our cycles-per-second formula
27:06Plug some example values into our cycles-per-second formula
27:06Plug some example values into our cycles-per-second formula
41:04Summarise how this fixed point calculation works
41:04Summarise how this fixed point calculation works
41:04Summarise how this fixed point calculation works
42:47 I can explain it another way
42:47 I can explain it another way
42:47 I can explain it another way
45:56 Say we have 200 cycles (delta_mcycle). We divide by the ticks (delta_mtime). So now we have number of cycles per tick. We multiply by the number of ticks per second (mtime_freq) so now we have cycles per second
45:56 Say we have 200 cycles (delta_mcycle). We divide by the ticks (delta_mtime). So now we have number of cycles per tick. We multiply by the number of ticks per second (mtime_freq) so now we have cycles per second
45:56 Say we have 200 cycles (delta_mcycle). We divide by the ticks (delta_mtime). So now we have number of cycles per tick. We multiply by the number of ticks per second (mtime_freq) so now we have cycles per second
47:57Pose the question: How does n % m / m give the decimal part of the number?
47:57Pose the question: How does n % m / m give the decimal part of the number?
47:57Pose the question: How does n % m / m give the decimal part of the number?
49:29 So 201 cycles / 10 ticks = floor(20.1) cycles per tick. We take the 20 and multiply by, say, 100 ticks per second so we have 2000 cycles per second
49:29 So 201 cycles / 10 ticks = floor(20.1) cycles per tick. We take the 20 and multiply by, say, 100 ticks per second so we have 2000 cycles per second
49:29 So 201 cycles / 10 ticks = floor(20.1) cycles per tick. We take the 20 and multiply by, say, 100 ticks per second so we have 2000 cycles per second
50:06 201 % 10 = 1. Multiply by 100 and divide by 10 we get 2010 cycles per second, and we recover the part we lost in the division
50:06 201 % 10 = 1. Multiply by 100 and divide by 10 we get 2010 cycles per second, and we recover the part we lost in the division
50:06 201 % 10 = 1. Multiply by 100 and divide by 10 we get 2010 cycles per second, and we recover the part we lost in the division
50:22The relationship between a remainder and a decimal
50:22The relationship between a remainder and a decimal
50:22The relationship between a remainder and a decimal