<?php
declare(strict_types=1);
function dec102text($value):string {if(!is_string($value)||!preg_match('/^(-?)([0-9]+)(?:\.([0-9]{1,2}))?$/D',$value,$m))throw new RuntimeException('Exact DEC102 server text required');$int=ltrim($m[2],'0');$int=$int===''?'0':$int;if(strlen($int)>8)throw new RuntimeException('DEC102 out of range');$fraction=str_pad($m[3]??'',2,'0');$negative=$m[1]==='-'&&($int!=='0'||$fraction!=='00');return ($negative?'-':'').$int.'.'.$fraction;}
function nativeDec102Type($value):bool{return is_int($value)||is_float($value)&&is_finite($value)||is_string($value);}
