[z88dk-dev] sccz80 %a.bf, sccz80 float literals, build.sh

Bridge to the z88dk-developers mailing list
Post Reply
alvin
Well known member
Posts: 1872
Joined: Mon Jul 16, 2007 7:39 pm

[z88dk-dev] sccz80 %a.bf, sccz80 float literals, build.sh

Post by alvin »

A few minor things:

* sccz80 is not correctly identifying that printf strings containing %a.bf need the float printf.
http://www.z88dk.org/forum/viewtopic.php?id=9428

* sccz80 seems to be converting float literals with less precision than the math library can support.

* build.sh : I've added the new c library into the build script, which hopefully won't screw up the windows and mac builds. People downloading the source tarball would end up with 3-month old z80 libraries from cvs rather than a recent version and build.sh wasn't making new versions.

* there's some weird issue where the sp1 sprite libraries are built in z88dk/libsrc/sprites/software/sp1 but not copied into the nightly builds. The nightly build script shows the libraries being built but the libraries are not present in the downloads. I solved it by committing those libraries to cvs so they will be present despite this happening.



------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are
consuming the most bandwidth. Provides multi-vendor support for NetFlow,
J-Flow, sFlow and other flows. Make informed decisions using capacity planning
reports. http://sdm.link/zohomanageengine
User avatar
dom
Well known member
Posts: 2076
Joined: Sun Jul 15, 2007 10:01 pm

Post by dom »

The detection is pretty naive - I'll endeavour to fix it up today. Though the pragma option will have to be given with sdcc still.

Regarding precision - have you got an example? -doublestr as an option is a good workaround that though - it saves the literals as strings and does a runtime conversion which is handy for fp libraries that don't have the same format.

The source tarball is literally a copy of CVS - the library build happens afterwards. I can rejig the order though
On 17 Jun 2016, at 07:22, alvin (alvin_albrecht@...) <lists@...> wrote:

A few minor things:

* sccz80 is not correctly identifying that printf strings containing %a.bf need the float printf.
http://www.z88dk.org/forum/viewtopic.php?id=9428

* sccz80 seems to be converting float literals with less precision than the math library can support.

* build.sh : I've added the new c library into the build script, which hopefully won't screw up the windows and mac builds. People downloading the source tarball would end up with 3-month old z80 libraries from cvs rather than a recent version and build.sh wasn't making new versions.

* there's some weird issue where the sp1 sprite libraries are built in z88dk/libsrc/sprites/software/sp1 but not copied into the nightly builds. The nightly build script shows the libraries being built but the libraries are not present in the downloads. I solved it by committing those libraries to cvs so they will be present despite this happening.



------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are
consuming the most bandwidth. Provides multi-vendor support for NetFlow,
J-Flow, sFlow and other flows. Make informed decisions using capacity planning
reports. http://sdm.link/zohomanageengine
------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are
consuming the most bandwidth. Provides multi-vendor support for NetFlow,
J-Flow, sFlow and other flows. Make informed decisions using capacity planning
reports. http://sdm.link/zohomanageengine
alvin
Well known member
Posts: 1872
Joined: Mon Jul 16, 2007 7:39 pm

Post by alvin »

Though the pragma option will have to be given with sdcc still.
Is printf working with sdcc already? sdcc won't do l->r order for var arg functions AFAIK.
Regarding precision - have you got an example? -doublestr as an option is a good workaround that though - it saves the literals as strings and does a runtime conversion which is handy for fp libraries that don't have the same format.
Yeah:

Code: Select all

#include <stdio.h>
#include <math.h>

main()
{
//   printf("e = %.20f\n", 2.718281828459045235);
printf("e = %.20f\n", 2.71828182845);
}
If I compile with:
zcc +zx -vn check.c -o check.bin -lm -lndos -create-app
I get six significant digits.

If I compile with:
zcc +zx -vn check.c -o check.bin -lm -lndos -create-app -doublestr
I get twelve significant digits.

