fix: reorder headers to fix compilation error

This commit is contained in:
NunoSempere 2023-11-18 21:10:21 +00:00
parent 61851a321a
commit 6387c0df70
23 changed files with 132 additions and 122 deletions

View File

@ -1,7 +1,7 @@
#include "../../squiggle.h"
#include <stdint.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdlib.h>
// Estimate functions
double sample_0(uint64_t* seed)
@ -24,7 +24,8 @@ double sample_many(uint64_t* seed)
return sample_to(2, 10, seed);
}
int main(){
int main()
{
// set randomness seed
uint64_t* seed = malloc(sizeof(uint64_t));
*seed = 1000; // xorshift can't start with 0

View File

@ -1,9 +1,10 @@
#include <stdint.h>
#include <stdlib.h>
#include <stdio.h>
#include "../../squiggle.h"
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
int main(){
int main()
{
// set randomness seed
uint64_t* seed = malloc(sizeof(uint64_t));
*seed = 1000; // xorshift can't start with 0
@ -35,4 +36,3 @@ int main(){
printf("]\n");
free(seed);
}

View File

@ -42,4 +42,3 @@ int main()
free(seed);
}

Binary file not shown.

View File

@ -5,7 +5,8 @@
#include <stdlib.h>
// Estimate functions
double beta_1_2_sampler(uint64_t* seed){
double beta_1_2_sampler(uint64_t* seed)
{
return sample_beta(1, 2.0, seed);
}

Binary file not shown.

Binary file not shown.

View File

@ -45,7 +45,5 @@ int main()
ci ci_90 = get_90_confidence_interval(sample_minutes_per_day_jumping_rope_needed_to_burn_10kg, seed);
printf("90%% confidence interval: [%f, %f]\n", ci_90.low, ci_90.high);
free(seed);
}

Binary file not shown.

View File

@ -14,17 +14,20 @@ double yearly_probability_nuclear_collapse(double year, uint64_t* seed)
// to get a probability,
// rather than sampling from a distribution over probabilities.
}
double yearly_probability_nuclear_collapse_2023(uint64_t* seed){
double yearly_probability_nuclear_collapse_2023(uint64_t* seed)
{
return yearly_probability_nuclear_collapse(2023, seed);
}
double yearly_probability_nuclear_collapse_after_recovery(double year, double rebuilding_period_length_years, uint64_t* seed){
double yearly_probability_nuclear_collapse_after_recovery(double year, double rebuilding_period_length_years, uint64_t* seed)
{
// assumption: nuclear
double successes = 1.0;
double failures = (year - rebuilding_period_length_years - 1960 - 1);
return sample_laplace(successes, failures, seed);
}
double yearly_probability_nuclear_collapse_after_recovery_example(uint64_t* seed){
double yearly_probability_nuclear_collapse_after_recovery_example(uint64_t* seed)
{
double year = 2070;
double rebuilding_period_length_years = 30;
// So, there was a nuclear collapse in 2040,
@ -33,7 +36,8 @@ double yearly_probability_nuclear_collapse_after_recovery_example(uint64_t* seed
return yearly_probability_nuclear_collapse_after_recovery(year, rebuilding_period_length_years, seed);
}
double yearly_probability_nuclear_collapse_after_recovery_antiinductive(uint64_t* seed){
double yearly_probability_nuclear_collapse_after_recovery_antiinductive(uint64_t* seed)
{
return yearly_probability_nuclear_collapse(2023, seed) / 2;
}

Binary file not shown.

View File

@ -4,19 +4,23 @@
#include <stdio.h>
#include <stdlib.h>
double sample_0(uint64_t* seed){
double sample_0(uint64_t* seed)
{
return 0;
}
double sample_1(uint64_t* seed){
double sample_1(uint64_t* seed)
{
return 1;
}
double sample_normal_mean_1_std_2(uint64_t* seed){
double sample_normal_mean_1_std_2(uint64_t* seed)
{
return sample_normal(1, 2, seed);
}
double sample_1_to_3(uint64_t* seed){
double sample_1_to_3(uint64_t* seed)
{
return sample_to(1, 3, seed);
}

View File

@ -0,0 +1,3 @@
build:
format:

View File

@ -1,10 +1,11 @@
#include "../../squiggle.h"
#include <stdint.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdlib.h>
// Estimate functions
int main(){
int main()
{
// set randomness seed
uint64_t* seed = malloc(sizeof(uint64_t));
*seed = 1000; // xorshift can't start with 0

View File

@ -1,3 +1,4 @@
#include "squiggle.h"
#include <float.h>
#include <limits.h>
#include <math.h>
@ -6,7 +7,6 @@
#include <stdlib.h>
#include <sys/types.h>
#include <time.h>
#include "squiggle.h"
// math constants
#define PI 3.14159265358979323846 // M_PI in gcc gnu99
@ -58,7 +58,6 @@ ci get_90_confidence_interval(double (*sampler)(uint64_t*), uint64_t* seed)
return result;
}
// ## Sample from an arbitrary cdf
struct box {
int empty;