From 74fe80fd42d465d4bb11c78f7c162209d463c6dd Mon Sep 17 00:00:00 2001 From: James Grugett Date: Tue, 29 Mar 2022 14:47:23 -0500 Subject: [PATCH] Handle floating point precision in max shares you can sell. --- functions/src/sell-shares.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/src/sell-shares.ts b/functions/src/sell-shares.ts index 5c2ae0d0..a7753b0e 100644 --- a/functions/src/sell-shares.ts +++ b/functions/src/sell-shares.ts @@ -61,7 +61,7 @@ export const sellShares = functions.runWith({ minInstances: 1 }).https.onCall( ] const maxShares = outcome === 'YES' ? yesShares : noShares - if (shares > maxShares) { + if (shares > maxShares + 0.000000000001) { return { status: 'error', message: `You can only sell ${maxShares} shares`,