| |

VerySource

 Forgot password?
 Register
Search
View: 1800|Reply: 5

Find a small program, masters enter

[Copy link]

1

Threads

3

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

Post time: 2020-1-14 16:00:01
| Show all posts |Read mode
Use the sse instruction to quickly compare two floating-point functions, ready to be embedded in VC.

Experts please provide source code, thank you!
Reply

Use magic Report

0

Threads

15

Posts

13.00

Credits

Newbie

Rank: 1

Credits
13.00

 Unknown

Post time: 2020-1-18 14:27:01
| Show all posts
Quickly compare two floating point numbers

// what to compare?
Reply

Use magic Report

1

Threads

3

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

 Author| Post time: 2020-1-18 21:36:01
| Show all posts
Compare float

if (floata-floatb> 0.0001)
{
   ...
}
This is slower

I hope that the expert provides a function comparefloat written by the sink
if (comparefloat (a, b) == 0)
{
   ...
}

Seems to use cmpdd instruction? I'm not familiar with compilation, I hope to help, thank you
Reply

Use magic Report

0

Threads

5

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

Post time: 2020-1-19 23:54:01
| Show all posts
Personally, I do n’t need to use SSE because the SSE instruction set is used to process large amounts of data, such as 4 FLOATs at the same time.
If it ’s not processing massive amounts of data, it ’s very inefficient.
Floating-point instructions are used, without looking at the instruction cycle, I don't know if it is fast
float comp (float x, float y)
 {asm
   {
   FLD x; load X into st (0)
   // FCOM y; you can also use the comparison instruction to set the sign bit
   FSUB y st (0) -y results in st (0)
   FST x stores st (0) into X
   }
   return x;

  }
Reply

Use magic Report

1

Threads

3

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

 Author| Post time: 2020-3-29 22:45:01
| Show all posts
Thank you
Reply

Use magic Report

0

Threads

22

Posts

14.00

Credits

Newbie

Rank: 1

Credits
14.00

 China

Post time: 2020-8-12 14:45:01
| Show all posts
Just a few lines of code, no improvement
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list