Floating-point operations (9) in VDSP (bf561): Comparison of long double and float

Source: Internet
Author: User
Tags comparison

By default, VDSP that the two types are the same, so we compare long double and float.

1.1 Type representation

The following are two types of data representations:

TD style= "BORDER:0;PADDING:0;" > exponential number of digits
  float long double
number of bytes 8
symbol bit 1 1
11
number of digits 52
minimum 1.1754943508222875e-38f
Max 3.4028234663852886e+ 38F resolution 1.1920928955078125e-07f

1.2 Operational efficiency under normal conditions

The following table gives the efficiency comparison of two types of operations, select High Performance

Float Long double
Add and subtract operation 132 Cycle 166 Cycle
Multiplication operations Cycle 179 cycle
Division operations Cycle 1506 Cycle

Khan, this long double is too harsh for division!

The following table gives an efficiency comparison of two types of operations, choosing strict IEEE:

Float Long double
Add and subtract operation 310 Cycle 381 Cycle
Multiplication operations 274 cycle 585 Cycle
Division operations 497 cycle 1063 cycle

There's a value here that seems odd, and after choosing the strict IEEE option, long double makes division faster!

This explains the two different options in VDSP's documentation:

THE-FAST-FP (fast floating point) switch directs the compiler to link with the high-speed floating-point emulation librar Y. This library relaxes some of the IEEE floating-point Standard's rules for checking inputs against Not-a-number (NaN) A D denormalized numbers to improve performance. This switch was enabled by default.

THE-IEEE-FP (slower floating point) switch directs the compiler to link with the fully-compliant floating-point Library. This library obeys all of the IEEE floating-point Standard's rules, and incurs a performance penalty when compared with th E default floating-point emulation library.

're told all computations should be slower after using the strict IEEE option, but a long double floating-point division seems to be an exception!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.