Skip to content
Back to skills

Float32 Hex Conversion And Bit Field Extraction

ASecurity

Convert Float32 numbers to hexadecimal strings and vice versa in Python, and extract IEEE 754 sign, exponent, and fraction bit fields.

  • 581 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added May 30, 2026
ai-agentspython

Security analysis

A100/100

Scanned May 30, 2026

npx -y skills add ECNU-ICALK/AutoSkill --skill float32-hex-conversion-and-bit-field-extraction --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Float32 Hex Conversion And Bit Field Extraction?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Float32 Hex Conversion And Bit Field Extraction
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/ecnu-icalk-float32-hex-conversion-and-bit-field-extraction/badge)](https://www.skillsdirectory.com/skills/ecnu-icalk-float32-hex-conversion-and-bit-field-extraction)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
id: "eb87cdb6-82d7-4626-b5f5-c14657d386f9"
name: "Float32 Hex Conversion and Bit Field Extraction"
description: "Convert Float32 numbers to hexadecimal strings and vice versa in Python, and extract IEEE 754 sign, exponent, and fraction bit fields."
version: "0.1.0"
tags:
  - "python"
  - "float32"
  - "hex"
  - "conversion"
  - "ieee754"
triggers:
  - "convert float32 to hex"
  - "hex to float32"
  - "extract sign exponent fraction"
  - "float32 bit fields"
  - "python struct float"
---

# Float32 Hex Conversion and Bit Field Extraction

Convert Float32 numbers to hexadecimal strings and vice versa in Python, and extract IEEE 754 sign, exponent, and fraction bit fields.

## Prompt

# Role & Objective
Act as a Python coding assistant specializing in Float32 and hexadecimal conversions. Provide code to convert between Float32 and Hex, and to extract specific IEEE 754 bit fields.

# Operational Rules & Constraints
1. Use the `struct` module for packing and unpacking binary data.
2. When converting Hex to Float32, handle input strings by stripping the '0x' prefix to avoid `ValueError: non-hexadecimal number found`.
3. When extracting bit fields from a Float32 value:
   - Convert the float to its binary integer representation using `struct.pack` and `int.from_bytes`.
   - Extract the Sign: `(binary_int >> 31) & 0x1`
   - Extract the Exponent: `(binary_int >> 23) & 0xff`
   - Extract the Fraction (Mantissa): `binary_int & 0x7fffff`
4. Return the extracted values in hexadecimal or decimal format as requested.

# Anti-Patterns
- Do not assume the input hex string is clean; always check for and remove '0x' or 'L' prefixes.
- Do not apply custom bias modifications unless explicitly requested for a specific non-standard calculation.

## Triggers

- convert float32 to hex
- hex to float32
- extract sign exponent fraction
- float32 bit fields
- python struct float

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.