There's also a bug when the float literal is too long. If you use the commented out printf, sccz80 gets the float literal completely incorrect printing something close to zero.
The source tarball is literally a copy of CVS - the library build happens afterwards. I can rejig the order though
I think the correct fix is to add a line to build.sh to build the new c lib z80 libraries at the same time the classic c lib z80 libraries are built. I added that in for the June 18 build but I haven't had time to verify that it works yet.



------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are
consuming the most bandwidth. Provides multi-vendor support for NetFlow,
J-Flow, sFlow and other flows. Make informed decisions using capacity planning
reports. http://sdm.link/zohomanageengine
User avatar
dom
Well known member
Posts: 2076
Joined: Sun Jul 15, 2007 10:01 pm

Post by dom »

On 17 Jun 2016, at 17:40, alvin (alvin_albrecht@...) <lists@...> wrote:

Though the pragma option will have to be given with sdcc still.
Is printf working with sdcc already? sdcc won't do l->r order for var arg functions AFAIK.
Yes that came out of my rewrite of printf a few months ago.

Regarding precision - have you got an example? -doublestr as an option is a good workaround that though - it saves the literals as strings and does a runtime conversion which is handy for fp libraries that don't have the same format.
Yeah:
Thanks. The fp code is pretty lousy on sccz80 - last time I looked at it there was a much better way of doing it so I probably ought to do that soon.
I think the correct fix is to add a line to build.sh to build the new c lib z80 libraries at the same time the classic c lib z80 libraries are built. I added that in for the June 18 build but I haven't had time to verify that it works yet.
The build does build the new libraries. I've now changed the build driver script (not checked in) to create a tarball with the latest libraries though sp1 isn't included yet.


------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are
consuming the most bandwidth. Provides multi-vendor support for NetFlow,
J-Flow, sFlow and other flows. Make informed decisions using capacity planning
reports. http://sdm.link/zohomanageengine
User avatar
dom
Well known member
Posts: 2076
Joined: Sun Jul 15, 2007 10:01 pm

Post by dom »

On Fri, 17 Jun 2016, Dom wrote:
Thanks. The fp code is pretty lousy on sccz80 - last time I looked at it
there was a much better way of doing it so I probably ought to do that
soon.
I've rewritten the float parsing so it should now be accurate and get the
right precision. It looks like math48 + genmath share the same format
which is handy. The other libraries that are supported will be very
similar (z88 has a 40 bit mantissa and an exponent bias of 127).




------------------------------------------------------------------------------
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape
User avatar
dom
Well known member
Posts: 2076
Joined: Sun Jul 15, 2007 10:01 pm

Post by dom »

On Sun, 10 Jul 2016, Dom Morris wrote:
On Fri, 17 Jun 2016, Dom wrote:
Thanks. The fp code is pretty lousy on sccz80 - last time I looked at it
there was a much better way of doing it so I probably ought to do that
soon.
I've rewritten the float parsing so it should now be accurate and get the
right precision. It looks like math48 + genmath share the same format
which is handy. The other libraries that are supported will be very
similar (z88 has a 40 bit mantissa and an exponent bias of 127).
32 bits of mantissa even, I've had to back this out because 0 and 0.5
didn't convert properly. It'll return soon.

------------------------------------------------------------------------------
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape
alvin
Well known member
Posts: 1872
Joined: Mon Jul 16, 2007 7:39 pm

Post by alvin »

I've rewritten the float parsing so it should now be accurate and get the
right precision
It seems to work great now.
It looks like math48 + genmath share the same format
which is handy.
Yes. There is a minor difference in the byte order stored in memory and the fact that math48 can hold a float in registers (BCDEHL') makes it re-entrant. There is one very nice side-effect of having registers hold the result of the last computation rather than a memory based accumulator: the code generated by sccz80 using fastcall and callee math functions comes out very nice.



------------------------------------------------------------------------------
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape
Post Reply