-
Notifications
You must be signed in to change notification settings - Fork 0
/
sapdecf.h
1479 lines (1332 loc) · 58 KB
/
sapdecf.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/* @(#) $Id: //bas/753_REL/src/base/api/sapdecf.h#2 $ SAP*/
/*-----------------------------------------------------------------------------
*
* (c) Copyright SAP AG, Walldorf
*
* sapdecf.h - Global header file for decimal floating-point arithmetic.
*
* Maintainer: Ulrich Brink, Klaus Kretzschmar
* Topic:
* Main File:
*
*----------------------------------------------------------------------------*/
/*-------------------------------------------------------------------
* This is a global header file for the definition of decimal
* floating-point types and functions operating on them.
*
* "saptype.h" must be included before this file.
* If you make changes to this file: Do not assume
* that anything else has been included before!
*-------------------------------------------------------------------*/
/*-------------------------------------------------------------------
* This file offers conversion functions, arithmetic functions and
* other utility functions.
* This is an overview of the conversion functions:
*
* Conversions to and from elementary data types:
*
* DecFloat16ToDecFloat34
* DecFloat34ToDecFloat16
*
* DecFloat16ToString
* DecFloat34ToString
*
* StringToDecFloat16 (see also ab_ctodecf16)
* StringToDecFloat34 (see also ab_ctodecf34)
*
* DecFloat16ToSAP_INT
* DecFloat16ToSAP_LLONG
* DecFloat34ToSAP_INT
* DecFloat34ToSAP_LLONG
*
* SAP_INTToDecFloat16
* SAP_LLONGToDecFloat16
* SAP_INTToDecFloat34
* SAP_LLONGToDecFloat34
*
* DecFloat16ToSAP_DOUBLE
* DecFloat34ToSAP_DOUBLE
* SAP_DOUBLEToDecFloat16
* SAP_DOUBLEToDecFloat34
*
* DecFloat16ToBCD
* DecFloat34ToBCD
* BCDToDecFloat16
* BCDToDecFloat34
*
*
* Conversion into an SAP-proprietary format that can be sorted by memcpy:
*
* DecFloat16ToDecFloat16Raw, DecFloat16ToDecFloat16RawDB
* DecFloat34ToDecFloat34Raw, DecFloat34ToDecFloat34RawDB
* NormDecFloat16ToDecFloat16Raw
* NormDecFloat34ToDecFloat34Raw
*
* Conversion from the SAP-proprietary sortable format into IEEE 754r Decfloats:
*
* DecFloat16RawToDecFloat16, DecFloat16RawToDecFloat16DB
* DecFloat34RawToDecFloat34, DecFloat34RawToDecFloat34DB
* DecFloat16RawToNormDecFloat16
* DecFloat34RawToNormDecFloat34
*
* Other functions
*
* DecFloat34StrDiv
*
*-------------------------------------------------------------------*/
/*-HISTORY---------------------------------------------------------------------
* 06.09.2005 kkr first implementation
* 24.07.2009 tmd Implementation for unsigned int and long int added
*----------------------------------------------------------------------------*/
/**
@file sapdecf.h
*/
#ifndef SAPDECF_H
#define SAPDECF_H
/* @type SAP_API |
* The token SAP_API contains plattform dependent keywords,
* which are necessary to allow dynamic linking of these function
* from various environments. On Windows for example SAP_API is
* __extern __loadds __pascal __far.
*/
#if !defined(SAP_FAR)|| !defined(SAP_PASCAL)|| !defined(SAP_EXPORT)|| !defined(SAP_LOADDS) || !defined(SAP_STDCALL)
# undef SAP_FAR
# undef SAP_PASCAL
# undef SAP_EXPORT
# undef SAP_LOADDS
# undef SAP_STDCALL
# if defined(SAPonWINDOWS)
# define SAP_FAR __far
# define SAP_PASCAL __pascal
# define SAP_EXPORT __export
# define SAP_LOADDS __loadds
# define SAP_STDCALL
# elif defined(SAPonNT)
# define SAP_FAR
# define SAP_PASCAL
# define SAP_EXPORT
# define SAP_LOADDS
# define SAP_STDCALL _stdcall
# else
# define SAP_FAR
# define SAP_PASCAL
# define SAP_EXPORT
# define SAP_LOADDS
# define SAP_STDCALL
# endif
#endif
#if !defined(SAP_API)
# if defined(OS2)
# define _SYSTEM _System
# define SAP_API _SYSTEM
# else
# define _SYSTEM
# define SAP_API SAP_FAR SAP_LOADDS SAP_PASCAL SAP_STDCALL
# endif
#endif /* SAP_API */
#ifndef DECL_EXP
# if defined(SAPonLIN) && defined(__GNUC__) && defined(GCC_HIDDEN_VISIBILITY)
# define DECL_EXP __attribute__((visibility("default")))
# else
# define DECL_EXP
# endif
#endif
/**
*brief Error return codes.
* (The return codes are set to the value decNumber has.)
*
* A note on error handling:
* Often, DECF_INEXACT and DECF_UNDERFLOW can be handled in the same way as DECF_OK.
* If DECF_NO_MEMORY occurs, the caller should abort.
*/
typedef enum {
/** decNumber shared library could not be loaded; not relevant for SAP Kernel. */
DECF_NOT_SUPPORTED = -2,
/** decNumber shared library has wrong version; not relevant for SAP Kernel. */
DECF_WRONG_VERSION = -1,
/** no exception occurred */
DECF_OK = 0,
/** an inexact exception occurred (number was rounded) */
DECF_INEXACT ,
/** an underflow exception occurred (number was rounded such that the result is zero) */
DECF_UNDERFLOW ,
/** an overflow exception occurred (number was out of range, e.g., exponent too big) */
DECF_OVERFLOW ,
/** a conversion syntax exception occurred */
DECF_CONV_SYNTAX ,
/** a division by zero exception occurred */
DECF_DIV_ZERO ,
/** an invalid operation exception occurred */
DECF_INVALID_OP ,
/** a memory allocation error occurred */
DECF_NO_MEMORY
} DECF_RETURN;
/**
* \brief Rounding modes (IEEE 854 compliant).
* Please compare with libDecimal.h before edit
*/
typedef enum {
/** round towards +infinity */
DECF_ROUND_CEILING = 0,
/** round away from 0 */
DECF_ROUND_UP = 1,
/** 0.5 rounds up */
DECF_ROUND_HALF_UP = 2,
/** 0.5 rounds to nearest even */
DECF_ROUND_HALF_EVEN = 3,
/** 0.5 rounds down */
DECF_ROUND_HALF_DOWN = 4,
/** round towards 0 (truncate) */
DECF_ROUND_DOWN = 5,
/** round towards -infinity */
DECF_ROUND_FLOOR = 6,
/** enum must be less than this */
DECF_ROUND_MAX = 7
} DecFRounding;
#ifdef SAPwithINT_LITTLEENDIAN
/** Minimum (in the sense of total ordering) IEEE 754r value = -Infinity */
static const DecFloat16 DecFloat16NegInf = {{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8}};
/** Minimum (in the sense of total ordering) IEEE 754r value = -Infinity */
static const DecFloat34 DecFloat34NegInf = {{0x00, 0x00, 0x00, 0x00, 0x00,0x00, 0x00, 0x00, 0x00, 0x00,0x00, 0x00, 0x00, 0x00, 0x00, 0xf8}};
/** 0E+0 */
static const DecFloat16 DecFloat16ZeroVal =
{{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x22}};
static const DecFloat34 DecFloat34ZeroVal =
{{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x22}};
#else
static const DecFloat16 DecFloat16NegInf = {{0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}};
static const DecFloat34 DecFloat34NegInf = {{0xf8, 0x00, 0x00, 0x00, 0x00,0x00, 0x00, 0x00, 0x00, 0x00,0x00, 0x00, 0x00, 0x00, 0x00, 0x00}};
/** 0E+0 */
static const DecFloat16 DecFloat16ZeroVal =
{{0x22, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}};
static const DecFloat34 DecFloat34ZeroVal =
{{0x22, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}};
#endif /* SAPwithINT_LITTLEENDIAN */
/** \brief Number of significant digits in the mantissa */
static const int DecFloat16_NoOfDigits = 16;
static const int DecFloat34_NoOfDigits = 34;
BEGIN_externC
/* mutex lock and unlock */
void decf_mutex_lock(void);
void decf_mutex_unlock(void);
/* library initialization */
/**
* \brief DecFloatDBmode: See DecFloat_InitializeDBmode()
*/
typedef enum {
DECF_DBmode_initial = 0, /**< Initial */
DECF_DBmode_roundForDEC = 1, /**< Rounding necessary for DF16_DEC, DF34_DEC */
DECF_DBmode_native = 2 /**< The DB supports decimal floating-point types. */
} DecFloatDBmode;
/**
* \brief Initialize a flag that indicates whether the database supports
* decimal floating-point types or just the SAP-proprietary types
* DF16_DEC, DF34_DEC (fixed-point on the DB, rounding necessary), and
* DF16_RAW, DF34_RAW (binary sortable raw fields on the DB).
* The flag is evaluated in very few special functions only.
*
* @param decfDBmode Cf. enum DecFloatDBmode
*/
DECL_EXP void SAP_API DecFloat_InitializeDBmode(DecFloatDBmode decfDBmode);
/**
* \brief Decimal Floating Point Shared Library Initialization
*
* This function loads the decNumber shared library libicudecnumber$(SHLIB_EXT)
* and initializes the global decimal floating point environment.
* This function does nothing if the static library sapdecflib is used.
*
* @return DECF_OK -- Fine
* @return DECF_NOT_SUPPORTED -- Shared library could not be loaded
* @return DECF_WRONG_VERSION -- Shared library has wrong version (check dev-traces)
*/
DECL_EXP DECF_RETURN SAP_API InitDecFloatLib(void);
/* DecFloat <-> String conversions */
/**
* \brief Convert DecFloat16 to String.
*
* This function converts a DecFloat16 number into a string of type SAP_UC*.
* The caller is responsible for the memory handling.
*
* @param numstr A pointer to a SAP_UC buffer of type DecFloat16Buff.
* @param dfp16 A 64-bit IEEE 754r variable
* @return: Always DECF_OK
*/
DECL_EXP DECF_RETURN SAP_API DecFloat16ToString(DecFloat16 dfp16, DecFloat16Buff* numstr);
/**
* \brief Convert DecFloat34 to String.
*
* This function converts a DecFloat34 number into a string of type SAP_UC*.
* The caller is responsible for the memory handling.
*
* @param numstr A pointer to a SAP_UC buffer of type DecFloat34Buff.
* @param dfp34 A 128-bit IEEE 754r variable
* @return: Always DECF_OK
*/
DECL_EXP DECF_RETURN SAP_API DecFloat34ToString(DecFloat34 dfp34, DecFloat34Buff* numstr);
/**
* \brief Convert (numeric) String to Decfloat16.
*
* This function converts a numeric string of type SAP_UC* into a Decfloat16 number.
* (In the ABAP runtime, use ab_ctodecf16().)
*
* @param numstr A pointer to an array of SAP_UC* containing the numeric string.
* @param dfp16 A pointer to a 64-bit IEEE 754r variable
* @return DECF_OK -- Fine
* @return DECF_INEXACT, DECF_UNDERFLOW -- Almost fine
* @return DECF_OVERFLOW -- Number is out of range, e.g., exponent too big
* @return DECF_CONV_SYNTAX -- String contains invalid characters
* @return DECF_NO_MEMORY -- A memoy allocation error occurred
*/
DECL_EXP DECF_RETURN SAP_API StringToDecFloat16(const SAP_UC* numstr, DecFloat16* dfp16);
/**
* \brief Convert (numeric) String to Decfloat34.
*
* This function converts a numeric string of type SAP_UC* into a Decfloat34 number.
* (In the ABAP runtime, use ab_ctodecf34().)
*
* @param numstr A pointer to an array of SAP_UC* containing the numeric string.
* @param dfp34 A pointer to a 128-bit IEEE 754r variable
* @return DECF_OK -- Fine
* @return DECF_INEXACT, DECF_UNDERFLOW -- Almost fine
* @return DECF_OVERFLOW -- Number is out of range, e.g., exponent too big
* @return DECF_CONV_SYNTAX -- String contains invalid characters
* @return DECF_NO_MEMORY -- A memoy allocation error occurred
*/
DECL_EXP DECF_RETURN SAP_API StringToDecFloat34(const SAP_UC* numstr, DecFloat34* dfp34);
/* DecFloat <-> DecFloat conversion */
/**
* \brief Convert DecFloat16 to DecFloat34
* @return: Always DECF_OK if the static library sapdecflib is used.
*/
DECL_EXP DECF_RETURN SAP_API DecFloat16ToDecFloat34(DecFloat34* dfp34_res, DecFloat16 dfp16);
/**
* \brief Convert DecFloat34 to DecFloat16
*
* (In the ABAP runtime, use ab_decf34ToDecf16().)
* @return DECF_OK -- Fine
* @return DECF_INEXACT, DECF_UNDERFLOW -- Almost fine
* @return DECF_OVERFLOW -- Number is out of range, e.g., exponent too big
* @return DECF_NO_MEMORY -- A memoy allocation error occurred
*/
DECL_EXP DECF_RETURN SAP_API DecFloat34ToDecFloat16(DecFloat16* dfp16_res, DecFloat34 dfp34);
/* DecFloat <-> binary sortable DecFloat conversion */
/**
* \brief Convert 64-bit IEEE 754r decimal floating point variable to 8-byte binary sortable format and store scale information.
*
* This function converts a DecFloat16 into an SAP-proprietary format that can be sorted by memcpy.
* For this purpose, this function has to normalize the DecFloat16 (e.g., 1.50 -> 1.5).
* The scale information is stored in a separate variable.
* (In the ABAP runtime, use ab_DecFloat16ToDecFloat16Raw().)
*
* @param dfp16raw_res A pointer to an array of 8 bytes.
* @param scale A pointer to a SAP_SHORT variable (provided by the caller).
* @param dfp16 A 64-bit IEEE 754r decimal floating point variable
* @return DECF_OK -- Fine
* @return DECF_NO_MEMORY -- A memoy allocation error occurred
*/
DECL_EXP DECF_RETURN SAP_API DecFloat16ToDecFloat16Raw(DecFloat16Raw* dfp16raw_res, SAP_SHORT* scale, DecFloat16 dfp16);
/**
* \brief Convert 8-byte binary sortable format into 64-bit IEEE 754r decimal floating point variable.
*
* In order set the scale of the IEEE 754r variable, this function needs
* additional information about the scale.
* In ABAP, this functionality is available as CL_ABAP_DECFLOAT_RAW=>DECFR16_TO_DECF16.
*
* @param dfp16_res A pointer to a 64-bit IEEE 754r variable
* @param dfp16raw A 8-byte sortable decimal floating point variable.
* @param scale The desired scale. If scale == -32768, the result will be
* normalized, e.g. 1.5 rather than 1.50. Invalid values for
* scale will be treated graciously.
*
* @return: Always DECF_OK
*/
DECL_EXP DECF_RETURN SAP_API DecFloat16RawToDecFloat16(DecFloat16* dfp16_res, DecFloat16Raw dfp16raw, SAP_SHORT scale);
/**
* \brief Convert 128-bit IEEE 754r decimal floating point variable to 16-byte binary sortable format and store scale information.
*
* This function converts a DecFloat34 into an SAP-proprietary format that can be sorted by memcpy.
* For this purpose, this function has to normalize the DecFloat34 (e.g., 1.50 -> 1.5).
* The scale information is stored in a separate variable.
* (In the ABAP runtime, use ab_DecFloat34ToDecFloat34Raw().)
*
* @param dfp34raw_res A pointer to an array of 16 bytes.
* @param scale A pointer to a SAP_SHORT variable (provided by the caller).
* @param dfp34 A 128-bit IEEE 754r decimal floating point variable
* @return DECF_OK -- Fine
* @return DECF_NO_MEMORY -- A memoy allocation error occurred
*/
DECL_EXP DECF_RETURN SAP_API DecFloat34ToDecFloat34Raw(DecFloat34Raw* dfp34raw_res, SAP_SHORT* scale, DecFloat34 dfp34);
/**
* \brief Convert 16-byte binary sortable format into 128-bit IEEE 754r decimal floating point variable.
*
* In order set the scale information of the IEEE 754r variable, this function needs
* additional information about the scale.
* In ABAP, this functionality is available as CL_ABAP_DECFLOAT_RAW=>DECFR34_TO_DECF34.
*
* @param dfp34_res A pointer to a 128-bit IEEE 754r variable
* @param dfp34raw A 16-byte sortable decimal floating point variable.
* @param scale The desired scale. If scale == -32768, the result will be
* normalized, e.g. 1.5 rather than 1.50. Invalid values for
* scale will be treated graciously.
*
* @return: Always DECF_OK
*/
DECL_EXP DECF_RETURN SAP_API DecFloat34RawToDecFloat34(DecFloat34* dfp34_res, DecFloat34Raw dfp34raw, SAP_SHORT scale);
/**
* \brief Same as DecFloat16ToDecFloat16Raw
*/
DECL_EXP DECF_RETURN SAP_API DecFloat16ToDecFloat16RawDB(DecFloat16Raw* dfp16raw_res, SAP_SHORT* scale, DecFloat16 dfp16);
/**
* \brief Same as DecFloat16RawToDecFloat16
*/
DECL_EXP DECF_RETURN SAP_API DecFloat16RawToDecFloat16DB(DecFloat16* dfp16_res, DecFloat16Raw dfp16raw, SAP_SHORT scale);
/**
* \brief Same as DecFloat34ToDecFloat34Raw
*/
DECL_EXP DECF_RETURN SAP_API DecFloat34ToDecFloat34RawDB(DecFloat34Raw* dfp34raw_res, SAP_SHORT* scale, DecFloat34 dfp34);
/**
* \brief Same as DecFloat34RawToDecFloat34
*/
DECL_EXP DECF_RETURN SAP_API DecFloat34RawToDecFloat34DB(DecFloat34* dfp34_res, DecFloat34Raw dfp34raw, SAP_SHORT scale);
/**
* \brief Convert 64-bit IEEE 754r decimal floating point variable to 8-byte binary sortable format without scale information.
*
* This function converts a DecFloat16 into an SAP-proprietary format that can be sorted by memcpy.
* For this purpose, this function has to normalize the DecFloat16 (e.g., 1.50 -> 1.5).
* (In the ABAP runtime, you may use ab_NormDecFloat16ToDecFloat16Raw().)
*
* @param dfp16raw_res A pointer to an array of 8 bytes.
* @param dfp16 A 64-bit IEEE 754r decimal floating point variable
* @return DECF_OK -- Fine
* @return DECF_NO_MEMORY -- A memoy allocation error occurred
*/
DECL_EXP DECF_RETURN SAP_API NormDecFloat16ToDecFloat16Raw(DecFloat16Raw* dfp16raw_res, DecFloat16 dfp16);
/**
* \brief Convert 8-byte binary sortable format into 64-bit IEEE 754r decimal floating point variable.
*
* The result will be normalized, e.g., 1.5 rather than 1.50.
*
* @param dfp16_res A pointer to a 64-bit IEEE 754r variable
* @param dfp16raw An 8-byte sortable decimal floating point variable
*
* @return: Always DECF_OK
*/
DECL_EXP DECF_RETURN SAP_API DecFloat16RawToNormDecFloat16(DecFloat16* dfp16_res, DecFloat16Raw dfp16raw);
/**
* \brief Convert 128-bit IEEE 754r decimal floating point variable to 16-byte binary sortable format without scale information.
*
* This function converts a DecFloat34 into an SAP-proprietary format that can be sorted by memcpy.
* For this purpose, this function has to normalize the DecFloat34 (e.g., 1.50 -> 1.5).
* (In the ABAP runtime, you may use ab_NormDecFloat34ToDecFloat34Raw().)
*
* @param dfp34raw_res A pointer to an array of 16 bytes.
* @param dfp34 A 128-bit IEEE 754r decimal floating point variable
* @return DECF_OK -- Fine
* @return DECF_NO_MEMORY -- A memoy allocation error occurred
*/
DECL_EXP DECF_RETURN SAP_API NormDecFloat34ToDecFloat34Raw(DecFloat34Raw* dfp34raw_res, DecFloat34 dfp34);
/**
* \brief Convert 16-byte binary sortable format into 128-bit IEEE 754r decimal floating point variable.
*
* The result will be normalized, e.g., 1.5 rather than 1.50.
*
* @param dfp34_res A pointer to a 128-bit IEEE 754r variable
* @param dfp34raw An 16-byte sortable decimal floating point variable
*
* @return: Always DECF_OK
*/
DECL_EXP DECF_RETURN SAP_API DecFloat34RawToNormDecFloat34(DecFloat34* dfp34_res, DecFloat34Raw dfp34raw);
/* DecFloat <-> Integer conversion */
/**
* \brief Convert DecFloat16 to 4-byte or 8-byte integer.
* (In the ABAP runtime, use ab_decf16ToI() or ab_decf16ToI8().)
* @return: DECF_OK, DECF_INEXACT, DECF_UNDERFLOW
* DECF_OVERFLOW -- Number is out of range, e.g., exponent too big
* DECF_INVALID_OP -- DecFloat is a NaN or Infinity
* DECF_NO_MEMORY -- A memoy allocation error occurred
*/
DECL_EXP DECF_RETURN SAP_API DecFloat16ToSAP_INT(SAP_INT* i, DecFloat16 dfp16);
DECL_EXP DECF_RETURN SAP_API DecFloat16ToSAP_LLONG(SAP_LLONG* l, DecFloat16 dfp16);
/**
* \brief Convert 4-byte integer to DecFloat16.
* (In the ABAP runtime, use ab_iToDecf16().)
* @return: DECF_OK
* DECF_NO_MEMORY
*/
DECL_EXP DECF_RETURN SAP_API SAP_INTToDecFloat16(DecFloat16* dfp16_res, SAP_INT i);
/**
* \brief Convert 8-byte integer to DecFloat16.
* (In the ABAP runtime, use ab_i8ToDecf16().)
* @return: DECF_OK
* DECF_INEXACT
* DECF_NO_MEMORY
*/
DECL_EXP DECF_RETURN SAP_API SAP_LLONGToDecFloat16(DecFloat16* dfp16_res, SAP_LLONG l);
/**
* \brief Convert DecFloat34 to 4-byte or 8-byte integer.
* (In the ABAP runtime, use ab_decf34ToI() or ab_decf34ToI8().)
* @return: DECF_OK, DECF_INEXACT, DECF_UNDERFLOW
* DECF_OVERFLOW -- Number is out of range, e.g., exponent too big
* DECF_INVALID_OP -- DecFloat is a NaN or Infinity
* DECF_NO_MEMORY -- A memoy allocation error occurred
*/
DECL_EXP DECF_RETURN SAP_API DecFloat34ToSAP_INT(SAP_INT* i, DecFloat34 dfp34);
DECL_EXP DECF_RETURN SAP_API DecFloat34ToSAP_LLONG(SAP_LLONG* l, DecFloat34 dfp34);
/**
* \brief Convert 4-byte or 8-byte integer to DecFloat34.
* (In the ABAP runtime, use ab_iToDecf34() or ab_i8ToDecf34().)
* @return: DECF_OK
* DECF_NO_MEMORY
*/
DECL_EXP DECF_RETURN SAP_API SAP_INTToDecFloat34(DecFloat34* dfp34_res, SAP_INT i);
DECL_EXP DECF_RETURN SAP_API SAP_LLONGToDecFloat34(DecFloat34* dfp34_res, SAP_LLONG l);
/* DecFloat <-> Double conversion */
/**
* \brief Convert DecFloat to 8-byte binary float.
* The rounding behavior is platform dependent.
* (In the ABAP runtime, consider using ab_decf16ToF() or ab_decf34ToF().)
* @return: DECF_OK -- As an exception from the normal meaning of DECF_OK:
* The number may have been rounded and may be a NaN or Infinity.
* DECF_OVERFLOW -- Number is out of range, e.g., exponent too big.
*/
DECL_EXP DECF_RETURN SAP_API DecFloat16ToSAP_DOUBLE(SAP_DOUBLE* d, DecFloat16 dfp16);
DECL_EXP DECF_RETURN SAP_API DecFloat34ToSAP_DOUBLE(SAP_DOUBLE* d, DecFloat34 dfp34);
/**
* \brief Convert 8-byte binary float to DecFloat.
* The rounding behavior is platform dependent.
* ATTENTION: The behavior for NaNs and Infinities is platform dependent.
* (In the ABAP runtime, consider using ab_fToDecf16() or ab_fToDecf34().)
* @return: DECF_INEXACT -- The number may have been rounded or may be exact!
* DECF_NO_MEMORY
*/
DECL_EXP DECF_RETURN SAP_API SAP_DOUBLEToDecFloat16(DecFloat16* dfp16_res, SAP_DOUBLE i);
DECL_EXP DECF_RETURN SAP_API SAP_DOUBLEToDecFloat34(DecFloat34* dfp34_res, SAP_DOUBLE i);
/* DecFloat <-> BCD conversion */
/**
* \brief Convert to ABAP type P (BCD).
*
* Convert a 64-bit IEEE 754r decimal floating point variable into the
* ABAP type P.
*
* INPUT:
* @param dfp16 Decfloat value
* @param length Length of BCD buffer in bytes
* @param decPlaces Number of decimal places (Nachkommastellen) of the
* BCD number
* OUTPUT:
* @param bcd Unaligned BCD number
*
* @return DECF_OK
* @return DECF_INEXACT
* @return DECF_UNDERFLOW
* @return DECF_OVERFLOW Overflow. A higher level should raise a catchable
* exception.
* @return DECF_NO_MEMORY The caller should abort.
* @return DECF_INVALID_OP Input is a NaN or Infinity or garbage. The caller should raise an exception.
*/
DECL_EXP DECF_RETURN SAP_API DecFloat16ToBCD(SAP_RAW* bcd_res, DecFloat16 dfp16, intR length, intR decPlaces);
/**
* \brief Round IEEE value such that it fits into ABAP type P (BCD).
*
* If decFloatDBmode == DECF_DBmode_roundForDEC:
* Round a 64-bit IEEE 754r decimal floating point value according to
* decPlaces and check that it fits into the BCD type specified.
* When returning from this function, dfp16 has at most decPlaces
* decimal places, but it may have less.
*
* INPUT:
* @param length Length of BCD buffer in bytes
* @param decPlaces Number of decimal places (Nachkommastellen) of the
* BCD number
* CHANGE:
* @param dfp16 Decfloat value
*
* @return DECF_OK
* @return DECF_INEXACT
* @return DECF_UNDERFLOW
* @return DECF_OVERFLOW Overflow. A higher level should raise a catchable
* exception.
* @return DECF_NO_MEMORY The caller should abort.
* @return DECF_INVALID_OP Garbage input. The caller should raise an exception.
*/
DECL_EXP DECF_RETURN SAP_API DecFloat16RoundForDEC(DecFloat16* dfp16, intR length, intR decPlaces);
/**
* \brief Compare an IEEE value with a DF16_DEC value.
*
* If decFloatDBmode == DECF_DBmode_roundForDEC:
* This function rounds an IEEE value according the specified number of
* decimal places (Nachkommastellen) and compares the result with
* another DecFloat value. (The latter is assumed to be a DF16_DEC
* value which has already been rounded.)
* If decFloatDBmode == DECF_DBmode_native, both values are not rounded,
* but just compared.
*
* INPUT:
* @param unroundedDf IEEE decimal floating point value, will be rounded if
* decFloatDBmode == DECF_DBmode_roundForDEC.
* @param dbValue DF16_DEC value in IEEE decimal floating point format
* @param decPlaces Number of decimal places (Nachkommastellen) of the
* DF16_DEC type
* OUTPUT:
* @param p_rc DECF_OK, DECF_INEXACT, DECF_UNDERFLOW: No special
* action necessary;
* DECF_NO_MEMORY: The caller should abort;
* DECF_INVALID_OP: Garbage input, the caller should raise an exception.
*
* @return -1 if (rounded) IEEE value < dbValue
* 0 if (rounded) IEEE value numerically equal to dbValue
* 1 if (rounded) IEEE value > dbValue.
* If p_rc is DECF_INVALID_OP,
* the return value is guaranteed to be non-zero.
*/
DECL_EXP SAP_INT SAP_API DecFloat16CompareForDEC(DecFloat16 unroundedDf,
DecFloat16 dbValue,
intR decPlaces,
DECF_RETURN* p_rc);
/**
* \brief Convert from ABAP type P (BCD) to 64-bit IEEE 754r
*
* Convert a BCD number (ABAP type P) into a 64-bit IEEE 754r decimal
* floating point variable.
*
* INPUT:
* @param bcd Unaligned BCD number
* @param length Length of BCD number in bytes
* @param decPlaces Number of decimal places of the BCD number
*
* OUTPUT:
* @param dfp16_res Decfloat value
*
* @return DECF_OK
* @return DECF_INEXACT
* @return DECF_NO_MEMORY The caller should abort.
* @return DECF_INVALID_OP Garbage input. The caller should raise an exception.
*/
DECL_EXP DECF_RETURN SAP_API BCDToDecFloat16(DecFloat16* dfp16_res, SAP_RAW* bcd, intR length, intR decPlaces );
/**
* \brief Convert to ABAP type P (BCD).
*
* Convert a 128-bit IEEE 754r decimal floating point variable into the
* ABAP type P.
*
* INPUT:
* @param dfp34 Decfloat value
* @param length Length of BCD buffer in bytes
* @param decPlaces Number of decimal places (Nachkommastellen) of the
* BCD number
* OUTPUT:
* @param bcd Unaligned BCD number
*
* @return DECF_OK
* @return DECF_INEXACT
* @return DECF_UNDERFLOW
* @return DECF_OVERFLOW Overflow. A higher level should raise a catchable
* exception.
* @return DECF_NO_MEMORY The caller should abort.
* @return DECF_INVALID_OP Input is a NaN or Infinity or garbage. The caller should raise an exception.
*/
DECL_EXP DECF_RETURN SAP_API DecFloat34ToBCD(SAP_RAW* bcd_res, DecFloat34 dfp34, intR length, intR decPlaces);
/**
* \brief Round IEEE value such that it fits into ABAP type P (BCD).
*
* If decFloatDBmode == DECF_DBmode_roundForDEC:
* Round a 128-bit IEEE 754r decimal floating point value according to
* decPlaces and check that it fits into the BCD type specified.
*
* INPUT:
* @param length Length of BCD buffer in bytes
* @param decPlaces Number of decimal places (Nachkommastellen) of the
* BCD number
* CHANGE:
* @param dfp34 Decfloat value
*
* @return DECF_OK
* @return DECF_INEXACT
* @return DECF_UNDERFLOW
* @return DECF_OVERFLOW Overflow. A higher level should raise a catchable
* exception.
* @return DECF_NO_MEMORY The caller should abort.
* @return DECF_INVALID_OP Garbage input. The caller should raise an exception.
*/
DECL_EXP DECF_RETURN SAP_API DecFloat34RoundForDEC(DecFloat34* dfp34, intR length, intR decPlaces);
/**
* \brief Compare an IEEE value with a DF34_DEC value.
*
* If decFloatDBmode == DECF_DBmode_roundForDEC:
* This function rounds an IEEE value according the specified number of
* decimal places (Nachkommastellen) and compares the result with
* another DecFloat value. (The latter is assumed to be a DF34_DEC
* value which has already been rounded.)
* If decFloatDBmode == DECF_DBmode_native, both values are not rounded,
* but just compared.
*
* INPUT:
* @param unroundedDf IEEE decimal floating point value, will be rounded if
* decFloatDBmode == DECF_DBmode_roundForDEC.
* @param dbValue DF34_DEC value in IEEE decimal floating point format
* @param decPlaces Number of decimal places (Nachkommastellen) of the
* DF34_DEC type
* OUTPUT:
* @param p_rc DECF_OK, DECF_INEXACT, DECF_UNDERFLOW: No special
* action necessary;
* DECF_NO_MEMORY: The caller should abort;
* DECF_INVALID_OP: Garbage input; the caller should raise an exception.
*
* @return -1 if (rounded) IEEE value < dbValue
* 0 if (rounded) IEEE value numerically equal to dbValue
* 1 if (rounded) IEEE value > dbValue.
* If p_rc is DECF_OVERFLOW or DECF_INVALID_OP,
* the return value is guaranteed to be non-zero.
*/
DECL_EXP SAP_INT SAP_API DecFloat34CompareForDEC(DecFloat34 unroundedDf,
DecFloat34 dbValue,
intR decPlaces,
DECF_RETURN* p_rc);
/**
* \brief Convert from ABAP type P (BCD) to 128-bit IEEE 754r
*
* Convert a BCD number (ABAP type P) into a 128-bit IEEE 754r decimal
* floating point variable.
*
* INPUT:
* @param bcd Unaligned BCD number
* @param length Length of BCD number in bytes
* @param decPlaces Number of decimal places of the BCD number
*
* OUTPUT:
* @param dfp34_res Decfloat value
*
* @return DECF_OK
* @return DECF_NO_MEMORY The caller should abort.
* @return DECF_INVALID_OP Garbage input. The caller should raise an exception.
*/
DECL_EXP DECF_RETURN SAP_API BCDToDecFloat34(DecFloat34* dfp34_res, SAP_RAW* bcd, intR length, intR decPlaces );
/* Decfloat arithmetic operations */
/**
* \brief Computes the sum of two DecFloat16 numbers.
*
* The number *dfp16_res is set to dfp16_lhs + dfp16_rhs.
* @param dfp16_res Pointer to the IEEE 754r 64-bit variable where the result is stored.
* @param dfp16_lhs Left-hand side operand.
* @param dfp16_rhs Right-hand side operand.
*
* @return DECF_OK
* @return DECF_INEXACT
* @return DECF_OVERFLOW -- Exponent of result too big.
* @return DECF_NO_MEMORY -- A memory allocation error occurred.
* @return DECF_INVALID_OP -- Arguments are no-numbers.
*/
DECL_EXP DECF_RETURN SAP_API DecFloat16_Add(DecFloat16* dfp16_res, DecFloat16 dfp16_lhs, DecFloat16 dfp16_rhs );
/**
* \brief Computes the sum of two DecFloat34 numbers.
*
* The number *dfp34_res is set to dfp34_lhs + dfp34_rhs.
* @param dfp34_res Pointer to the IEEE 754r 128-bit variable where the result is stored.
* @param dfp34_lhs Left-hand side operand.
* @param dfp34_rhs Right-hand side operand.
*
* @return DECF_OK
* @return DECF_INEXACT
* @return DECF_OVERFLOW -- Exponent of result too big.
* @return DECF_NO_MEMORY -- A memory allocation error occurred.
* @return DECF_INVALID_OP -- Arguments are no-numbers.
*/
DECL_EXP DECF_RETURN SAP_API DecFloat34_Add(DecFloat34* dfp34_res, DecFloat34 dfp34_lhs, DecFloat34 dfp34_rhs );
/**
* \brief Computes the difference of two DecFloat16 numbers.
*
* The number *dfp16_res is set to dfp16_lhs - dfp16_rhs.
* @param dfp16_res Pointer to the IEEE 754r 64-bit variable where the result is stored.
* @param dfp16_lhs Left-hand side operand.
* @param dfp16_rhs Right-hand side operand.
*
* @return DECF_OK
* @return DECF_INEXACT
* @return DECF_OVERFLOW -- Exponent of result too big.
* @return DECF_NO_MEMORY -- A memory allocation error occurred.
* @return DECF_INVALID_OP -- Arguments are no-numbers.
*/
DECL_EXP DECF_RETURN SAP_API DecFloat16_Sub(DecFloat16* dfp16_res, DecFloat16 dfp16_lhs, DecFloat16 dfp16_rhs );
/**
* \brief Computes the difference of two DecFloat34 numbers.
*
* The number *dfp34_res is set to dfp34_lhs - dfp34_rhs.
* @param dfp34_res Pointer to the IEEE 754r 128-bit variable where the result is stored.
* @param dfp34_lhs Left-hand side operand.
* @param dfp34_rhs Right-hand side operand.
*
* @return DECF_OK
* @return DECF_INEXACT
* @return DECF_OVERFLOW -- Exponent of result too big.
* @return DECF_NO_MEMORY -- A memory allocation error occurred.
* @return DECF_INVALID_OP -- Arguments are no-numbers.
*/
DECL_EXP DECF_RETURN SAP_API DecFloat34_Sub(DecFloat34* dfp34_res, DecFloat34 dfp34_lhs, DecFloat34 dfp34_rhs );
/**
* \brief Computes the multiplication of two DecFloat16 numbers.
*
* The number *dfp16_res is set to dfp16_lhs * dfp16_rhs.
* @param dfp16_res Pointer to the IEEE 754r 64-bit variable where the result is stored.
* @param dfp16_lhs Left-hand side operand.
* @param dfp16_rhs Right-hand side operand.
*
* @return DECF_OK, DECF_INEXACT, DECF_UNDERFLOW
* @return DECF_OVERFLOW -- Exponent of result too big.
* @return DECF_NO_MEMORY -- A memory allocation error occurred.
* @return DECF_INVALID_OP -- Arguments are no-numbers.
*/
DECL_EXP DECF_RETURN SAP_API DecFloat16_Mult(DecFloat16* dfp16_res, DecFloat16 dfp16_lhs, DecFloat16 dfp16_rhs );
/**
* \brief Computes the multiplication of two DecFloat34 numbers.
*
* The number *dfp34_res is set to dfp34_lhs / dfp34_rhs.
* @param dfp34_res Pointer to the IEEE 754r 128-bit variable where the result is stored.
* @param dfp34_lhs Left-hand side operand.
* @param dfp34_rhs Right-hand side operand.
*
* @return DECF_OK, DECF_INEXACT, DECF_UNDERFLOW
* @return DECF_OVERFLOW -- Exponent of result too big.
* @return DECF_NO_MEMORY -- A memory allocation error occurred.
* @return DECF_INVALID_OP -- Arguments are no-numbers.
*/
DECL_EXP DECF_RETURN SAP_API DecFloat34_Mult(DecFloat34* dfp34_res, DecFloat34 dfp34_lhs, DecFloat34 dfp34_rhs );
/**
* \brief Computes the division of two DecFloat16 numbers.
*
* The number *dfp16_res is set to dfp16_lhs / dfp16_rhs.
* @param dfp16_res Pointer to the IEEE 754r 64-bit variable where the result is stored.
* @param dfp16_lhs Left-hand side operand.
* @param dfp16_rhs Right-hand side operand.
*
* @return DECF_OK, DECF_INEXACT, DECF_UNDERFLOW
* @return DECF_OVERFLOW -- Exponent of result too big.
* @return DECF_DIV_ZERO -- Division by zero.
* @return DECF_NO_MEMORY -- A memory allocation error occurred.
* @return DECF_INVALID_OP -- Arguments are no-numbers or division is not defined (f.g. 0/0).
*/
DECL_EXP DECF_RETURN SAP_API DecFloat16_Div(DecFloat16* dfp16_res, DecFloat16 dfp16_lhs, DecFloat16 dfp16_rhs );
/**
* \brief Computes the division of two DecFloat34 numbers.
*
* The number *dfp34_res is set to dfp34_lhs / dfp34_rhs.
* @param dfp34_res Pointer to the IEEE 754r 128-bit variable where the result is stored.
* @param dfp34_lhs Left-hand side operand.
* @param dfp34_rhs Right-hand side operand.
*
* @return DECF_OK, DECF_INEXACT, DECF_UNDERFLOW
* @return DECF_OVERFLOW -- Exponent of result too big.
* @return DECF_DIV_ZERO -- Division by zero.
* @return DECF_NO_MEMORY -- A memory allocation error occurred.
* @return DECF_INVALID_OP -- Arguments are no-numbers or division is not defined (f.g. 0/0).
*/
DECL_EXP DECF_RETURN SAP_API DecFloat34_Div(DecFloat34* dfp34_res, DecFloat34 dfp34_lhs, DecFloat34 dfp34_rhs );
/**
* \brief Computes the DIV operator.
* Note: In ABAP, DIV is defined differently, see ab_Decf34Div().
*/
DECL_EXP DECF_RETURN SAP_API DecFloat16_DIV(DecFloat16* dfp16_res, DecFloat16 dfp16_lhs, DecFloat16 dfp16_rhs );
DECL_EXP DECF_RETURN SAP_API DecFloat34_DIV(DecFloat34* dfp34_res, DecFloat34 dfp34_lhs, DecFloat34 dfp34_rhs );
/**
* \brief Computes the MOD operator.
* Note: In ABAP, MOD is defined differently, see ab_Decf34Mod().
*/
DECL_EXP DECF_RETURN SAP_API DecFloat16_MOD(DecFloat16* dfp16_res, DecFloat16 dfp16_lhs, DecFloat16 dfp16_rhs );
DECL_EXP DECF_RETURN SAP_API DecFloat34_MOD(DecFloat34* dfp34_res, DecFloat34 dfp34_lhs, DecFloat34 dfp34_rhs );
/* Relational and logical operations */
/* Op == */
/**
* \brief Equality operation for DecFloat16 numbers.
*
* This function checks whether two DecFloat16 numbers
* are numerically equal, i.e. it is independent of the
* scale of the numbers.
* (In the ABAP runtime, consider using ab_decf16Eq().)
*
* @param dfp16_lhs Left-hand side operand.
* @param dfp16_rhs Right-hand side operand.
* @param prc Return code. Possible values: DECF_OK -- Fine, DECF_NO_MEMORY -- A memory allocation error occurred,DECF_INVALID_OP -- Arguments are no-numbers .
*
* @return TRUE,FALSE
*/
DECL_EXP SAP_BOOL SAP_API DecFloat16_EQ(DecFloat16 dfp16_lhs, DecFloat16 dfp16_rhs, DECF_RETURN* prc );
/**
* \brief Equality operation for DecFloat34 numbers.
*
* This function checks whether two DecFloat34 numbers
* are numerically equal, i.e. it is independent of the
* scale of the numbers.
* (In the ABAP runtime, consider using ab_decf34Eq().)
*
* @param dfp34_lhs Left-hand side operand.
* @param dfp34_rhs Right-hand side operand.
* @param prc Return code. Possible values: DECF_OK -- Fine, DECF_NO_MEMORY -- A memory allocation error occurred,DECF_INVALID_OP -- Arguments are no-numbers .
*
* @return TRUE,FALSE
*/
DECL_EXP SAP_BOOL SAP_API DecFloat34_EQ(DecFloat34 dfp34_lhs, DecFloat34 dfp34_rhs, DECF_RETURN* prc );
/* Op > */
/**
* \brief Relational ">" operation for DecFloat16 numbers.
*
* This function checks whether a DecFloat16 number
* is numerically greater than another, independent of the
* scale of the numbers.
*
* @param dfp16_lhs Left-hand side operand.
* @param dfp16_rhs Right-hand side operand.
* @param prc Return code. Possible values: DECF_OK -- Fine, DECF_NO_MEMORY -- A memory allocation error occurred,DECF_INVALID_OP -- Arguments are no-numbers .
*
* @return TRUE,FALSE
*/
DECL_EXP SAP_BOOL SAP_API DecFloat16_GT(DecFloat16 dfp16_lhs, DecFloat16 dfp16_rhs, DECF_RETURN* prc );
/**
* \brief Relational ">" operation for DecFloat34 numbers.
*
* This function checks whether a DecFloat34 number
* is numerically greater than another, independent of the
* scale of the numbers.
*
* @param dfp34_lhs Left-hand side operand.
* @param dfp34_rhs Right-hand side operand.
* @param prc Return code. Possible values: DECF_OK -- Fine, DECF_NO_MEMORY -- A memory allocation error occurred,DECF_INVALID_OP -- Arguments are no-numbers .
*
* @return TRUE,FALSE
*/
DECL_EXP SAP_BOOL SAP_API DecFloat34_GT(DecFloat34 dfp34_lhs, DecFloat34 dfp34_rhs, DECF_RETURN* prc );
/* Op < */
/**
* \brief Relational "<" operation for DecFloat16 numbers.
*
* This function checks whether a DecFloat16 number
* is numerically less than another, independent of the
* scale of the numbers.
*
* @param dfp16_lhs Left-hand side operand.
* @param dfp16_rhs Right-hand side operand.
* @param prc Return code. Possible values: DECF_OK -- Fine, DECF_NO_MEMORY -- A memory allocation error occurred,DECF_INVALID_OP -- Arguments are no-numbers .