De:       [EMAIL PROTECTED]
        Objet:  Rép : [GENERAL] Extended unit
        Date:   28 janvier 2005 18:18:18 GMT+01:00
        À:        [EMAIL PROTECTED]

I have done a new version with
- a new conversion function
- possibility to enter value as fraction
- addition of the operator + - * / = <> != > < >= <=
- SQL only code

Some results :
                calcul                |         result
--------------------------------------+------------------------
 1 m                                  | 1 m
 1/4 m kg-1/2 m1/2 s-3                | 0.25 s-3 m3/2 kg-1/2
 1/2 m2 + 1/4 m2                      | 0.75 m2
 1.5/2 m2 - 1/2.5 m2                  | 0.35 m2
 1 m + 1 s                            | null
 1 m s-1 * 1 s3/2                     | 1 s1/2 m
 1 / 1 s                              | 1 s-1
 2 m ^ 3                              | 8 m3
 1 m = 1 m                            | T
 1 m = 3 m                            | F
 1 m = 1 s                            | null
 unit_conv(3/2 C J2.5 m-1/2.5 kg m-1) | 150 s-6 A m18/5 kg7/2

Exemple of the command:
select ('1.5/2 m2'::text::du - '1/2.5 m2'::text::du)::text
0.35 m2

The code is 600 lines.
I do not know if it is too big to be send on the mailing list.
If someone want to test it, contact me in private.

Note 1: I add a trouble in CAST where a quoted string is recognize as "unknown' and not as "text". For this reason I force the type to "texte" before anything else.
Note 2: There is some trouble with the set of SI compatible units. Example: Pa may peta-are or Pascal. I supress the less important unit to keep uniquenness of the unit symbol.


Cordialement,
Jean-Gérard Pailloncy

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
     subscribe-nomail command to [EMAIL PROTECTED] so that your
     message can get through to the mailing list cleanly

Reply via email to