Post Reply 
[42S] MANT Challenge
01-22-2014, 01:46 PM (This post was last modified: 01-22-2014 02:18 PM by Dieter.)
Post: #4
RE: [42S] MANT Challenge
(01-22-2014 12:38 PM)Werner Wrote:  Fails for 2e-02 and all 0<x<0.1 that are not 10^-n
Fails for 9.99999999999*10^n
The reason is that LOG(9.99999999999) = 1 exactly, on a real 42S
Werner

Simple solution: forget mathematics, use Alpha.

Code:
01 CLA
02 SCI 11
03 ARCL ST X
04 -2
05 AROT
06 ATOX
07 ATOX
08 ANUM

A never owned a 42s, so maybe there's a more elegant way of deleting the last two characters. This will also work on the 41-series if SCI 11 is replaced by SCI 9. Since the display mode is changed, a final command that resets it may be added.

EDIT: Since always the last two characters are deleted, this only works for exponents up to ±99. The code can be adjusted accordingly, while keeping the original idea of using the internal formatting routine in Alpha mode:

Code:
01 CLA
02 SCI 11
03 ARCL ST X
04 ASTO ST X
05 ASHF
06 ASTO ST Y
07 ASHF
08 ATOX
09 ATOX
09 CLA
10 ARCL ST Z
11 ARCL ST T
12 X<>Y
13 XTOA
12 X<>Y
13 XTOA
14 ANUM

This should work for all possible cases. In both routines the sign of X is preserved in the resulting mantissa.

The basic idea is simple: Have X formatted in SCI mode and take the leftmost 14 characters. For X≥0 this may include a trailing "E" which is ignored when the string finally is converted back to a number.

Dieter
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
[42S] MANT Challenge - Werner - 01-22-2014, 09:40 AM
RE: [42S] MANT Challenge - Dieter - 01-22-2014, 08:58 PM
RE: [42S] MANT Challenge - Dieter - 01-22-2014, 09:40 PM
RE: [42S] MANT Challenge - Werner - 01-22-2014, 12:38 PM
RE: [42S] MANT Challenge - Dieter - 01-22-2014 01:46 PM
RE: [42S] MANT Challenge - Werner - 01-22-2014, 02:17 PM
RE: [42S] MANT Challenge - Dieter - 01-22-2014, 02:24 PM
RE: [42S] MANT Challenge - Werner - 01-22-2014, 02:34 PM
RE: [42S] MANT Challenge - Dieter - 01-22-2014, 06:50 PM
RE: [42S] MANT Challenge - Dieter - 01-22-2014, 07:53 PM
RE: [42S] MANT Challenge - Thomas Klemm - 01-23-2014, 12:40 AM
RE: [42S] MANT Challenge - Werner - 01-23-2014, 07:46 AM
RE: [42S] MANT Challenge - Werner - 01-23-2014, 09:34 AM
RE: [42S] MANT Challenge - Werner - 01-23-2014, 11:02 AM
RE: [42S] MANT Challenge - walter b - 01-23-2014, 12:07 PM
RE: [42S] MANT Challenge - Dieter - 01-23-2014, 03:15 PM
RE: [42S] MANT Challenge - Dieter - 01-23-2014, 08:19 PM
RE: [42S] MANT Challenge - Werner - 01-23-2014, 09:06 PM
RE: [42S] MANT Challenge - Dieter - 01-23-2014, 09:53 PM
RE: [42S] MANT Challenge - walter b - 01-24-2014, 08:15 AM
RE: [42S] MANT Challenge - Werner - 01-24-2014, 06:16 AM



User(s) browsing this thread: 8 Guest(s)