Hi Joe,
Thanks again for bearing with me. So is this purely because I
wrote 99.9
rather than, let's say, 99.90? Would specifying the 2nd
decimal prevent any
potential problem there? Here is what I now have:
<%IF (rsRecordset.Fields.Item("price7day").Value) <=
45.00 Then%>
<%=
FormatCurrency(((rsRecordset.Fields.Item("price7day").Value)+5),
-1, -2, -2,
-2) %>
<%ElseIF (rsRecordset.Fields.Item("price7day").Value)
<= 99.99 Then%>
<%=
FormatCurrency(((rsRecordset.Fields.Item("price7day").Value)+8),
-1, -2, -2,
-2) %>
<%ElseIF (rsRecordset.Fields.Item("price7day").Value)
<= 150.00 Then%>
<%=
FormatCurrency(((rsRecordset.Fields.Item("price7day").Value)+12),
-1, -2, -2,
-2) %>
<%ElseIF (rsRecordset.Fields.Item("price7day").Value)
<= 200.00 Then%>
<%=
FormatCurrency(((rsRecordset.Fields.Item("price7day").Value)+20),
-1, -2, -2,
-2) %>
<%ElseIF (rsRecordset.Fields.Item("price7day").Value) >
200.01 Then%>
<%=
FormatCurrency(((rsRecordset.Fields.Item("price7day").Value)+30),
-1, -2, -2,
-2) %>
<%End IF%>
And these are the mark-ups I need to apply to the currency
field
("price7day") in the database:
0-�45 - add �5
�45.01-�99.99 - add �8
�100.00-�150.00 - add �12
�150.01-�200.00 - add �20
�200.01+ - add �30
Anything in there that could cause me a problem?
The numbers are purely currency values so they may well be
entered into the
database as 99.9 rather than 99.90.
What I'm not understanding in your reply is Condition 1 and
Condition 2? I
only have one condition for each, which is what I thought you
were
recommending, rather than using AND?
Hope you can stick with me on this - although I appreciate
you may begin to
tire of my novice status!
Regards
Nath.
"Joe Makowiec" <makowiec@invalid.invalid> wrote in
message
news:Xns97F56EE0CF45AmakowiecatnycapdotrE@216.104.212.96...
> On 03 Jul 2006 in macromedia.dreamweaver.appdev, Nathon
Jones wrote:
>
>> Thanks again for helping me with this. Just to
clarify what you
>> mean here: "By the way, watch the edge conditions.
Between 2 and 3
>> above, you have x <= 99.9 and x >= 100. What
happens when the value
>> is 99.93?"
>>
>> Item 2, in my last message, is "if VALUE is greater
than or equal to
>> 45.01 and VALUE is less than or equal to 99.9" then
add "10".
>>
>> If the value was 99.93, then 10 would be added
because it is less
>> than, or equal to, 99.9? Isn't it?
>
> Is 99.93 < 99.9?
>
> It's more conventional to use something like:
>
> Condition 1: x < 100
> Condition 2: x >= 100
>
> That will catch everything (range is continuous); if you
use <= for the
> first, and >= for the second, you have problems at
100:
>
> Condition 1: x <= 100
> Condition 2: x >= 100
>
> Ranges overlap - which one will get picked? Generally,
the first, but
> it could be ambiguous. And if you use something like:
>
> Condition 1: x <= 99.9
> Condition 2: x >= 100
>
> Range is discontinuous - you're missing 99.9 < x <
100. You run the
> risk of getting 99.93 - I don't know where your numbers
are coming
> from, but if they're calculated, you run the risk of
getting a number
> in between due to roundoff. If you can be positive that
your numbers
> will never have a value in that range, you'll be OK;
however, given how
> computers think, I never make that assumption. Always
make sure your
> numeric ranges are continuous without overlapping.
>
> --
> Joe Makowiec
>
http://makowiec.net/
> Email:
http://makowiec.net/email.php