Nov 08, 2013; 13:27
Kevin Bice
Simple Math - Weird Solution
I was updating a shopping cart solution today (Lasso 8.6 on CentOS 5.9) when I came across a math error that I had to force into correctness.
The code was: var:'thistax'=decimal:(($shipstate == 'TX') ? ((decimal:$carttotal + 4.00) * 0.0825)|0.00); which returns .83
but $ordertotal=(decimal:$carttotal) + (decimal:$thistax)+ (decimal(4.00)); returns 10.82
I changed it to: var:'thistax'=decimal:(($shipstate == 'TX') ? ((decimal:$carttotal + 4.00) * 0.08251)|0.00); which returns .83
and then $ordertotal=(decimal:$carttotal) + (decimal:$thistax)+ (decimal(4.00)); returns 10.83
I know that my use of : syntax is not desirable, but the math problem is weird and not related to that as far as I can tell. I tried Math_Add() too. I feel I should know the answer, but I cannot get to it for some reason. Thanks for any guidance.
..................................
Kevin Bice
512-879-1653
http://fmpweb.com
..................................
Web Development and Design
#############################################################
This message is sent to you because you are subscribed to
the mailing list Lasso
Lasso@lists.lassosoft.com
To unsubscribe, E-mail to: <Lasso-unsubscribe@lists.lassosoft.com>
Send administrative queries to <Lasso-request@lists.lassosoft.com>
Nov 08, 2013; 19:54
Ke Carlton
Re: Simple Math - Weird Solution