Значок ресурса

Round Off

Нет прав на скачивание
🎮 Запустить в эмуляторе

Автор: Carl Whitwell,Paul Taylor
Год: 1988
Издатели: Your Sinclair
Языки: 🇬🇧 Английский
Формат: 📼 TAP лента
Требования: 🖥️ ZX Spectrum 48K

Ссылки:
Страница на ZXArt
Страница на World Of Spectrum
Страница на Spectrum Computing

Скриншоты:
RoundOff.gif


ROUND OFF


by Paul Taylor & Carl Whitwell





This letter must have taken a while to reach me 'cos it was addressed


to Task Force! But I'm going to print it anyway, 'cos it gives us two


useful rounding functions. Function one rounds off a number to the


nearest integer and takes account of numbers such as 2.5 where it


gives a result of three. The functions should be included in your


programs like this:





100 DEF FN r(v)=INT v+CODE CHR$ (v-INT(v))


110 DEF FN p(v,n)=FN r(v*10^n)/10^n





Function two, which uses Function one, rounds off a number to a


required number of decimal places. Have a butchers at the examples


below:





Command Output


PRINT FN r(2.4) 2


PRINT FN r(2.5) 3


PRINT FN p(123.0678,3) 123.068


PRINT FN p(123.0674,3) 123.067





These routines should speed up of almost any program which uses lots


of floating point maths, and needs to round off numbers. Yes, at last


you can write that Basic spreadsheet program you've always dreamed of


... (Oh brother! Ed)
Автор
Verter_bot
Загрузки
0
Просмотры
15
Расширение
zip
Размер
515 байт
Хэш
99f6eb533abc7c22e20db765ca06a36e
Первый выпуск
Последнее обновление

Оценки

0.00 звезд(ы) 0 оценок
Назад
Вверх