- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
Dear Intel Guru:
USE IFPORT
INTEGER(4) array(10), length
INTEGER(4) result, target
length = SIZE(array)
do i = 1,length
array(i) = i
end do
target = 8
write(*,100)length,array,target
100 Format("Array length :: ",i4,/,"Array Elements :: ",10i5,/,"Target number :: ",i5)
result = BSEARCHQQ(LOC(target),LOC(array),length,SRT$INTEGER4)
write(*,*)"Location :: ", result
End
The bsearch sample actually does not run in your manual, here is a simple sample that runs and tell you what all the numbers mean.
Bsearch should also tell you if you got the sort wrong in the original data, that is a trivial step.
Lien copié
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
Thank you! Can you take a few minutes and update the sample to remove the warning message?
I got:
$ ifort b.f90
b.f90(11): warning #6075: The data type of the actual argument does not match the definition. [LENGTH]
result = BSEARCHQQ(LOC(target),LOC(array),length,SRT$INTEGER4)
------------------------------------------^
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
Integer 4 works on 32 bit and integer 8 works on 64 bit, how do I check the version before I compile the program?
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
well INTEGER (INT_PTR_KIND()) :: length would be in keeping seeing has we already have a whole host of non-standard stuff in the example...
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
I am happy to place in your suggestion, of course you are free to help, I was just filling in 5 minutes of spare time and looking at the manual is better than reading Facebook.
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
here are three versions, version one uses kind, version 2 complies on 64 bit and version 3 works on X32 bit.
I usually run x32, it is the default created by Intel and I have never changed it.
take your pick.
USE IFPORT
INTEGER, PARAMETER :: dp = selected_real_kind(15, 307)
integer,parameter :: k15 = selected_int_kind(15)
INTEGER(kind=k15) array(10), length
INTEGER(kind=k15) result, target
length = SIZE(array)
do i = 1,length
array(i) = i
end do
target = 8
write(*,100)length,array,target
100 Format("Array length :: ",i4,/,"Array Elements :: ",10i5,/,"Target number :: ",i5)
result = BSEARCHQQ(LOC(target),LOC(array),length,SRT$INTEGER8)
write(*,*)"Location :: ", result
End
USE IFPORT
INTEGER(8) array(10), length
INTEGER(8) result, target
length = SIZE(array)
do i = 1,length
array(i) = i
end do
target = 8
write(*,100)length,array,target
100 Format("Array length :: ",i4,/,"Array Elements :: ",10i5,/,"Target number :: ",i5)
result = BSEARCHQQ(LOC(target),LOC(array),length,SRT$INTEGER8)
write(*,*)"Location :: ", result
End
USE IFPORT
INTEGER(4) array(10), length
INTEGER(4) result, target
length = SIZE(array)
do i = 1,length
array(i) = i
end do
target = 8
write(*,100)length,array,target
100 Format("Array length :: ",i4,/,"Array Elements :: ",10i5,/,"Target number :: ",i5)
result = BSEARCHQQ(LOC(target),LOC(array),length,SRT$INTEGER4)
write(*,*)"Location :: ", result
End
I threw in the real kind as a bonus. I dislike the print statements that are common in the Intel Manual, I always use format. Real code should check the array is positive increasing in value as a reverse sort will just output zero.
I stole the kind from https://gcc.gnu.org/onlinedocs/gfortran/SELECTED_005fINT_005fKIND.html#SELECTED_005fINT_005fKIND
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
Thank you for these! We'll turn you into a QA engineer yet!
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
I once told an ISO 9001 QA Inspector it was all mindless garbage. He randomly reviewed every one of my files over the next 12 months and then at the next annual meeting, said, do you want to repeat that opinion. I said no.
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
Bug DOC-10914 filed to update the example code snippet to a complete program.
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
@JohnNichols, Karen, the tech writer for the Fortran DGR wrote, "I really do appreciate it when our customers report issues, especially when they provide solutions."
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
Karen fixed this problem, too. It'll be in the next version of the DGR (Developer Guide and Reference) available later this spring.

- S'abonner au fil RSS
- Marquer le sujet comme nouveau
- Marquer le sujet comme lu
- Placer ce Sujet en tête de liste pour l'utilisateur actuel
- Marquer
- S'abonner
- Page imprimable