Skip to content

Incorrect arithmetic calculations when using JIT (2) #10271

Closed
@GajowyJ

Description

@GajowyJ

Description

EDIT: The test to reproduce the issue is in the comment below: #10271 (comment)

This bug is the same as #10195. The previous ticket was closed because it has not been confirmed in 8.1.13 (by my mistake - zend extenstion not configured correctlyin php.ini). After repeating with the correct setting, the issue appeared.

Additional informations: tests showed that the value of $sol['xc'] and $sol['yc'] variables in line 6 and 7 below behave as they were both equal =1 (and in fact are not!).

1 function Tangential2XY($tang,$sol)
2 {
3	$x = $sol['X']['k']*$tang['KSI'] + $sol['X']['e']*$tang['ETA'] + $sol['X'][1];
4	$y = $sol['Y']['k']*$tang['KSI'] + $sol['Y']['e']*$tang['ETA'] + $sol['Y'][1];
5	printf("In;%.12f;%.12f;%.12f;%.12f;",$x,$y,$sol['xc'],$sol['yc']);
6	$x = $sol['xc']*($x+1);
7	$y = $sol['yc']*($y+1);
8	printf("Out;%.12f;%.12f\n",$x,$y);
9	return ['x'=>$x,'y'=>$y];
10 }

The above code produces when JIT enabled:
In;0.005909845561;0.003134992878;968.000000000000;548.000000000000;Out;1.005909845561;1.003134992878

...and when JIT disabled (correct values):
In;0.005909845561;0.003134992878;968.000000000000;548.000000000000;Out;973.720730502727;549.717976097410

It is important to mention that sometimes the same function works correctly, however it's not random - the problem appears exactly in the same place of code execution. From other hand skipping part of the unrelated code causes the problem appears in another place or doesn't appear at all.

PHP Version

PHP 8.1.13

Operating System

Windows 10

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions