Calculate mean and error

I often need to calculate the mean and ± error of two numbers, like for instance of a radiocarbon date. Here is a workflow (and below the AppleScript it includes) to calculate these two parameters based on two numbers input in Alfred.

set FirstNumber to first word of q as integer
set SecondNumber to second word of q as integer

set NumbersAverage to (FirstNumber + SecondNumber) / 2 as integer
set NumbersError to (SecondNumber - FirstNumber) / 2 as integer

set q to NumbersAverage & "±" & NumbersError as text

This article is my 29th oldest. It is 92 words long, and it’s got 0 comments for now.