SCOUG Logo


Next Meeting: Sat, TBD
Meeting Directions


Be a Member
Join SCOUG

Navigation:


Help with Searching

20 Most Recent Documents
Search Archives
Index by date, title, author, category.


Features:

Mr. Know-It-All
Ink
Download!










SCOUG:

Home

Email Lists

SIGs (Internet, General Interest, Programming, Network, more..)

Online Chats

Business

Past Presentations

Credits

Submissions

Contact SCOUG

Copyright SCOUG



warp expowest
Pictures from Sept. 1999

The views expressed in articles on this site are those of their authors.

warptech
SCOUG was there!


Copyright 1998-2024, Southern California OS/2 User Group. ALL RIGHTS RESERVED.

SCOUG, Warp Expo West, and Warpfest are trademarks of the Southern California OS/2 User Group. OS/2, Workplace Shell, and IBM are registered trademarks of International Business Machines Corporation. All other trademarks remain the property of their respective owners.

The Southern California OS/2 User Group
USA

SCOUG-Programming Mailing List Archives

Return to [ 15 | February | 2005 ]

<< Previous Message <<


Date: Tue, 15 Feb 2005 09:58:45 PST8
From: Benedict G. Archer <bga0@sbcglobal.net >
Reply-To: scoug-programming@scoug.com
To: scoug-programming@scoug.com
Subject: SCOUG-Programming: Open Source Object Rexx

In <4211B55D.618D@peterskye.com>, on 02/15/2005
at 12:40 AM, Peter Skye said:

>Benedict G.Archer wrote:
>>
>> two cents from a lurker:

>Ben, great to hear from you! What's going on up there?

>> J supports exact calculations using a syntax for a rational number,
>> numerator r denominator. The operator that creates the exact
>> representation of a decimal (or any base) value is 'x:'. For example,
>>
>> 17%83 yields 0.204819 (the divide operator in J is %)
>> x: 17%83 gives 17r83
>> and
>> x: 13 + 17%83 gives 1096r83
>> x: 13 + 0.204819 gives 5220261405187r395330023470
>> and
>> x: (11%3) * (4%7) gives 44r21 (some parens are needed)

>Hmm. Can I multiply two r values, for example can I do the following?

> x: 2r3 * 4r5

>which should yield 8r15

yes, that works

>Also, is there a kind of "fractional rounding" (my term) so that

> x: 1.333333333

>would yield 4r3?

no, x: 1.333333333 yields 11223924302167r8417943228730
You entered a rational number that has a non-terminating
decimal representation as a truncated approximation. 1.333333333 will be
an adequate approximation to 4/3 for many purposes, but it's not the same
number as 4/3. Now, 1333333333r1000000000 seems a simpler representation.
The numerator and denominator are relatively prime in both, I don't know
why J returns what it did.

>> another syntax for exact calculations appends an x, e.g.,
>> 44%21 gives 2.09524...
>> 44%21x gives 44r21

>Rewriting my last example above, would

> 1.333333333x

>result in 1333333333r1000000000 or 4r3?

neither. 1.333333333x generates an error, "ill-formed number." The
appended x only causes results of certain operations to be saved in an
exact representation. At least that's my current understanding. I think
it's used more to save the full value of large integers. As in,

!44 produces 265827e54 (saved precision is more, however)
but to get the exact value,
!44x results in 2658271574788448768043625811014615890319638528000000000

>Good info, thanks Ben.

>- Peter

I find J really interesting, but that's a different topic.

Ben

--
-----------------------------------------------------------
Benedict G. Archer
-----------------------------------------------------------

=====================================================

To unsubscribe from this list, send an email message
to "steward@scoug.com". In the body of the message,
put the command "unsubscribe scoug-programming".

For problems, contact the list owner at
"postmaster@scoug.com".

=====================================================


<< Previous Message <<

Return to [ 15 | February | 2005 ]



The Southern California OS/2 User Group
P.O. Box 26904
Santa Ana, CA 92799-6904, USA

Copyright 2001 the Southern California OS/2 User Group. ALL RIGHTS RESERVED.

SCOUG, Warp Expo West, and Warpfest are trademarks of the Southern California OS/2 User Group. OS/2, Workplace Shell, and IBM are registered trademarks of International Business Machines Corporation. All other trademarks remain the property of their respective owners.