File tree 1 file changed +23
-0
lines changed
1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ # Required parameters:
4
+ # @raycast.schemaVersion 1
5
+ # @raycast.title Calculate CAGR Percentage
6
+ # @raycast.mode compact
7
+ # @raycast.packageName Math
8
+
9
+ # Optional parameters:
10
+ # @raycast.argument1 { "type": "text", "placeholder": "From" }
11
+ # @raycast.argument2 { "type": "text", "placeholder": "To" }
12
+ # @raycast.argument3 { "type": "text", "placeholder": "Years" }
13
+
14
+ # Documentation:
15
+ # @raycast.author Samuel Barton
16
+ # @raycast.authorURL https://github.com/samueldbarton
17
+ # @raycast.description Calculate the CAGR between "from" and "to" values over given "years," then copy the result.
18
+
19
+ CAGR=$( echo " scale=4; e( l($2 / $1 ) / $3 ) - 1" | bc -l)
20
+ CAGR=$( echo " scale=2; $CAGR * 100" | bc -l)
21
+ CAGR=$( printf " %.2f" " $CAGR " )
22
+ echo " $CAGR " | pbcopy
23
+ echo " The CAGR from $1 to $2 over $3 years is $CAGR %. CAGR copied to clipboard."
You can’t perform that action at this time.
0 commit comments