%INTH (四捨五入を伴う整数形式への変換)
%INTH(numeric or character expression)
%INTH は %INT と同じですが、式が 10 進数値、浮動値、または文字値の場合には、整数タイプへの変換時に、式の値に四捨五入が適用されるという点 が異なります。 四捨五入が実行できない場合、メッセージは出されません。
詳細については、変換命令または 組み込み関数を参照してください。
図 1. %INT および %INTH の例
*..1....+....2....+....3....+....4....+....5....+....6....+....7...+....
D*Name++++++++++ETDsFrom+++To/L+++IDc.Keywords+++++++++++++++++++++++++
D p7 s 7p 3 inz (1234.567)
D s9 s 9s 5 inz (73.73442)
D f8 s 8f inz (123.789)
D c15a s 15a inz (' 12345.6789 -')
D c15b s 15a inz (' + 9 8 7 . 6 5 4 ')
D result1 s 15p 5
D result2 s 15p 5
D result3 s 15p 5
D array s 1a dim (200)
D a s 1a
/FREE
// using numeric parameters
result1 = %int (p7) + 0.011; // "result1" is now 1234.01100.
result2 = %int (s9); // "result2" is now 73.00000
result3 = %inth (f8); // "result3" is now 124.00000.
// using character parameters
result1 = %int (c15a); // "result1" is now -12345.00000
result2 = %inth (c15b); // "result2" is now 988.00000
// %INT and %INTH can be used as array indexes
a = array (%inth (f8));
/END-FREE