squiggle/src/lib/GuesstimatorDist.re

20 lines
572 B
ReasonML
Raw Normal View History

2020-02-06 21:05:13 +00:00
let normal = (mean: float, std: float) =>
Js.Float.(
{
let nMean = toPrecisionWithPrecision(mean, ~digits=4);
let nStd = toPrecisionWithPrecision(std, ~digits=2);
{j|normal($(nMean), $(nStd))|j};
}
);
2020-02-13 12:40:04 +00:00
let logNormal = (mean: float, std: float) => {
Js.Float.(
{
let nMean = toPrecisionWithPrecision(Js.Math.log10(mean), ~digits=4);
2020-02-15 11:39:37 +00:00
let nStd = toPrecisionWithPrecision(Js.Math.log10(std), ~digits=2);
2020-02-13 12:40:04 +00:00
{j|lognormal($(nMean), $(nStd))|j};
}
);
};
2020-02-06 21:05:13 +00:00
let divide = (str1: string, str2: string) => {j|$(str1)/$(str2)|j};