Decimals in Stamp and Negative
Archiver
Posts: 46,084
Dear Friends:
I have a problem, I want to work with floating point numbers and negative
numbers.
I found some nformation in PBP manual about negative numbers but only
math operations as add, sub and format output (serout2).
On other hand, I want to work with float numbers between 0 and 1
For example: 0.05 - 0.48,etc
Could you help me?
My best regards
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
[noparse][[/noparse]Non-text portions of this message have been removed]
I have a problem, I want to work with floating point numbers and negative
numbers.
I found some nformation in PBP manual about negative numbers but only
math operations as add, sub and format output (serout2).
On other hand, I want to work with float numbers between 0 and 1
For example: 0.05 - 0.48,etc
Could you help me?
My best regards
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
[noparse][[/noparse]Non-text portions of this message have been removed]
Comments
fixed point math. So, suppose you want to compute
.02 * 6. You could scale by 100 so you are computing 2 * 6. This equals
12 which you know has to be scaled back down by 100 (.12). Of course,
you can't do the scaling down in the Stamp since 12/100 = 0. But for
display purposes, or as the input to another scaled computation, 12 is
fine.
However, if you want floating point with no fuss, have a look at
http://www.al-williams.com/awce/pak1.htm -- this allows you to truly
work with 32-bit floating point numbers.
Al Williams
AWC
* 8 channels of PWM
http://www.al-williams.com/awce/pak5.htm
>
Original Message
> From: Gurbi Smith [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=G9rJg7xOMM63rEt6TdVKO1ykhf_yP48lWfNkxNJuDzGIGRlCwDVREq7jS8Wxm4XqcTu3TYzwj_89WP7gCjS2]gurbi_basic@y...[/url
> Sent: Sunday, June 02, 2002 10:26 AM
> To: basicstamps@yahoogroups.com
> Subject: [noparse][[/noparse]basicstamps] Decimals in Stamp and Negative
>
>
>
> Dear Friends:
>
> I have a problem, I want to work with floating point numbers
> and negative numbers. I found some nformation in PBP manual
> about negative numbers but only
> math operations as add, sub and format output (serout2).
>
> On other hand, I want to work with float numbers between 0
> and 1 For example: 0.05 - 0.48,etc
>
> Could you help me?
>
>
> My best regards
>
>
>
>
> Do You Yahoo!?
> Yahoo! - Official partner of 2002 FIFA World Cup
>
> [noparse][[/noparse]Non-text portions of this message have been removed]
>
>
> 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/
>