IFDM-139: new version of the present value calculator#90
Conversation
imonroe
left a comment
There was a problem hiding this comment.
I think there's a small mistake with the discountAmount calculation, but please double-check me.
| const totalPeriods = n * timePeriod | ||
| const periodRate = rate / n | ||
| const presentValue = futureValue / Math.pow(1 + periodRate, totalPeriods) | ||
| const discountAmount = presentValue - futureValue |
There was a problem hiding this comment.
I think this is flipped. I think it should be
discountAmount = futureValue - presentValue? Otherwise, won't it always be negative
| } | ||
|
|
||
| const totalPayments = paymentAmount * numberOfPayments | ||
| const discountAmount = presentValue - totalPayments |
There was a problem hiding this comment.
Same thing. I think it should be
discountAmount = totalPayments - presentValue?
| } | ||
|
|
||
| return ( | ||
| <div className=" p-6 max-w-5xl mx-auto"> |
There was a problem hiding this comment.
| <div className=" p-6 max-w-5xl mx-auto"> | |
| <div className="p-6 max-w-5xl mx-auto"> |
|
@imonroe I asked Claude and it agreed that the variables were flipped. I made the change. Since this calculator is a replacement for the current Present Value but at a new URL we can merge and deploy. That will allow the client to review the math without impacting the current calculator. thanks for the reviews. |
READY FOR REVIEW
Summary
- Ticket
Review By (Date)
Criticality
Review Tasks
Setup tasks and/or behavior to test
Front End Validation
Backend / Functional Validation
Code
Code security
General
Affected Projects or Products
Associated Issues and/or People
@mentionthem here)Resources