taking 1.5% of a variable
Archiver
Posts: 46,084
I need to be able to take 1.5% of a 16bit variable but X*.015 does not work
Comments
Y = X ** 983 ' to 1% of X
debug dec y,cr
or,
Y = X ** 9831 ' to 0.1%
debug dec y/10,".",dec1 y,cr
or
Y = X ** 49152 ' to 0.02%
debug dec y/50,".",dec2 y//50*2,cr
-- best regards
Tracy Allen
electronically monitored ecosystems
http://www.emesystems.com
mailto:tracy@e...
KF4HAZ" <techsupport@f...> wrote:
> I need to be able to take 1.5% of a 16bit variable but X*.015 does
not work
yikes !
I deal with instruments that have 1.5% error in some cases.
that would make trying to measure 1.5% of the sensor output
(variable) equal to the expected reading. or, 100% error.
Dave
In general, however, you want to multiply X by 15 and then divide by
1000, unless that would make 15 X too big. Then you might try to divide
by 1000 and then multiply by 15. I think you get the idea. Decimals are
not available.
On Tuesday, July 15, 2003, at 11:57 AM, FalconWireless Tech Support -
KF4HAZ wrote:
> I need to be able to take 1.5% of a 16bit variable but X*.015 does not
> work
>
>
> To UNSUBSCRIBE, just send mail to:
> basicstamps-unsubscribe@yahoogroups.com
> from the same email address that you subscribed. Text in the Subject
> and Body of the message will be ignored.
>
>
> Your use of Yahoo! Groups is subject to
> http://docs.yahoo.com/info/terms/
>
>
>
On Tuesday, July 15, 2003, at 07:07 PM, Mark Marpet wrote:
> Someone check me on this, as it definitely depends upon the value of X.
> In general, however, you want to multiply X by 15 and then divide by
> 1000, unless that would make 15 X too big. Then you might try to divide
> by 1000 and then multiply by 15. I think you get the idea. Decimals are
> not available.
>
>
> On Tuesday, July 15, 2003, at 11:57 AM, FalconWireless Tech Support -
> KF4HAZ wrote:
>
>> I need to be able to take 1.5% of a 16bit variable but X*.015 does not
>> work
>>
>>
>> To UNSUBSCRIBE, just send mail to:
>> basicstamps-unsubscribe@yahoogroups.com
>> from the same email address that you subscribed. Text in the Subject
>> and Body of the message will be ignored.
>>
>>
>> Your use of Yahoo! Groups is subject to
>> http://docs.yahoo.com/info/terms/
>>
>>
>>
>
>
> To UNSUBSCRIBE, just send mail to:
> basicstamps-unsubscribe@yahoogroups.com
> from the same email address that you subscribed. Text in the Subject
> and Body of the message will be ignored.
>
>
> Your use of Yahoo! Groups is subject to
> http://docs.yahoo.com/info/terms/
>
>
>