Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve intrinsic tests #3145

Merged
merged 2 commits into from
Jan 19, 2024
Merged

Improve intrinsic tests #3145

merged 2 commits into from
Jan 19, 2024

Conversation

Kishan-Ved
Copy link
Contributor

This PR improves intrinsic tests added in: #3123

@Kishan-Ved
Copy link
Contributor Author

@HarshitaKalani How do I check for equality with numbers like 1.11803401e+00 as in the file intrinsics_118.f90 ? I tried the usual way (as done in the other tests), but it isn't working.

@Kishan-Ved
Copy link
Contributor Author

Kishan-Ved commented Jan 19, 2024

I found that tests of the type: print *, hypot( x = 1.e0_4, 0.5e0_4 ) do not work (for all files). Hence, I haven't added such tests. The other variants work, and I've added tests for them.

Copy link
Contributor

@certik certik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@certik certik merged commit 352baf0 into lfortran:main Jan 19, 2024
21 checks passed
@@ -1,3 +1,5 @@
program intrinsics_118
print *, hypot( x = 1.e0_4, y = 0.5e0_4 )
print *, hypot( 1.e0_4, y = 0.5e0_4 )
print *, hypot( 1.e0_4, 0.5e0_4 )
end program intrinsics_118
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How do I check for equality with numbers like 1.11803401e+00 as in the file intrinsics_118.f90 ? I tried the usual way (as done in the other tests), but it isn't working.

program intrinsics_118
    
    print *, hypot( x = 1.e0_4, y = 0.5e0_4 )
    if ( abs( hypot( x = 1.e0_4, y = 0.5e0_4 ) - 1.11803401 ) > 1e-8 ) error stop
        
    print *, hypot( 1.e0_4, y = 0.5e0_4 )
    if ( abs( hypot( 1.e0_4, y = 0.5e0_4 ) - 1.11803401 ) > 1e-8 ) error stop

    print *, hypot( 1.e0_4, 0.5e0_4 )
    if ( abs( hypot( 1.e0_4, 0.5e0_4 ) - 1.11803401 ) > 1e-8 ) error stop

end program intrinsics_118

@Kishan-Ved , this is one way with which this can be done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants