library-math16

Guides editing and testing of the z88dk math16 half-float library across CPU targets.

1.1k|206|Updated Mar 16, 2016
One-click install
npx skills add https://github.com/z88dk/z88dk --skill library-math16-z88dk
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: library-math16
Source: https://github.com/z88dk/z88dk/tree/main/.agents/skills/library-math16
Command: npx skills add https://github.com/z88dk/z88dk --skill library-math16-z88dk

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Working on z88dk's math16 half-float library requires navigating per-CPU assembly cores, classic versus newlib build recipes, and subtle algorithm policies (restoring division vs Newton-Raphson inverse) that are easy to get wrong without documented rules. ## Core Features & Use Cases - Library layout guidance: Maps the math16 source tree (asm/, c/, per-CPU cores for z80, 8085, 8080, gbz80) and explains which files belong to classic versus newlib products. - Coding and build rules: Enforces conventions such as using sqrf16 for squares, invsqrtf16 for inverse square roots, sccz80-only higher functions on 8080/8085/gbz80, and correct Makefile clean/rebuild steps. - Use Case: When adding a new half-float function or fixing a math16 bug, follow the agent rules to place code in the right CPU directory, rebuild the correct .lib targets, and run the full test suite across all supported CPUs. ## Quick Start Ask the assistant to review or modify a math16 library function in libsrc/math/float/math16 and verify it with the math16 test suite targets.

Frequently Asked Questions about library-math16

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I build and test the z88dk math16 library?

Build classic products with make -C libsrc math16.lib and copy them into lib/clibs/, then run the suite via make -C test/suites/math with the per-CPU test_math16 targets. For newlib, rebuild with make -C libsrc/newlib math16 z80 after deleting stale math16 object files.

What is the difference between math16 div and inv in z88dk?

Division (asm_f16_div) uses a restoring algorithm, while inverse (asm_f16_inv) uses Newton-Raphson iteration. In C higher functions you should write 1.0/x for reciprocals rather than calling invf16, mirroring the math32 policy.

Does math16 support 8080, 8085, and gbz80 CPUs?

Yes, math16 ships per-CPU libraries for 8080, 8085, and gbz80, but higher C functions on these targets compile with sccz80 only. The 8085 build often also needs -lmath32_8085 for higher helpers, and there is no fix16 product for these CPUs.

Can I use math16 together with math32 or math48?

Yes, --math16 is an adjunct library and does not conflict with math32, math48, or am9511. However the math16 product provides no printf, scanf, or dtoa support.

Why does my math16 change not appear after rebuilding?

Classic 8085/8080/gbz80 Makefile targets have no OBJECTS dependencies, so stale objects persist. Manually remove the asm_f16_*.o files and math16 libraries, rebuild, and verify symbols like cm16_sccz80_mul_callee resolve correctly in the map file.