Price fraction: Difference between revisions

Pari/GP
(added Inform 7 solution)
(Pari/GP)
Line 1:
{{task|Financial operations}}
A friend of mine runs a Pharmacypharmacy. He has a specialised function in his Dispensary application which receives a decimal value of currency and replaces it to a standard value. This value is regulated by a government department.
 
Task: Given a floating point value between 0.00 and 1.00, rescale according to the following table:
Line 832:
end
end</lang>
 
=={{header|PARI/GP}}==
<lang>priceLookup=[6,11,16,21,26,31,41,46,51,56,61,66,71,76,81,86,91,96,101];
priceReplace=[10,18,26,32,38,44,50,54,58,62,66,70,74,78,82,86,90,94,98,100];
pf(x)={
x*=100;
for(i=1,19,
if(x<priceLookup[i], return(priceReplace[i]))
);
"nasal demons"
};</lang>
 
=={{header|Perl 6}}==