xref: /php-src/ext/opcache/tests/jit/gh10271.phpt (revision c16ad918)
1--TEST--
2GH-10271: Incorrect arithmetic calculations when using JIT
3--INI--
4opcache.enable=1
5opcache.enable_cli=1
6opcache.file_update_protection=0
7opcache.jit_hot_loop=1
8--FILE--
9<?php
10$tang['KSI']=-9.1751656444142E-5;
11$tang['ETA']=8.5076090069491E-5;
12
13$sol['X']['k']=-222.45470924306;
14$sol['X']['e']=-8.1787760034414;
15$sol['X'][1]=-0.020231298698539;
16
17$sol['Y']['k']=-14.400586941152;
18$sol['Y']['e']=392.95090925357;
19$sol['Y'][1]=-0.035664413413272;
20
21$sol['xc']=968;
22$sol['yc']=548;
23
24for( $p=0; $p<3; $p++ )
25{
26	print($p.': ');
27	Tangential2XY($tang,$sol);
28}
29
30function Tangential2XY(array $tang, array $sol) : array
31{
32	$x = $sol['X']['k']*$tang['KSI'] + $sol['X']['e']*$tang['ETA'] + $sol['X'][1];
33	$y = $sol['Y']['k']*$tang['KSI'] + $sol['Y']['e']*$tang['ETA'] + $sol['Y'][1];
34	printf("In;%.12f;%.12f;%.12f;%.12f;",$x,$y,$sol['xc'],$sol['yc']);
35	$x = $sol['xc']*($x+1);
36	$y = $sol['yc']*($y+1);
37	printf("Out;%.12f;%.12f\n",$x,$y);
38	if( $x<100 )
39		exit("Mamy to!\n");
40	return ['x'=>$x,'y'=>$y];
41}
42?>
43--EXPECT--
440: In;-0.000516528926;-0.000912408759;968.000000000000;548.000000000000;Out;967.500000000004;547.500000000009
451: In;-0.000516528926;-0.000912408759;968.000000000000;548.000000000000;Out;967.500000000004;547.500000000009
462: In;-0.000516528926;-0.000912408759;968.000000000000;548.000000000000;Out;967.500000000004;547.500000000009
47