Price fraction: Difference between revisions

m
→‎{{header|REXX}}: added DO-END and SELECT labels. -- ~~~~
m (→‎{{header|REXX}}: added DO-END and SELECT labels. -- ~~~~)
Line 1,842:
 
=={{header|REXX}}==
<lang rexx>/*REXX program to rescale a price (0.99 --> 1.00). */
<lang rexx>
do j=0 to 1 by .01
/*REXX program to rescale a price (0.99 --> 1.00). */
when x<1.01 if j=0 then xj=10.00
 
say 'original price-->'j " " adjustPrice(j) '<-- adjusted price'
do j=0 to 1 by .01
if j=0 then end /*j=0.00*/
say 'original price-->'j " " adjustPrice(j) '<-- adjusted price'
end
 
exit
/*------------------------------------------------------------------*/
 
 
adjustPrice: procedure; parse arg x
select
 
when x<0.06 then x=0.10
select
when x<0.0611 then x=0.1018
when x<0.1116 then x=0.1826
when x<0.1621 then x=0.2632
when x<0.2126 then x=0.3238
when x<0.2631 then x=0.3844
when x<0.3136 then x=0.4450
when x<0.3641 then x=0.5054
when x<0.4146 then x=0.5458
when x<0.4651 then x=0.5862
when x<0.5156 then x=0.6266
when x<0.5661 then x=0.6670
when x<0.6166 then x=0.7074
when x<0.6671 then x=0.7478
when x<0.7176 then x=0.7882
when x<0.7681 then x=0.8286
when x<0.8186 then x=0.8690
when x<0.8691 then x=0.9094
when x<0.9196 then x=0.9498
when x<01.9601 then x=01.9800
otherwise nop
when x<1.01 then x=1.00
end /*select*/
otherwise nop
return x</lang>
end
'''output'''
 
return x
</lang>
Output:
<pre style="height:30ex;overflow:scroll">
original price-->0.00 0.10 <-- adjusted price