Skip to content

Commit 2459e16

Browse files
committed
chore: minor changes
1 parent 8918b2f commit 2459e16

File tree

4 files changed

+31
-32
lines changed

4 files changed

+31
-32
lines changed

flake.lock

Lines changed: 19 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

resources/sourcecode/montecarlo-pi.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,20 @@
33
#include <time.h>
44

55
int main(int argc, char* argv[]) {
6-
double x,y,z,count;
7-
8-
int n = atoi(argv[1]); // Number of iterations
6+
double x,y,z;
7+
int count = 1;
98

109
srand(time(NULL));
1110

11+
int n = atoi(argv[1]); // User input: number of iterations to perform
12+
1213
for (int i = 0; i < n; i++) {
1314
x = (double) rand() / RAND_MAX;
1415
y = (double) rand() / RAND_MAX;
15-
z = x * x + y * y;
16-
if (z <= 1) count++;
16+
if ((x * x + y * y) <= 1) count++;
1717
}
1818

19-
printf("π approx.: %g", (count / n) * 4);
19+
printf("π approx.: %g\n", ((double)count / n) * 4);
2020

2121
return(0);
2222
}

src/thesis/imports/preamble.typ

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
#import "@preview/diagraph:0.3.0": *
2-
#import "@preview/codly:1.1.1": *
3-
#import "@preview/codly-languages:0.1.1": *
4-
#import "@preview/glossarium:0.5.0": make-glossary, register-glossary, print-glossary, gls, glspl
2+
#import "@preview/codly:1.2.0": *
3+
#import "@preview/codly-languages:0.1.4": *
4+
#import "@preview/glossarium:0.5.1": make-glossary, register-glossary, print-glossary, gls, glspl
55
#show: make-glossary
66
#import "@preview/xarrow:0.3.1": xarrow, xarrowSquiggly, xarrowTwoHead
7-
#import "@preview/hydra:0.4.0": *
7+
#import "@preview/hydra:0.5.2": *
88
#import "@preview/cetz:0.3.1"
99
#import "colors.typ": *
1010
#import "workarounds.typ": *

src/thesis/imports/workarounds.typ

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
#import "@preview/codelst:2.0.2": sourcecode, sourcefile
2-
#import "@preview/codly:1.1.1": *
3-
#import "@preview/codly-languages:0.1.1": *
1+
#import "@preview/codly:1.2.0": *
2+
#import "@preview/codly-languages:0.1.4": *
43
#import "../theme/common/metadata.typ": *
54

65
#let sourcefile(file: none, lang: none) = {

0 commit comments

Comments
 (0)