diff --git a/common/util/format.ts b/common/util/format.ts index d7e381b4..05a8f702 100644 --- a/common/util/format.ts +++ b/common/util/format.ts @@ -19,8 +19,8 @@ export function formatWithCommas(amount: number) { } export function formatPercent(zeroToOne: number) { - // Show 1 decimal place if <2% or >99% - const decimalPlaces = zeroToOne < 0.02 || zeroToOne > 0.99 ? 1 : 0 + // Show 1 decimal place if <2% or >98%, giving more resolution on the tails + const decimalPlaces = zeroToOne < 0.02 || zeroToOne > 0.98 ? 1 : 0 return (zeroToOne * 100).toFixed(decimalPlaces) + '%' } diff --git a/web/components/answers/answer-bet-panel.tsx b/web/components/answers/answer-bet-panel.tsx index fa508937..65758f0b 100644 --- a/web/components/answers/answer-bet-panel.tsx +++ b/web/components/answers/answer-bet-panel.tsx @@ -95,7 +95,7 @@ export function AnswerBetPanel(props: { : 0 const currentReturn = betAmount ? (currentPayout - betAmount) / betAmount : 0 - const currentReturnPercent = (currentReturn * 100).toFixed() + '%' + const currentReturnPercent = formatPercent(currentReturn) return (